Sunday, February 17, 2013

Home Automation - Raspberry Pi controlled Power Strip

Watch my previous post on a prototype project using Raspberry Pi. Now you would know what was that prototype for.

Yes, I now have built a power strip that is completely controllable by a Raspberry Pi over network. 

The idea of controlling a power strip over network is nothing new, but this is certainly a unique one and I needed this badly.  I have built a power strip with more features than the off-the-shelf ones and they were at least twice as expensive as what it took me to build this one. I can fix any problem in this device from software to a relay to a resistor -- in case any of these is blown. Oh yeah, the happiness of building something yourself is invaluable :)

To me, one of the driving factors for such a device is: We have Tata Sky+ HD at home and we record TV programs left and right. It has almost reached a point that we don't watch live content except news (for the time comfort and sake of skipping ads). Many interesting series do come in the night, for which, we leave the set-top-box (STB) on -- naturally for prolonged time (till morning) even if the recording is just for an hour or so in the midnight. Tata Sky+ HD STB consumes 20+W of power even on standby. I wanted to avoid this waste of power, by having the ability to turn on/off the power sockets using a rather low power device.

Raspberry Pi consumes just around 3.5W and has complete networking support. With abundant GPIO pins, I can use it to control at least 8 different sockets. This is one of the main reasons for me to choose a Raspberry Pi. While I had worked on AVR based micro controllers, but getting a AVR board on the network would have been much more difficult than this. Also the power of Linux, provides numerous software that were of great use to me while building this (python, apache2, flask etc.,)

Some of the key features:
  • Power Sockets are controllable via a web interface, so available from any device on the network.
  • Web service supports REST based interaction for easy integration with any app that I might write in the future (at least for the android phones).
  • Core web and daemon logic on python that avoids cross-compilation work for Rs Pi architecture. Rewrite code easily and just drop it for deployment. This was awesome! God bless interpretors!
  • Ability to control sockets from the Internet once I VPN into my home network. (this should let us do the recording even when we are on vacation; how cool is it that I can turn a socket in Bangalore on or off, from anywhere in the world)
  • Timer support, so I can schedule a On or Off event after a while. Say, I can turn on a socket at midnight 12am, run it for an hour and turn it off! There is a dedicated power daemon that runs in the background to take care of scheduling these requests when its time.
  • The power sockets are still controllable using their dedicated switches, so you don't have to hunt for a browser to turn on the sockets.
Here is the power strip in action:

I have also now installed the power strip for the real purpose I wanted for. See the demo where I turn OFF my Tata Sky+ HD Set Top Box using the mobile.

I have taken photos all the way while I built this power strip. Stay tuned for lot more technical details (electronic circuits, hardware, software) with photos, on what went behind this power strip.

Sneak peek:



  1. hi Gerald,

    Interesting piece of work, I'm looking for some guidance on automating light, fans and home appliances with the existing electrical switches and sockets, your work seems to be close to what I'm looking for, can you post a detailed DIY guide or send me an email

    Thanks in advance.



  2. Sunil, Sure, you will soon see a detailed guide on this.

  3. this is fantastic.. I eagerly await your play by play

  4. Follow up :

  5. This is awesome! You should patent it if you have'nt already :-)

  6. This is great news. awesome!
    Looking for an all in one solution to watch live HD TV? Look no further, AVOV announce that the aVoV VIXO1 android TV Box. You can enjoy live TV through internet on your television. XBMC TV Box