Power Strip Controller

Every now and then I tend to come up with a perfect solution to a problem which doesn’t exist. This process can even be amplified when I appear to have found hardware which is perfect for such a solution. That’s when the idea of a remote controlled power strip was born.

Occasionally it would be interesting to control the power to some mains devices remotely, or at least automate the switching of the power to those devices. And when you do want to do that you don’t have the means to do it. With this project I at least have the means to switch the power to 6 devices remotely or automatically.
By the way, the idea to this project was born way before the Sonoffs became available. That’s how old it really is.

A Perfect Fit

The idea arose when I saw these Bachmann power strips. The power sockets are placed a few centimeters apart from each other, which should allow the placement of a relay between each socket enabling me to switch each socket individually.

Bachmann power strip

After opening the power strip I could start the first fittings. It is as if the power strip was put together with the intent of making it clever. It appears that the very common relays you can buy from China these days have a perfect fit between the sockets. As if the cavities are meant to hold the relays. The relays rest on the earth bar below them and thereby they sit flush with the sockets next to it. All I need to do is cut the live bar up, and then bend one pin of the relay over to the part of the live bar to make a connection. One piece of electrical installation wire connects the common connection of all the relay to a new live busbar to complete the circuit. The last relay can be glued to the side of the sixth socket.

The relays fit perfectly

And look at the space at the side of the power strip. That can exactly hold a Raspberry Pi Zero W. As if it was made for it.

Made for the Raspberry Pi Zero W

Finally the cavity where the screw terminal block used to be is big enough for the internals of a phone charger adapter. I had some lying around with a US plug, which are useless for me otherwise. I don’t like anything going to waste you know.

Power Supply

Anyway, the idea to put this all together kept running around in my head. The only way to get it out of there was to finally build it. And behold, this has become the project described on this page.

The Circuit Diagram

There’s not much to it. Six GPIO lines coming from the Raspberry Pi Zero W are used to drive 6 MOSFETs, which in turn drive 6 LEDs and 6 other MOSFETs. The LEDs show the status of each individual output socket. A pull-up resistor ensures that the LED will be on and the relay will be in its NC state when the software on the Raspberry Pi W is not running. That way all outputs are on and the power strip can be used as a “normal” power strip.
The second set of 6 MOSFETs drive the 6 individual relays.

Circuit diagram Click the picture to download the diagram as a PDF

One extra bicolour LED is used so I can show the status of the device. Red means that it is not connected to the internet. Green means that both Telegram and MQTT were registered successfully. And orange means that only Telegram or MQTT was registered successfully.
But you can change the colour of the LED using Telegram or MQTT commands too, if you like.

And that’s it. Nothing to it.

Oh, and by the way, if you’re going to tinker around with mains voltages, I assume you know what you’re doing. Are you? Surely I don’t have to tell you that it is dangerous.

Next stop is the software.