Smart Power Strip Based on Beaglebone Black and OpenHAB




Introduction: Smart Power Strip Based on Beaglebone Black and OpenHAB

!!!!! Playing with mains (110/220V) is dangerous, please be VERY VERY careful !!!!!

There are some existing smart power strip designs based on "Raspberry Pi" and two Arduinos, which is shown in the picture "Old design".

This new design differs from these old ones in two ways:

  1. Since Raspberry Pi can control nRF24 by using its own SPI, it is not efficient to put an Arduino in between. Also I prefer Beaglebone Black board since it is cheap and powerful, and especially it has more available peripherals (like GPIO, SPI) than Raspberry Pi.
  2. In old designs, the only way to control the power strip is through the web interface (i.e. OpenHAB). However, it is very inconvenient to do so if the power strip is at hand. Therefore in this design, the power strip has individual switch for every outlet, and people can turn ON/OFF each outlet with or without OpenHAB (if with OpenHAB, the status on OpenHAB will get updated whenever the physical switch is toggled).

Step 1: Demo

Step 2: Overview

My smart power strip is composed of two parts: gateway and power strip (shown in the picture "My design").

The gateway side includes:

  1. A Beaglebone Black board
  2. A nRF24L01+ module
  3. OpenHAB + MQTT (message bus)

The power strip side includes:

  1. Three standard switch+outlet combos (w/ a 3-gang box)
  2. An Arduino pro mini board
  3. A nRF24L01+ module
  4. Three relay modules

The details will be covered in following steps.

Step 3: Gateway - Hardware


A Beaglebone Black board

A nRF24L01+ module

A 10uF capacitor (RadioShack, ebay etc.), for improving the reception reliability.

Here I show the connection between the Beaglebone Black and the radio module. I also show my circuit for it, but a breadboard will do the job as well.

To use the SPI and nRF24 module in Bealebone Black, two steps are needed.

  1. Enable SPI on Beaglebone Black

Step 4: Gateway - Software

In terms of software on the Beaglebone Black, the overall structure is shown in picture 1.

Since there is a Debian running on it, it is very easy to install software using apt-get command.

OpenHAB is Java based, so it is necessary to install Java VM. Please refer to OpenHAB installation for details (it is for Raspberry Pi, but apt-get works for both boards). To enable MQTT for OpenHAB, the file "org.openhab.binding.mqtt-x.y.z.jar" needs to be put into the "addons" folder in the OpenHAB source folder. Three configuration files are needed (attached below), where "openhab.cfg", "test.sitemap" and "test.items" should be put into the "configurations", "configurations/sitemaps" and "configurations/items" folder, respectively. Then, the OpenHAB can be launched by typing "./".

For the MQTT bus, I use Mosquitto which is an open source MQTT broker. The Mosquito version on apt-get is pretty old, so I download the source code to compile and install.

  1. Get the source code from the official site above.
  2. In the source code folder, create a new folder called "build".
  3. Go into "build", type "cmake .."
  4. Then go back to the upper folder, type "make" and "make install"

Lastly, the gateway program is the bridge between MQTT bus and nRF24 module, and the architecture is shown in picture 2. There are two queues, each for one direction (i.e. one for the control CMD from OpenHAB to the power strip, one for the reverse direction). Basically it is a simple producer/consumer logic implementation. The source code of gateway can be found here, it uses some C++11 features (to install newer GCC on Beaglebone Black, refer to this article) and assumes the nRF24 lib is installed (refer to the previous Step).

Step 5: Power Strip - Hardware


An Arduino pro mini board.

A nRF24L01+ module.

A 10uF capacitor (RadioShack, ebay etc.), for improving the reception reliability.

Three 10K resistors (RadioShack, ebay etc.), for switch.

Three Relay modules.

Three standard switch/outlet combo and a box, I bought them from Lowe's.

A 110vac to 5vdc module, to power the Arduino and relays.

A 5vdc to 3vdc step-down, to power the nRF24.

The connection is shown in picture 1.

!!!!! If you want to use same switch/outlet combo as me, please make sure you cut the "breakoff" on it (see picture 2) !!!!! This is extremely important or you may destroy your entire circuit !!!!!.

Picture 3 shows the finished power strip, as you can see, it is pretty mess in the box (since I cannot find any big enough off the shelf power strip with individual switch to use), but it works ^_^!

Step 6: Power Strip - Software

I use the same nRF24 library for Arduino as for Beaglebone Black (here, librf24-bbb folder is for Beaglebone Black, while the one in the root folder is for Arduino), but you can also use a more robust/powerful version for Arduion in here.

My source code for power strip side is attached here, please use Arduino IDE (or any other alternatives) and a correct programmer to install it on the Arduino pro mini.

Step 7: Conclusion


Be the First to Share


    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge
    • Make It Bridge

      Make It Bridge
    • For the Home Contest

      For the Home Contest



    7 years ago

    Hi! thanks a lot for your post.

    I have a question for you.

    If you when remove a second source(5v arduino + 110v for relay) can i split 1 110v cable? 1 for switch and 1 for arduino + power supplies (110vac to 5vdc)?

    thx a lot!


    Reply 7 years ago

    Yes you can.
    That's actually what I did. I have a 110v to 5v module to power the Arduino and a 5v to 3.3v step down to power the nrf24.
    Good luck!


    Reply 7 years ago

    I have updated my post, please check Step 5 for the two modules I use.


    Reply 7 years ago

    tank you very much for your help!


    Reply 7 years ago

    Yes, I used a fuse which is from an off-the-shelf power strip.


    7 years ago

    Can you give an example of how you're using the smart power strip, and what's smart about it? The demo seems to show a Pixar lamp and a fire extinguisher, and I don't see a problem/solution type of explanation.


    Reply 7 years ago

    Thanks for the comments.

    Currently, there is no accurate definition for "smart things". But generally, a fundamental feature is that it is controllable through web interfaces (like browsers, smartphone apps etc.). Of course, it can be smarter by adding more features, for example, a smarter power strip can also measure the power consumption which can be displayed on the web interface. For now, my smart power strip only has the fundamental feature, but I will add more in the future.

    In the demo, I show that the power strip can be controlled through either the web browser (on the monitor) or the physical switch.