Arduino controlled four socket outlet

Never get between a man and his salami. [Mike] needed a way to control temperature, humidity and airflow with his meat curing setup. Of course he could modify a refrigerator and humidifier to be controlled separately, but [Mike] decided the best course of action would be to control line voltage with an Arduino.

[Mike] started his build with a four socket wall housing he picked up at Home Depot for a few dollars. After wiring up each outlet so it can be controlled independently, he set out designing a four port relay board. This was a pretty simple build – four 10 Amp relays and a few terminal blocks. The PCB was designed in Eagle as a single-side board for ease of manufacturing.

The relay board is meant to fit inside the blue box along with the four sockets, so a few holes were drilled for the power and control wires. The entire assemblage was put together and tested out. [Mike] posted a video of his controllable outlet flashing a light bulb at 10 Hz. Check out that light switch rave after the break.

Comments

  1. Doc Oct says:

    He better be careful flashing a CFL like that. Those things don’t like to be switched a lot, dramatically reduces the lifespan of the bulb. Neat project otherwise.

    • MikeRags says:

      Yes, as stated in the article I would never use a mechanical relay for operating at 10Hz or even in the Hz range. I would definitely use a SSR. 10Hz was for the video, because anything less than that was a bit too boring.
      As for using a CFL, I agree, but after searching my house for ten minutes for a normal bulb, I gave up and went with the CFL for the video.

  2. nexekho says:

    CFL matrix in 3… 2… 1…

  3. robthebrew says:

    What about EMI and RFI?

  4. Miroslav says:

    Relays also don’t like to be switched at 10 Hz for for a long time … With 1 million rated contact makes/breaks, they will last 1 day at 10 Hz. Maybe.

  5. raidscsi says:

    Excellent detailed walkthrough. Not a fan of the design, but +1 to the author for building and posting.

    Was the PCB necessary? I would have just wired it directly using 14AWG wire and solder from outlet to relay so that you keep at least a 10A rating. Plus the traces on that PCB are seemingly really close.

    Also Opto isolation is something I would work in, but I am paranoid and I am sure this will work just fine.

  6. dave-o says:

    +1 for a really cool project.
    -100 for a dangerous board design.

    The board is missing critical creepage distances/clearance between the AC traces. Looks like about 25 mil there, really wants to be closer to 100. Heavy application of some liquid electrical tape would help make it more robust. That’s what I sued to do at work when we built prototypes with known inferior creepage spacings. It’s pretty reliable, so long as the board stays dry.

    Also, as previous have noted, optos and triacs are the way to go for these kinds of things. Safer and more durable for lightswitch raves for sure.

  7. JamieWho says:

    Epilepsy warning for the video there. Wow.

    Cool hack, the bit about splitting up the sockets by removing the shorting jumper between the two screw terminals was worth reading the article. I wondered how he did that.

    Unfortunately, he doesn’t care about the longevity of his appliances. As already mentioned, switching a CFL like that is not good for it. Also, turning a refrigerator on and off is the fastest way to kill the compressor on it. His choice though.

    • MikeRags says:

      The temperature of your fridge is regulated by turning the compressor on and off, just at a slow speed. For example, 8 minutes on, then 20 minutes off.
      If you interpret on and off as PWM control in the Hz range, then yes you are correct, this will burn our fridge out very quickly.

  8. kris says:

    quite a few extra neutral wires there. next time don’t brake the tabs of the neutral side of the outlet and it will save you some wire/space. very cool idea though.

  9. Tech Joker says:

    Cool project. However, whenever you are working with Mains voltage, things really must be done the correct way, so here are a few observations, to help out anyone else who may be looking at a similar project.

    1. Unless I simply can’t see it, only the upper outlet appears to be grounded. (No it is not proper to depend on the metal cover to ground the second outlet. A loose screw, or painted screw or box cover would isolate the second outlet from a ground.)

    2. There appears to be an extra Neutral Jumper between the outlets. One going to the screw terminals, the other going to the push in terminals, one is all that is required. As he states on the build log, he did not need to break off the neutral jumpers.

    3. You should NEVER use the push in terminals on outlets, they do not provide the best electro-mechanical connections. I believe they also state they are not to be used with stranded wire (tinned or not). This is especially true for high amperage circuits. It may be fine to use for a light bulb, but for a motor or other high current device, the connection is more prone to failure or excessive heat build up which can result in failure. I have never seen a licensed electrician use them, though I have seen several burned wires that were connected via the push in connectors due to overheating caused by poor electrical connections.

    4. The Mains and control circuits should be better isolated from each other to lessen the chance of a control wire carrying mains voltage in case of a short or other failure. If it were me I would have not used traces to carry the mains voltage, I would have run wires to each relay. keeping all the Mains on one side of the board, and the control voltage on the other, with a divider, and cover in place to protect the control wires and traces.

    There are many other things I would probably do differently, but these are all main points I would l0ok at to increase the safety of the project.

  10. Bill says:

    Almost every outlet that I have needed to replace failed because the push in “back wire” connection overheated.

  11. Frank Cohen says:

    Isn’t 15A the minimum outlets are rated for these days?

    • Tech Joker says:

      Standard Duplex outlet is rated to 15A, however that is the outlet. Wiring size, length, type, circuit breakers, and a host of other things need to be calculated to determine the safe current carrying ability. The push in connectors on the back are designed for 12 ga copper. (Though in my opinion they are still a bad idea for a number of reasons)

      In this case the relays are rated at 10 A @ 110 V. Using standard formulas you wouldn’t want to exceed 80% or 8 Amps per relay, or 15 Amps for all 4.

      I would fuse each outlet (at no more than 8 amps) AND the box (at no more than 12 amps), especially since it uses what appears to be a 14ga extension cord which is probably rated at around 12-15 Amps depending on length.

  12. dbear says:

    Good project but the computer controlled Christmas light guys have had a much better soulution for years. Check out
    http://computerchristmas.com and look for the
    “HowTo: 4-channel SSR to go with the controller in the “How To”” article. It describes a Quad Triac based SSR and tons of other ways to control small non-inductive AC loads.

  13. MoJo says:

    I made a computer controlled 4 socket outlet with an AVR a while back but never got around to putting it on my web site.

    The main distinguishing feature is that it communicates with the PC via fully optically isolated RS232. USB isn’t an option because it can’t easily be isolated and always available at the same time.

    I wanted to keep the computer completely separate for two reasons. Firstly I wanted to protect the PC from any wiring or physical damage issues that could cause a short and pump 230V into it. Secondly I wanted to power a backup USB HDD from one of the sockets and make that completely isolated from the mains and the PC when not in use. The idea is that if lightning strikes then unless I am incredibly unlucky and it is 3AM when the automated backup task runs there is no danger of the backup being fried. To that end the USB interface and all three mains lines were fully relay isolated.

  14. OverFlow636 says:

    Anyone know what would be the simplest way to measure the current draw from any of the outlets? I want to make a similar project, but would also want to be able to log the current of the devices connected to it.

    • MoJo says:

      You could hack an energy meter, that would be simplest. If you want to do something from scratch you can use a hall effect sensor to measure current. It basically converts it to a voltage you can sample with an ADC.

      Normally to calculate power consumption you need to know the voltage too, but since you know what it is (230V, 50Hz sine wave) there is no need to actually sample it. Instead you just need zero crossing detection so that you can sync up a timer with it, and Atmel do an app note where they connect the mains input directly to an AVR pin via a 1M resistor if you feel brave :-)

      In fact you could probably fake the zero crossing detection by looking at the sine wave that comes from the hall effect sensor. Alternatively opto-isolation might be an option.

  15. pants6000 says:

    Relay boards very similar to this one are like $8 $8 on ebay, including shipping… I am using one for an a/b switching thingie w/ IR remote for speaker comparisons. Yay for cheap Chinese stuff!

    • bubub says:

      It would be interesting to let someone who knows mains take a look at that one. I don’t really trust the chinese to follow safety regulations and standards set on the other side of the planet. Bought an USB to pata converter from china once. It came with a standard violating USB-cable and fried itself in a matter of hours, possibly because the power supplies of the appliance and computer weren’t isolated from each other.

  16. scott says:

    Among all the comments I’ll add to something partially addressed already – if the refrigeration unit doesn’t have a restart timer built in (delays compressor restart for a few minutes after shutting down) consider working this into the project/programming. Rapid restarts of compressors after they’ve shut down can cause pumps to burn out.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 94,586 other followers