Please do not screw around the powerstrip while it is connected to the AC!

This instructable assumes you know what you're doing on the AC!

Also, make sure to use undamaged cables that are not too long, nor too short.

This powerstrip is part of the home-automation project described here:
[instructable link will be displayed as soon as the project is finished]

The basic idea of this project is to have a power strip with individually controlled sockets that can be programmed.

Material used

  • 1x AC powerstrip; a wide body is needed otherwise the relays won't fit!, unknown $$
  • 1x Arduino Mini Pro 3.3V, 1.75$
  • 1x RFM69H (3.3V), 4.50$
  • 1x step-down 5V->3.3V (to run Arduino and the RFM transmitter), 0.35$
  • as many AC relays that will fit into the power strip (6 in my case), 1.75$ each
  • 1x 5V power supply (to run the step-down and the relays)
  • 1x 3 pin wiring connector, negligible $
  • 1x 5 pin wiring connector, negligible $
  • optional LED (I used a RGB. several uni-colors should provide a better overview) + resistors, negligible $
  • cables to connect everything; either connect with Duponts or solder... (AWG 26 for Arduino, AWG 16 for AC connections in my case), approx. 5$

Unfortunately I cannot create a correct wiring diagram, nor do I know the correct electronic symbols, so all you get is a powerpoint... sorry.

(Good?) quality power strips can be opened and closed rather easily without breaking anything. The power strip used has 8 sockets in which 6 AC relays fit; more space was not left due to the 5V supply and the Arduino. A small hole was drilled to fit the LED. The sockets in the power strip are connected in parallel. Simply reconnect the AC wires to the relays in the way they need to. Make sure to fix them well so they won't come off and cause a short-circuit. Place the 5V supply where space is left. I actually glued everything to the body, also the Arduino cables are glued here and there with a point to the body of the wide-frame power strip. Nothing should be able to move around.

Step 1: ​Arduino Codes and OpenHAB Integration


Only the WDT (WatchDogTimer) and the RFM libraries are included. The WDT is used in case the Arduino hangs somewhere and with the WDT it would reset by itself. However with this setup, the Arduino never lost itself until now.

The code is attached and should be quite straight-forward. It is assumed that you know that stuff at least to half-way read it. The Arduino code might look familiar as it has been copied from different sources, modified and put together.

Don't get too picky on the NodeID; keep it 2 digits since you probably won't have more than 90 nodes in your house. Don't change the number of digits, or you will need to change it practically everywhere later.
Define the frequency band as given by the module you bought.
The ChannelFreq might need to be adjusted to the standards where you live; the number is in Hertz.

// RFM69
#define NODEID 21 //unique for each node on same network Floor&Room&Node#=X&XX&X
#define NETWORKID 666 //the same on all nodes that talk to each other #define GATEWAYID 1
#define FREQUENCY RF69_433MHZ
#define ENCRYPTKEY "1234567890ABCDEF" //exactly the same 16 characters/bytes on all nodes!
#define ChannelFreq 434520000

The message structure has to be the same on your whole network

typedef struct {        // Radio packet format
int nodeID; // node identifier
int devID; // device identifier
int cmd; // read or write long intVal; // integer payload
float fltVal; // floating payload
char payLoad[32]; // string payload
} Message;

There are quite some variables to keep track of the status and the previous status of the relays.


Nothing special to highlight. All pin modes need to be set to "out".


First the Arduino checks if it received a command from the OH server. The command is parsed outside the loop-code.
Then the status of each relay is compared to the previous status and if there is a difference, the new status is sent back to the OH server.
Only after that the real status are read and saved as variables.
Depending on the interval, the status are sent back to the OH server.
The last IF in the loop simply sends back the signal strength from the RFM gateway to the node and vice-versa. This order seemed to be a good logic because sometimes the relays don't switch correctly, so the correct status is sent back and it can be switched again from the tablet/phone (over the OH server).

BTW: the relays are only switched upon a signal from the OH server (phone/tablet/rules). There is no possibility to have buttons.
So the whole thing can be switched on with rules (Presence rules, light sensor rules, time-of-day, etc.) and it's perfect if you have indoor Christmas light, electric Christmas candles, or just any other stuff you don't want to run 24h/day and where you're too proud to buy several time-switches.

Step 2: ​openHAB


In fact quite straightforward and nothing special here. Simply make sure that for the relay switches you have 3 parts of mqtt commands. 2 for sending ON and OFF commands and 1 to receive the status only.

The switch "GetNode_SwitchPlug21_RSSI2" is used to send the GetRSSI to the power strip in order to get the signal strengths back.
The reset switch is to reset all values to read them from scratch if you're not sure the Arduino sends back what it should.


Very simple setup for the sitemap. Only the reset button is nice to have one choice only, as you can hardly un-reset it.


Except for the basic stuff, no rules have been created yet as we still did not set up the Christmas deco. It might then use it as a kill switch for the TV, receiver, satellite receiver, cable box, etc.
Needless to say that every relay can be rules differently and unrelated to any other relays in that power strip.

All in all this is a less expensive alternative to a real IP controlled power strip. Where I live such a 6 or 8 socket IP controlled brick costs around 300$

About This Instructable




More by stusen:Intertechno LAN Gateway ITGW-433 and OpenHAB Arduino controlled RGB LED strip for the living room AC powerstrip with Arduino controlled AC/DC relays and openHAB 
Add instructable to: