Yet Another Arduino 110v Power Controller

89K12836

Intro: Yet Another Arduino 110v Power Controller

This Instructable shows you how to build a four-gang outlet box in which each outlet is controlled via an Arduino (or any other TTL level signals).

It differs from the other relay boxes in that it uses no circuit boards and has very few parts (one chip and 4 relays).

STEP 1: Assemble Materials/Review Plan

Tools Needed:
Needle Nose Pliers
Wire Cutters and strippers
Screw driver
Soldering Iron
Multimeter

Materials:
Deep metal 4 gang output box and cover
Wire clamps
Two 15Amp outlets
Four 5v 10Amp relays (such as Jameco’s 843155)
A ULN2803A (such as Jameco’s 34315)
A 5volt – 500ma Wall Wart (such as Jameco’s 164101)
A length of 5-conductor wire (I used Cat5 cable)
Household current rated wire with a male three-prong connector at one end.
Miscellaneous wire and solder
5 minute epoxy
Wire Nut

Theory of Operation:
The electricity flow to each outlet of a four-outlet household current box is controlled via TTL level signals (such as the output pins of an Arduino).  Five wires are connected from the Arduino to the outlet box, four wires being connected to four Arduino output pins and the fifth to the Arduino’s ground pin.  A separate 5 volt wall-wart is used to power the outlet box (the outlet box relay activation coils will consume nearly 500 milliamps and a separate wall wart is used here so as not to stress the Arduino power supply).  The TTL control lines are wired to the inputs of the ULN2803A which can handle the relay coil current needs and also contains diodes to safely manage the back EMF produced by the relay coils when switched off.

NOTE: for simplicity the schematic only shows a single outlet connection.  Repeat the wires for the other three relays and other outlets, using ULN2803A Pins 3 & 16, 5 & 14, and 7 & 12.

STEP 2: Obligatory Warning

Warnings:
Household current can be dangerous to your equipment, both electrical and biological!  Having control and power wire in the same enclosure can expose the connected circuit to damaging voltages in the event of part failures.  I make no claims or warranties, etc, you assume all of the risk should you attempt this build.  Those attempting this build are either knowledgeable or foolish, or as in my case, a little bit of both.

STEP 3: Wiring the AC Portion of the Outlet Box

In US household wiring, the green wire is ground, the white wire is return, and the black wire carries the power.

I begin by breaking off the four metal tabs attached to the outlets.  These tabs are used to secure the outputs in a different enclosure and are not used for the metal enclosure.  The tabs have a little crease in them which helps the user remove them.  Remove the 4 tabs from each of the outputs by bending them with the needle nose pliers until they break off.

Next cut the connecting bar on the ‘gold’ colored contacts.  This bar allows the power to flow to both outlets whenever one outlet is connected and since our relays will power each separately we must cut this connecting bar or both outlets will receive power if either outlet is enabled.

Next add a small wire connecting the white terminals of the two outlets together.  In my case I used a four inch piece of 12 gauge solid copper wire.   I do this by striping and attaching the white wire to one of the outlets ‘silver’ terminals, then attaching the outlets to the metal faceplate such that the white wire is between the two outlets.  This holds the outlets in their final position so that I can bend the white wire to the other outlet terminal and still be able to screw the wire to the terminal.

Next add a small wire connecting the ground terminals of the two outlets together just like we did for the white wires above.


STEP 4: Relay Connections

I mix up a small amount of quick-set epoxy and I then epoxy the four relays to the backs of the AC outlets.

You may also epoxy the ULN2803A to a clear area on one of the relays.  Be careful to remember the part’s orientation so you know which pin is pin 1, etc.

Be sure to wait until the epoxy is fully cured before proceeding.  I waited 24 hours myself.

I then attached a black wire from the relay’s Normally Open (‘N/O’) output pin to the ‘gold’ outlet terminals.  I did this by first attaching the wire to the outlet terminal and bending the wire into position so that the wire touches the terminal with no strain on the wire or the relay pin, then I solder the wire to the relay pin.  I used solid 12 gauge wire to make these connections.  You can use 14 gauge wires also which should be less stiff and easier to work with.

