In this instructable I show how ordinary off-the-shelf power strips can be modified in such a way that individual sockets on them can be turned on or off remotely using a smartphone app.
This is my fourth IoT/Home Automation related instructable. The first three are:
An inexpensive IoT Enabler using ESP8266
IoT Wall Outlet with Arduino and ESP8266
IoT Mood Lighting
Step 1: Story
I have used Network Power Switches at my work place to remotely power on/off/cycle hosts and other equipment. These are quite pricey equipment that generally have a web based or a command line interface to manage the remote equipment.
In my house, I have two power strips to which multiple devices are connected. Thought it would be cool if I have something like the Network Power Switch in my house for the following reasons:
1. Have two Raspberry Pis that sometimes hang and have to power cycle them. Doing it the old fashioned way is quite tedious.
2. There are a few devices such as the TV, cable set top box, sound bar, etc... that goes on standby mode when not actively used. Although they are in standby mode, they still draw some power. Needed a way to switch them off when not used to save power.
3. There are other devices that don't have a standby mode and need to be powered on to be used and powered off later.
Step 2: Parts
ATMEGA1284P-PU microcontroller chip
ESP8266 ESP-01 module
ILI9341 TFT Touch SPI LCD screen
74HC595 Shift Register - 3 nos
8 channel relay module - 2 nos
4 channel relay module or two 2 channel relay modules
WS2812B LED strip
8 MHz crystal oscillator
Breakaway male and female headers
Female dc jacks
220v AC to 5v DC 2 Amps power supply module
LM1117 3.3v LDO voltage regulator
Off the shelf power strips
220v to 5v 40 Amps power supply
Step 3: Circuit
The circuit is not complicated. The ATMEGA1284P (with Arduino bootloader) is used to send data to the three 595 shift registers connected in series. The outputs of the shift registers are connected to the relays. Depending on the data sent to the shift registers, the individual relays can be turned on or off. The relays are used to turn the sockets in the power strips on or off.
An ESP8266 module is connected to the Arduino through the serial port. The ESP8266 module receives commands through WiFi and sends them to the Arduino. A touch screen LCD is also available that displays the states of the individual sockets and through which sockets can also be controlled.
The Kicad files of the circuit can be found in the power_strip_kicad folder at
Step 4: Preparing the Power Strips
Modifying the power strips is pretty straight forward. As can be seen both the power strips have switches for each socket.
Generally the Line wire will be connected to one end of the switches and the other end of each switch will be connected to the Line hole of each socket. This connection between the Line wire and the switches needs to be removed. Wires should be soldered to each of the switches. Also a wire needs to be soldered to the Line wire coming from the mains.
The idea is the Line wire will be connected to the middle terminal (COM) of the relay. The COM terminals of all the relays will also be connected to each other. And wires from each of the switches will be connected to the NO (Normally Open) terminal of each relay. Hence, when the relay is turned off, the circuit will be open and the socket will be "Off". When the relay is turned on, the circuit will be closed and the socket will be "On".
Step 5: Code
The Arduino sketch for the ATMEGA1284 chip and the source code for the firmware of the ESP8266 module can be found at: https://github.com/tangophi/IoT-Power-Strip
The firmware of the ESP8266 modules is based on the ESP8266 open sdk. Instead of the SDK, Arduino IDE can also be used.
The general idea is the ESP8266 module subscribes to the followingMQTT topics:
The NetIO smartphone app sends socket messages to the node-red instance on the raspberry pi. Which in turn sends appropriate messages to the MQTT topics. When the ESP8266 receives these messages, it sends JSON strings to the Arduino through the serial UART port. And when the Arduino receives these strings, it will send appropriate data to the shift registers to turn on/off the relays. When a reset command is received, it will turn off the relay and turn it back on after 5 seconds. The Arduino will also update the LCD display with the states of the sockets.
When the LCD screen is used to control the sockets, the Arduino will send the changed state of the socket to the ESP8266 module. The wifi module will inturn send this info to the MQTT broker and the node-red instance will be updated. And the NetIO app will periodically query the node-red instance for the latest states of the sockets and will update the app accordingly. The Arduino will also periodically send the states of all the sockets.
Step 6: 5V 40A Power Supply
I use two Raspberry Pis, a powered USB hub, an Ambilight project and some other 5v projects. Powering each of them required individual 220v to 5v power supply adapters. To get rid of these adapters, I bought a 40Amps 5V power supply. And connected this to 8 female DC power jacks in a plastic enclosure. Each of these DC jacks is controlled by a relay.
Step 7: Assembly/Installation
As can be seen in the pictures, I used four plastic enclosures to install the circuit board as well the relay modules.
* Used a cardboard cutter to make a hole in the lid of one enclosure to fit the LCD display.
* Used a drill to make 8 holes in another enclosure to fit the female DC jacks.
Then it was a matter of connecting the Line wire from each power strip to the COM terminals of the relays and wires from each switch to the NO terminal of each realy.
For the first relay module, connected the positive terminal of the 5v 40A power supply to the COM terminals of the relay. Then connected the NO terminal of each relay to the positive terminal of the DC jacks. Also used some capacitors between the + and - of each jack just to suppress/bypass any noise.
Step 8: Smartphone App
The smartphone app is built using the NetIO Design Editor at
Once the app is designed, the NetIO app should be downloaded to your smartphone. Note that this is a paid app, but it does not cost much. Whenever a button/switch/slider is pressed in the app, it will send a message through sockets to the Rpi box that is running node-red. The node-red application will process the messages and then send MQTT messages to the IoT power strip board.
For the smartphone app to work it should be in the same network as the IoT power strip board. It is possible to use the smartphone app from outside the local network. If the ISP allows incoming connections, it is just a simple matter of forwarding the socket port on the router. If the ISP does not allow incoming connections, then VPN can be used as a workaround.
Step 9: Features
With the smartphone app, it is possible to turn on/off/reset any of the sockets. With the touchscreen LCD, it is possible to turn on/off any socket. In addition, the state of each of the sockets is periodically updated on both the screen as well as the LCD screen.
Step 10: More Details
For more details about how the various pieces fit together, please visit my second instructable at
That instructable is about another home automation project and has detailed descriptions about how another IoT board in my house is controlled by node-red and the smartphone app. The IoT power strip project also uses the same node-red and MQTT instances.
Step 11: Suggestions for Other Makers
The reason I used a ATMEGA1284 chip is because I wanted to have a touchscreen LCD display. It was quite possible to do it with an Arduino Pro Mini too, but the memory was not sufficient for my needs. Hence used the ATMEGA1284 chip.
If you don't need the LCD display, you can just use an Arduino and an ESP8266 module or just an ESP8266 ESP12 module itself.
Step 12: Conclusion
If you find this instructable useful in implementing any of your projects, it would be great if you could post some details as well as photos of them as comments.
If you have any questions/doubts, please kindly post them as a comments instead of sending a mail to my inbox. If its posted as a comment, it will be useful to all and I can reply as a comment as well.
Suggestions to improve this project as well as ideas for new features/functionalities are always welcome. Cheers!