Converting a Van into a Smart Home with a Raspberry Pi

Christopher Cruz
3 min readNov 12, 2020
Photo by Patrick Tomasso on Unsplash

One of my favorite DIY projects that I’m working on is Home/Van Automation, such as controlling an electrical load like lights.

The key idea of Home Automation using Raspberry Pi (or any other platform like Arduino) is to use Raspberry Pi to monitor various electrical loads. In order to do so, we need to operate Relays.

What is a Relay

In layman's terms, a relay is basically an electrically operated switch. In technical terms, a relay is an electromagnet consisting of a circuit that requires a small voltage in order for it to close. If the circuit is closed, a high voltage circuit can be activated up to 240V AC or 30 V DC. The small voltage in our case will come from a Raspberry Pi which runs up 3.3v DC. The Raspberry Pi will serve as a switch since it will control whether the circuit is open or closed.

What is a Relay Module

The aforementioned relay will run on a relay module. The relay module I am using is an 8 channel relay module (find here), which is essentially eight relays on a single board with all the circuitry.

The relay has six pins on it. Some of the pins will be connected to the Raspberry Pi, and the remaining are output pins that will be used for the high voltage utility.

Input Pins

The relay’s input pins will all be connected to the Raspberry Pi through female to female jumper cables

  1. IN1 (Signal) — connects to a GPIO pin that will be controlled by Raspberry Pi. Each relay interfaces with one GPIO pin.
  2. 5V (VCC) — connects to 5v on Raspberry Pi (pin 2 as shown below)
  3. Ground (GND)— connects to the ground of Raspberry Pi (pin 6 as shown below)

Note: If you have an expansion board such as the one below, you do not need to connect the Raspberry Pi and Relay Board with F/F jumper wires, since the connection will be made when placed on top. It is important to note that CH1= GPIO26, CH2 = GPIO20, CH3 = GPIO21.

Output Pins

The relay’s remaining three pins will be connected to the output device. Depending on whether the relay is Normally Close State (Output will be high) or Normally Open State (Output will below), certain output pins are used. We will be using the Normally Open State so that when the circuit closes, the high voltage can activate.

  1. NC (Normally Closed)- used in Normally Close State and will not be used here
  2. C (Common)- used in Normally Open State, and connects to the power source or LED light.
  3. NO (Normally Open)- used in Normally Open State, and connects to a power source or LED light

See below for output of what the complete circuit looks like

In part 2, I’ll cover how to programmatically control IN1 Signal so that the Raspberry Pi can control the circuit.

--

--