Next attach an 8 inch piece of black wire to each of the relay’s common pin.  You can epoxy this wire to the outlet case as well to relieve the strain of the wire on the relay terminal pin.  Again, wait until the epoxy cures before proceeding.  (As you can see from my pictures, throwing caution to the wind I did not provide this strain relief.)

Next prepare the metal box by knocking out two of the punch out holes and installing the wire clamps.  Feed the 3 prong male plug through one of the clamps and attach the green ground wire to the ground wire on the outlets.  Now attach the white wire to the other accessible ‘silver’ terminal of the outlets.  Using a large wire nut attach the four back wires to the black wire of the 3 prong plus.  (Again I did not follow my own advice as I didn't use a wire nut, I soldered the wires together and used electrical tape to wrap up my soldierng mess.)

At this point you may use a generous amount of electrical tape to cover up any exposed wire which carries AC household current.  If you choose not to perform this step you can easily get ‘bitten’ by the electricity should the 3 prong plug get plugged in while the box is not closed up.  I did not do this here since I wanted to keep everything exposed for the project pictures.

STEP 5: Connecting the Logic Circuits

Feed the wall wart power cord and the 5 strand wire through the second wire clamp on the metal outlet box.  I used some spare Cat5 wire I had which contains 8 conductors and I cut the ones I didn’t need.

Solder the signal ground wire and the wall-wart ground wire to pin 9 of the ULN2803A. 
Solder the +5volts wall wart wire to pin10 of the ULN2803A.

Solder the four control signals to pins 1, 3, 5 and 7 of the ULN2803A.

Solder one side of the relay coils to ULN2803A pin 10 (5 volt DC power).  I did this by running a single wire from pin 10 to the relays in serial.

Solder the other side of each relay coil to pins 18, 16, 14, and 12..

Next connect the 5 conductor wires to the Arduino pins.  The ground wire must connect to the Arduino ground.  The four other pins connect to the digital output pins of the Arduino.  Leaving the three prong plug unplugged, you can plug in the wall wart into a household outlet and use the Arduino BLINK program to test the circuit and to match the control wires to the outlets.  You should be able to hear the relay click off and on when the output pin ‘blinks’.

STEP 6: Final Assembly

Assemble the box and tighten down all of the wire clamps, etc.

I like to use an ohm meter to ensure there is no connectivity between the signal wires and the AC lines.  With the 3 prong plug unplugged, connect an ohm meter to one of the three prongs and ensure it has no connectivity with any of the control and ground signals in both relay states (i.e. all relays deactivated and all relays activated).  Repeat for the other two prongs of the three prong connector.  Check also that there is no connectivity between the three prong connector wires.  If all checks out you should be ready for a live test.

Plug the three prong connector into house wiring and actuate the relays.  If you heard the familiar clicking of relays and no smoke was released and no sparks were generated then good deal.  Now you may plug four electronic devices into the outlets and test to ensure that each one can be individually controlled.

Demo video at: http://www.youtube.com/watch?v=jNFfdMJ17v4

STEP 7: Alternatives

If you use a wall wart as I did, you may consider using a 6 volt version.  There is a 1.4 voltage drop through the ULN2803A and this will therefore provide the relay coils with 3.6 volts, which is just over the relay’s requirements (3.5 volts needed to pull in the relay).  I was attempting to stick with the 5 volt source since it *could* be common with the Arduino 5 volt power supply.  The 5 volt power works, but 6 volts would pull the relays in rather soundly and might be a better solution.

I did not actually like the idea of a wall wart.  I would have preferred to use the Arduino power itself or to include a small 5v DC power supply inside the metal enclosure.  I was not certain that the Arduino power supply could spare almost 400 ma of current and I could not find a small enough transformer to fit in the metal case.  Maybe some of you will have better luck.

30 Comments

Lots of information on Arduino power control here:

http://arduino-info.wikispaces.com/ArduinoPower

Regards, Terry King

terry@yourduino.com

Very nice site, Terry, and well worth the read for those new to the subject as the site you linked provides a a detailed overview and excellent descriptions of the issues involving microcontroller control of high power electrical loads.  Also the commercial boards the site features seem to have good value for the price and are worthy of consideration in home projects.

Best Wishes
Mark.

How can i make it respond based on a ping response?? would be nice for remote network equipment that freezes up.

bitastico> you would need to add an arduino that either detects the locked-up condition itself or waits for you to ping it when you detected the lockup. The Arduino would then power down the device for a specified amount of time and then power it back up again. Note that since this is mostly-always powered - you may want to reverse the logic on the power pins so it takes activating the relay in order to remove power from the device instead of the way I've shown it here.

Best Wishes.

Thanks for this great article. You mention, "Solder the signal ground wire and the wall-wart ground wire to pin 9 of the ULN2803A". The wall wart only has 2 wires (red/black). Should I solder the black to pin 9? (I assume red is positive.) Thanks.

HAHAHA!!! Love the disclaimer!

I may steal that later.

For charging try mini usb ipod charger (example link http://www.ebay.co.uk/itm/New-Mini-USB-Wall-Adapter-Charger-For-iPod-iPhone-3G-3GS-4G-4S-T5-/400551010680?pt=UK_MobilePhones_MobilePhoneAccesories_MobilePhoneDataCables_JN&hash=item5d42b36178) I just bought 2 and was looking some instructable just like yours. The case is that I want to switch lights instead of a power socket.
I would suggest to anyone playing with circuits that switches house main voltage to install a ARC Fault breaker at the panel or somewhere before your custom monkey business! This Is Not the same as a Ground Fault which saves You from getting electrocuted. Most electrical fires are started by Arcing. A small arc over time will carbonized where the electrical bounding has been broken or poorly made. Once carbonized, heat increases and increased heat can lead to Fire. Arc Fault Circuit Interrupters Saves Lives from Fires! ..and property and insurance hassles :) so play it safe and Happy automating!
I was not aware of these.  Sounds like a very good idea!
I am new to all this. Would this be necessary for me to actively use this in my home?
I'm not sure whether you are referring to the switch or to the ARC Fault breaker. Although I show you how to do this instructable, many people would probably feel more comfortable with a store-bought version like the one at Maker Shed:
http://www.makershed.com/PowerSwitch_Tail_II_p/mkps01.htm
Thanks,

Mark
Hi mark, I am refering to the ARC fault breaker. My initial question was, would I need to use the ARC fault breaker if I am using this instructable in my home.

I appreciate the link, in the interest of saving money, If I am using the store bought version would I need this ARC fault breaker?
Very much appreciated.
I would think that the store-bought version would include the necessary safety features and therefore you would not need the ARC fault breaker, but understand I am not a home fire safety expert, etc. so be sure to do your own research!
Best Wishes
A nice alternative is to use a Wattstopper power unit which is UL approved, has zero voltage switching and as a bonus has DC output at about 150 mA to power your controller. One such unit (B-120 EP) is available from Amazon for about $15. - Enjoy.
I can not recommend the product you identified. While I always want to identify good alternative solutions, however, I am not convinced that the product you identified is actually a suitable alternative. The product does provide 24 VDC which can be used to power other devices as you suggest but it only supports one relay whereas my solution controls four outputs using TTL logic levels.
(I also notice that you have provided twelve comments, nearly identical to twelve instructables relating to power control all on the same day which makes me suspect that you have a particular interest in promoting the particular product you identified.)
Best Wishes...
I prefer driving a Triac output optocoupler into a Triac.
Especially for things you're going to be constantly switching like stage lighting controllers etc. You just need to be sure the triacs can handle the load you're putting on them.
When running a lighting controller, the clicking of relays would be annoying, plus you get into contact arcing issues as well as mechanical wear.
Of course there are cons with triacs too, such as inductive load limitations, but for my needs, they are the better choice.
You are absolutely right. I've had had some difficulty with using traics with CFLs :-(
The lighting controller I demonstrated was just an example and surely one would not use the circuit to flash a light as in the demonstration as the relay noise was intense (but also very satisfying ;^). For some applications an old-school relay is the simplest and best solution - but not always, as you pointed out.
But with a zero-crossig detection circuit, you could actually make your arduino DIM incandescent lights, which is really cool. Can't do that with a relay (well, maybe you could, but honestly, you'd kill the contacts in no time).
If you REALLY know what you're doing, you can even dim fluorescent lights, but you need either a really good, or slightly modified ballast.
PWM'ing a relay in order to dim an incandescent light would be crazy indeed!
If I did use a cell phone charger, how would I do this? I am also confused with using a wall wart. Do I have to cut the end off of the cord?
More Comments