loading

!!!!! 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

Materials:

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
  2. GET NRF24L01+ RADIOS WORKING 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 "./start.sh".

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

Materials:

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

Enjoy!!!

<p>Hi! thanks a lot for your post.</p><p>I have a question for you.</p><p>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)?<br><br>thx a lot! </p>
Yes you can.<br>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.<br>Good luck!
<p>sorry for double post</p><p>but i change my 5v to 3.3v for this its ok?.</p><p><a href="http://www.ebay.com/itm/5-PCS-DC-5V-to-3-3V-Step-Down-Power-Supply-Module-AMS1117-3-3-LDO-800MA-/271967988583?hash=item3f528e2b67:g:xJgAAOSwDN1UPkFS" rel="nofollow">http://www.ebay.com/itm/5-PCS-DC-5V-to-3-3V-Step-Down-Power-Supply-Module-AMS1117-3-3-LDO-800MA-/271967988583?hash=item3f528e2b67:g:xJgAAOSwDN1UPkFS</a></p>
<p>I have updated my post, please check Step 5 for the two modules I use.</p>
<p>tank you very much for your help! </p>
<p>thx for your answer! <br></p><p>2 questions for you!<br><br>1: do you use a fuse behind 110v for protect your project?</p><p>2: can you propose the module 110v to 5v and 5v to 3.3v on ebay ? </p><p>that 120v to 5v its ok?</p><p><a href="http://www.ebay.com/itm/1-AC-DC-Power-Supply-Buck-..." rel="nofollow">http://www.ebay.com/itm/1-AC-DC-Power-Supply-Buck-...</a></p><p>that 5v to 3.3v its ok?</p><p><a href="http://www.ebay.com/itm/DC-DC-5V-36V-to-3-3V-6V-12V-24V-5A-Buck-Step-Down-Converter-Module-Car-Voltage-/231741884260?hash=item35f4e48764:g:4fIAAOSw5VFWOdwr" rel="nofollow">http://www.ebay.com/itm/DC-DC-5V-36V-to-3-3V-6V-12V-24V-5A-Buck-Step-Down-Converter-Module-Car-Voltage-/231741884260?hash=item35f4e48764:g:4fIAAOSw5VFWOdwr</a><br></p><p><br><br>thx! </p>
<p>Yes, I used a fuse which is from an off-the-shelf power strip.</p>
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.
<p>Thanks for the comments.</p><p>Currently, there is no accurate definition for &quot;smart things&quot;. 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.</p><p>In the demo, I show that the power strip can be controlled through either the web browser (on the monitor) or the physical switch.</p>
<p>Great way to automate home appliances. </p>

About This Instructable

4,480views

108favorites

License:

More by charleyhuman:Smart Power Strip based on Beaglebone Black and OpenHAB 
Add instructable to: