Using OpenHAB with a Raspberry Pi

Nowadays it is common to have smart home products that you can remotely command to control, adjust, and to switch on and off. The single board computer, Raspberry Pi or RBPi is suitable for building a touchscreen command center to interface with such smart products and to provide a suitable interface for control and task scheduling. As an introduction, the project will consist of a Wi-Fi enabled RGB LED strip. It will interface with an RBPi running OpenHAB. This will allow wireless control to switch the LED strip on or off from a smartphone or any other computer on the network.

With OpenHAB, you can interface with over 150 different existing smart home products. Moreover, OpenHAB is very flexible, is open source, and is free to use. Although you can use OpenHAB on an RBPi, it can easily run on any platform – Linux, OS X, or Windows. That means the same setup can be run from any old laptop or desktop you may have lying around.

For this project, the main components you will need are an RBPi and its touchscreen. An RBPi2 is recommended and you can use the 7-inch Raspberry Pi Foundation touchscreen. Some of the additional things you will need are a microSD card, a USB Wi-Fi dongle, a power supply for the RBPi, the NeoPixel LED strip starter pack, a logic level shifter, an ADAfruit HUZZAM ESP8266, and some hookup wire.

To begin, assemble the screen to the RBPi. This can be somewhat tricky if you do not have instructions. There will be two flat ribbon cables, a large one for the display, and a smaller one for the touchscreen. The large cable from the display connects to the display controller board, and the smaller cable from the display controller board connects to the display. Once this is done, you can screw the display controller board with the RBPi on its back on to the standoffs on the back of the screen. The ribbon cable from the controller board connects to the display connector on the RBPi. Power to the display comes from the GPIO pins on the RBPi, for which you need to connect the 5 V and the GND pins via two jumper wires of red and black color, respectively.

Flash the microSD card with the latest build of Raspbian from the Raspberry Pi website and boot up the RBPi with it. You can now connect your keyboard, mouse, and the Wi-Fi adapter. Configure the RBPi to connect to your Wi-Fi network and get the touchscreen to work. For this, you may need to update and upgrade your OS.

The next step is to install the home automation control software, OpenHAB, and its add-ons – follow the instructions here. Next, solder the logic level converter between the ESP8266 and the NeoPixel LED strip. This is necessary, as the strip works on 5 V, whereas its controller, the ESP8266 works on 3.3 V. Make sure the logic level converter is connected the right way. After this, you will need to flash the ESP8266 with the Arduino IDE.

Now, you can download and install the OpenHAB app on to your phone and set it up to control the RBPi on its IP address.