NOTE: This hack involves working with dangerous voltage levels, which can result in property damage, injury, or death! Proceed at your own risk. If you are not comfortable working with power circuits and wiring, you may want to consider using something like the PowerSwitch Tail II from Adafruit instead.
As part of a larger project I'm working on, I needed a way to control five AC powered devices from a small microcontroller. At work, we use Opto 22 G4 Solid State Relays in our industrial control systems. They are small and convenient to work with, but I was looking for something more compact. Searching around the web, I noticed that many hobbyist were working with Sharp S108T02 Solid State Relays, but doing a little research at Digikey I decided to use the similar Sharp S201S06V instead.
|S201S06V Solid State Relay Diagram|
Next, I needed to find a way to provide outlets to plug the controlled devices into. I thought about using a project box and mounting three standard dual outlet wall sockets on it, then using a standard outlet cover on those. That would work, but it would still be on the large side. I then considered using a standard six outlet power strip. I headed down to my local Home Depot to see what options I had there, and returned with a nice, metal cased power strip. I removed the four screws holding the bottom on and checked to see if my relays would fit:
|Ready for surgery|
It looked like everything would fit! As a bonus, mounting the relays flat against the bottom would allow the metal to act like a heat sink. I measured to get them evenly spaced, drilled the mounting holes, and attached the relays using a bit of thermal compound for good heat transfer. (I thought I would be able to attach the wires after the relays were mounted, but it turned out to be easier to do with them unmounted, so next time I would wait on the thermal compound).
|Power and control bus wiring|
I started by soldering the common buses for the AC power and DC control lines, covering all the exposed wiring with heat shrink as I went. Once I had the common wiring done, I added the individual AC output wiring using different colors for each – I picked colors that matched the low-voltage cable's colors. For the low-voltage cable I just used the cable from an old PS/2 mouse that had a 6 pin DIN connector, which gave me 5 lines for control signals and 1 for ground. The mouse cable works nicely here because it is long and flexible. Before you start wiring the DC cable, drill a hole in the upper part of the case near the power cable, big enough for an appropriate strain-relief. Then run the cable through that hole, before you begin soldering it! I also made sure to write down the sequence of wire colors on the DC cable that corresponded to the pin numbers on the DIN connector, so that I could attach the AC control wire colors in the same sequence.
|Added power control wiring|
After getting all the AC and DC wiring attached to the solid state relays, I mounted everything to the bottom plate of the power strip, and routed the wires, with the inputs coming from the side where the power cable comes in, and the outputs at the opposite end. As you can see, I also added some cable tie points to make sure the wires did not get pulled out or shorted.
|Solid state relays wired and mounted|
Next, I removed the black “hot” bus from all but the outlet closest to the power cord, and broke the jumpers on the hot side between the top and bottom outlet of each outlet pair that connected them together. I am leaving the outlet closest to the power cord always hot, so I have some place to plug in the project's controller. I can still turn the entire thing on and off using the existing power switch. Now that that the remaining five outlet's hot sides are disconnected, it's time to start wiring them up.
Since these outlets use “slide in” connections intended for lower gauge solid core wire, and I am using smaller gauge stranded wire, I soldered the ends of the stranded wire to form a stiff end that would easily slide into the outlet connections. You can sort of see the soldered end of the red wire in the next photo.
|Connecting the power wiring|
Now I attach each of the AC control wires to the corresponding outlet, making sure to keep them in the same order as the relay (and DIN connector) wiring. I cut each wire to the proper length, so that I wouldn't have a lot of extra wire to try and tuck inside. Here it is all wired up:
|Ready to close|
And now all assembled and ready to go with its new “tail”:
|Ready for work|
Now I should note that the solid state relay inputs are simply LEDs, and require a current limiting resistor in series or you will destroy the devices. In this design, those resistors are located on the controller board, but you could easily include them inside the power strip by soldering them inline with the DC control wires. If you are going to use this with multiple projects, I would suggest including the resistors in the power strip to help protect the relays from damage.
This hack worked out very nicely, and it's been working for several months without any issues. Once again, since this project involves dangerous voltages, you should exercise extreme caution when building and using this hack. I am not responsible if you decide to duplicate this project and you electrocute yourself, set your house on fire, or encounter some other mishap. You have been warned.
Several of the commenters over at Hack a Day noted that I didn't mention the solid state relays I'm using are only rated for 3 amps (and you would likely need a heat sink for that). Although that is fine for my project, you probably shouldn't try to control your air conditioner using these devices! You could do a similar hack using a larger power strip with more internal room and beefier solid state relays, and along the way provide either fusing or circuit breaker protection for the individual outlets.