DIY Microcontroller-switched Power Strip

switched-power-strip

[Teknynja] was looking for a way to control several discrete AC-powered devices using a microcontroller, and while he did consider the Powerswitch tail 2 from Adafruit, handling 5 devices would get pretty expensive. Rather than buying a complete off the shelf solution, he decided to build his own 5-way switched outlet.

He picked up a sturdy metal power strip from a local hardware store along with some Sharp S201S06V relays he ordered online. After test fitting his relays inside the power strip’s chassis, he wired up 5 of the 6 outlets through them to allow for switching via a microcontroller. He configured the 6th outlet to be live at all times, providing a power source for the control system he planned on using to switch the other receptacles.

[Teknynja] pulled the connector from an old PS/2 mouse for use as a control wire, connecting one wire to each of the relays. He says that the strip is working quite well, and after a few months of use it is holding up nicely.

22 thoughts on “DIY Microcontroller-switched Power Strip

  1. I’ve been looking to do something similar. It looks like the S201S06V relay can only handle a 3A load. So, this obviously doesn’t work as a general purpose switched outlet :( Any good suggestions for a replacement that could handle the full 15-20A the wall provides and will still fit in the power strip?

    1. There are all sorts of thin or short 5vDC switched 120VAC relays. My office uses this one http://www.digikey.com/product-detail/en/G6D-1A-ASI%20DC5/Z2243-ND/765536 for some control switching. We use the 120ac from those to drive a 480V contactor coil to flick on motors. It is only rated to 5A but you can find all sorts of relays on Digikey.

      Just type in “5v Relay” and start filtering down from there. You might need a relay driver (which could be as easy as a NPN BJT & diode) or a full on driver chip with flyback diodes built in (recommended). Depends on how much space you have.

    2. I had good luck doing this with some optoisolated relays out of china. It makes for a simple, clean switch.

      The downside is that I can only work with resistive loads. I’m not sure if you’re supposed to use a contactor for inductive devices, but I’d love to hear from someone that’s dealt with this.

      1. depends on the device – if it’s gonna pump out a bunch of magnetic field or voltage as it slows down /turns off, a contactor is a good idea.

        Contactors just make a bigger gap and allows for material that will survive lots of arcing.

        If it’s just a coil, solid state or relay is fine as long as you make provision for the voltage spike caused by the collapse of the magnetic field to go somewhere.

  2. Really should take the time to use the screw terminals on plugs. The stab-lock connectors are known to allow slippage due to vibration.

    Also I’m seeing lots of little bits of wire with no insulation, that’s a great way for a random bit of something to energize the metal case.

    1. stab-lock you mean backstabbers as I’ve heard more than one electrician refer to them as, but yeah do everyone a favor and don’t use them. As for the little bits of exposed wire he has the hot side bundled up tight, everything you see exposed is already tied to the enclosure, ground and neutral should be bonded at the panel.

      backstabbers aside my only other concern is the wire gauge on the hot side bus. Maybe feed the ps/2 tail + heat shrink strain relief through before soldering so you don’t end up with that giant hole in the side, very well executed build otherwise.

      1. quote@’As for the little bits of exposed wire he has the hot side bundled up’

        Aye, though I tend to try not to let that influence my insulating practices. People do weird things and if polarity gets reversed your previously safe neutral-side is now an unsafe hot-side.

  3. I found out that you can buy an 8-channel relay board for $12 (hint: sku121337)
    thats ordinary relay with small preamp circuit for each, and some indicator lights, screw terminals etc.
    how can it possibly be that cheap?
    how can you possibly resist automating every socket you own?

  4. This is excellent work. There is a large powestrip slash box enclosure commonly available from Stanley (I think that’s the brand) that has a heavy case, a long cord and a lot of internal space. Its an excellent base to build a multi-outlet load sensor on, and I suspect you could use these SS relays in that case as well.

    I have a number of large 24 outlet power strips that do power control and limited load measurement, but they were fairly expensive and sometimes blow up if a phase drops, so I suspect that using solid state relays will work well.

    A word of caution – SS relays heat up.

  5. I’m keeping an eye on this, and the comments here.

    I have a couple of ancient APC rack-mount PDUs that no longer power up at all. I’ve been wanting to rip them apart and replace their internal boards with something else (possibly Arduino-based, or maybe Raspberry Pi-based if I can get my hands on one, so I can build a nice web interface for each of them.)

    Going to bookmark that relay technodream mentioned, as that looks perfect, but I really should finish up some of my other projects before starting anything new.

  6. nice execution.

    personally i would have mounted the resistors inside the case tho… in case it gets plugged into a PS/2 mouse port… or a…

    or a detachable cord with the resistors inline(inside). that way a different cord is for different applications (voltages).
    that way the cord is male-male(two mice-tails end2end) and the unit would cant be plugged into a computer PS/2 port

    PS: personally i’d have thrown lights at it too.

  7. Thanks for all the feedback guys!
    As for the current being drawn through each SSR, I knew that I was gonna be pulling less than 1 amp per socket, so for this project it wasn’t a problem. I just needed a quick (and compact) way to control the AC power.
    The only reason I used the stab locks on the outlets is because that’s all that was on there! I too would have preferred to use screw connections (I do on all my home wiring) if they were there, but I didn’t want to spend more time and money replacing the outlets in the strip. There probably isn’t a good shot of it, but the mouse cable **does** have a plastic strain-relief on it, as I definitely didn’t want it getting yanked on or dragging against the metal edge of the hole.
    As to the resistors, I too think I probably should have included them inside in retrospect, but I also have another set of LEDs on the controller board in series with the SSR inputs, so the resistors would have been too small for normal use anyway. Next time, I’d put the resisters in the strip and drive the on-board LEDs in parallel.
    Hopefully this hack sparks (no pun intended) some ideas for other people, and they take the time to look over these comments for improvements on the design.

    Teknynja

  8. This is a really nice project but I wonder if it is safe? Looking at the photos I can not see any insulation between the metal tab of the S201S06V and the metal back of the power board. Looking at the data sheet for S201S06V it clearly states that the metal back is connected to pin 1. Any ideas?

    1. confuses me too!
      maybe the paint on the power-strip’s casing is providing insulation??? i bet that wont last long.

      try mica insulators/spacers.
      tiny ones are on heatsinks,
      you can find gigantic ones on the RF-window of microwave-ovens, i believe.

    2. I didn’t notice in the data sheet the part about the metal back, but the actual parts have epoxy on the back, with no exposed conductive areas. There **are** some small metal contacts on the top side of the case but they would not come into contact with the screw at the front or the back mounting surface. If there was any exposed metal, I would have definitely had to re-think the mounting.

      Perhaps those notes on the datasheet are just standard “boiler-plate” for their SSRs? I’ve ordered more of the S201S06Vs and they also have epoxy backs, but just in case anyone trying this should double check just to be sure.

  9. Pretty slick. I’ve been looking to do something like this forever, in an attempt to build a home automation system. What relay would be the right thing to use with a higher load? Would more robust heatsinks be needed?

    I am absolutely terrible with soldering and electronics, being more of a programmer so I like the apparent simplicity of this build!

    My plan was to use cat5e for the low voltage control wiring. Should work, right?

  10. If pin 1 is the heatsink tab and you are bringing the hot line into pin 2, the metal case will be alive when you switch on any line. Which should short to ground on the case. If not then you have a bad ground wire. Also if one SSR triggers all the outlets will go on. Because, the AC will leak through the live case to pin 1 on the other SSRs and out the outlets. This is the exact reason I could not share a heatsink when I built 320 SSRs for my Christmas display.

    1. It seems the actual devices have epoxy backs and mounting holes. I think the data sheet might refer to using a clip-on heat sink designed for that case, which would come in contact with some small metal tabs on the sides. I’ve used large TO-220 heat sinks with these as well and had no problems with high voltage leaking to them.

      You are right, I did not provide any earthing for the back other than relying on the screws – hopefully this hack doesn’t spend much time in the “open” state!

  11. Perhaps im wrong, but its just dawned on me you cannot get a metal cased power strip in the UK, only plastic, i presume something to do with the double insulation standards. irrelevent to the project i guess but just realised, as i would like to build similar!

    Also i cannot see an earth lead earthing the rear of the case where those SSR’s are mounted, fair enough(ish) relying on the mounting screws when the case is closed but what about when the case is open during fault finding, could get nasty! very well thought out wire managment though

Leave a Reply to Oliver HeavisideCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.