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

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.
Lots of information on Arduino power control here:<br><br>http://arduino-info.wikispaces.com/ArduinoPower<br><br>Regards, Terry King<br><br>terry@yourduino.com
<p> 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&nbsp;excellent descriptions of the issues involving microcontroller control of high power electrical loads.&nbsp; Also the commercial boards the site features seem to have good value for the price and are worthy of consideration in home projects.<br> <br> Best Wishes<br> Mark.</p>
<p>How can i make it respond based on a ping response?? would be nice for remote network equipment that freezes up.</p>
<p>bitastico&gt; 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.</p><p>Best Wishes.</p>
<p>Thanks for this great article. You mention, &quot;Solder the signal ground wire and the wall-wart ground wire to pin 9 of the ULN2803A&quot;. The wall wart only has 2 wires (red/black). Should I solder the black to pin 9? (I assume red is positive.) Thanks. </p>
<p>Great tutorial. I did my own variation but the arduino is powered by a transformer inside of the box. Next I'm going to install a smaller arduino so I can put a cover on it. </p>
Beautiful Job there! <br>An Ardweeny is smaller/cheaper but doesn't do its own power leveling so you'd have to use clean 5v if you want to use that. RFduino's look interesting but I haven't used them.<br>Best Wishes!
<p>Needed a remote kill-switch for my CubeX 3D Printer (which goes berserk often) for overnight builds when I'm away from the printer. I also have a network camera watching it so I can see if the build has failed. At that point, I will just remote kill the printer so it doesn't waste any more plastic. I am getting a wifi shield so I don't need a computer hooked up to the Arduino. </p><p>Nice work Maewert!</p>
<p>It looks like a very nice job there!</p><p>Best Wishes.</p>
<p>I've got a question for you maewert. If I need the power on for a long time would it be better to wire the relays as normally closed so they don't burn out?</p>
<p>It sure would! If the thing you are powering is most always ON and seldom ever OFF then hook up the power through the NC contact on your relay. Just remember in the code now you have to set your control pin HIGH to turn the device OFF. Good Comments in the code will help you remember this change.</p><p>Best Wishes!</p>
<p>HAHAHA!!! Love the disclaimer!</p><p>I may steal that later.</p>
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&amp;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.&nbsp; 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: <br>http://www.makershed.com/PowerSwitch_Tail_II_p/mkps01.htm <br>Thanks, <br> <br>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. <br> <br>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? <br>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! <br>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. <br>(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.) <br>Best Wishes...
I prefer driving a Triac output optocoupler into a Triac. <br>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. <br>When running a lighting controller, the clicking of relays would be annoying, plus you get into contact arcing issues as well as mechanical wear. <br>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 :-( <br>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). <br>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?
You can use it either way.&nbsp; Just be sure it provides the voltage and the current you need.&nbsp; If you purchase a mating connector then you can plug the charger into the connector and wire the connector to the circuit.&nbsp; Otherwise you can cut the connector off the charger and wire the charger directly.<br> Best Wishes.
This was interesting. I might suggest, though, that you make use of relays that will handle 15Amps. <br> <br>Also, the NM wire clamps should both have bushings on the inside. They run about USD$2 for a five pack at the local big box. The bushing keeps the clamped wires from chaffing against the edges of the clamp on the inside of the junction box. <br> <br>
Nice write up, and a fun way to get into power control. Also could easily be expanded. If you want to bring the power supply requirements down the relay could be replaced with a Photo-Triac<br>This is a type of switch to control AC current with an LED.<br>A solid state relay would also work. but that would be for a more permanent instillation
Thank you. <br>Yes, I think you are right. I have used regular triacs (but not photo triacs but i understand the concept :-). I prefer the 'solid' on and off a relay provides at the sacrifice of reliability as the relay's physical parts wear out much sooner than the triac. I have had problems of leakage current using triacs - a CFL bulb that would flicker a little bit when it should have been OFF when under triac control. <br> <br>Thanks again! <br> <br>Best wishes
Try using a tiny cell phone charger. I did in one of my projects. They are switching supplies and are quite small, but will output 5v anywhere from 500mA to 1A depending on the unit.
An excellent and well documented instructable. How about adding the script for completeness. I have done lots of electronics projects but am new to the arduino so any help with programming would be really welcome.<br><br>Many thanks.
Voltamps,<br><br>If I were you I would begin my using the BLINK example program that comes with the Arduino environment. It will show you how to blink an LED or to 'blink' the power outlet in our case. This will help you debug your circuit.<br><br>Other than this the code would depend on what you want to accomplish, such as turning on a lamp when an infrared beam is broken, or turning on a heater when the room gets below a certain temperature. Each of these examples would be possible but would take additional hardware.<br><br>Best Wishes.
Very Nice instructable, can I program the code and add it directly to the arduino? So I can work without the computer?
Yes,&nbsp; an Arduino can easily provide the signals to control the relays.&nbsp; In the demo I used the PC only to program (and run) the Arduino which provided the signals.<br>
nte2018 = uln2803. if you have some really old disk drives, sometimes they have them.<br />

About This Instructable




Bio: I'm an aerospace engineer by trade but am interested in astronomy, robotics, CNC machines, Arduinos, you name it.
More by maewert:Advent Calendar Box Internet Island Mobile Solar Power Station 
Add instructable to: