Arduilay is an 8 channel AC relay box for use with Arduino, Max/MSP, Processing, etc.  I designed this system as an alternative to the USB>DMX 4 channel relay option.  While DMX gives you dimming control, the setup is easily 5 times as expensive as this simple relay box.

Step 1: Get All the Parts

To make this relay box you will need:

- An Arduino
- 4 standard wall outlets
- A four bay plastic outlet box for old construction
- An 8 channel relay board
- A three prong appliance cord
- A four bay outlet face plate, or the laser cut version attached (Red cut, Blue etch)
- 8 half inch #6 machine screws, 4 matching nuts
- 4 one and a half inch #4 machine screws with nuts and one inch nylon stand-offs
- Some wire, 10 female and male header pins, solder, etc.

Tools needed:
- A soldering iron
- A multimeter
- A drill
- A screwdriver
- Wire cutters

I got all the materials from Home Depot and Amazon.  In total, it cost about $50.00 for all the parts.

This is a really simple project, but it does require experiences with drills and soldering.  There are great tutorials on instructables for these tools if you do not already have these skills.

PLEASE NOTE:  Working with AC power is dangerous.  Don't hurt yourself, and don't blame me if you do.

Step 2: Snip the Outlets

I wanted individual control of each outlet, versus both outlets being powered on at once.  To do this, you have to cut the tab between the GOLD screws on all the outlet pairs.  The GOLD screws are on the hot side, the SILVER screws are on the neutral side.  It should say this on the bottom of the outlet pair.Use your wire cutters to snip this tab.  You can use a multimeter to make sure the connection is broken.  The cold side tab can remain intact as we will be wiring them all together anyway.

Step 3: Wire the Grounds and Colds

Cut yourself six 3inch lengths of wire.  I used 18 gauge wire, but 14 gauge would probably be better. Use at least 14gauge wire - I went back and rewired mine based on feedback in the comments.  Strip and bend each end into a C shape.  Use three of these wires to connect all the GREEN ground screw terminals, and the other three to Connect the SILVER neutral terminals.  Since we left the cold side tabs in tact, we only have to use one screw per outlet pair.  Use your multimeter to ensure that all the GREEN screws are connected and all the SILVER screws are connected (even the ones without wires).

Step 4: Add the Relay

Now, cut 8 lengths of wire (about 4-6 inches depending on the outlet's position), strip the ends, and C shape one of them.  One C end goes to each of the 8 GOLD screws, so that each GOLD screw has its own wire.  The other strait end of the wire goes into the really array.  PLEASE NOTE:  In the photo I have it wired up wrong!  The wires should go into the MIDDLE terminal of each relay's 3 terminals, NOT the LEFT terminal.

Step 5: Mount Some Stuff

You can now mount the outlets to the faceplate with the #6 screws, and the relay array to the faceplate with the #4 screws.  Check to make sure you've got outlet one going to relay one and outlet two going to relay two, etc.

Step 6: Add the Relay Powers

Cut 7 one inch lengths of wire and strip the ends.  Make them into staple shapes and connect all the RIGHT relay terminals together.  They should all have two staple lets going into them except the first and last ones.  PLEASE NOTE:  I still have the GOLD screw wires wired wrong in these photos!  They should be going to the middle relay terminals.

Step 7: Put the Arduino in the Box

Line up the Arduino in the bottom of the outlet box.  Drill and 5/8 inch hole for the USB port and a 3/8 inch hold for the power jack in the side of the box.  I just did this by eye.  I ended up using 2 #2 machine screws to hold the Arduino in place, bit now the box is kind of wobbly due to the screw heads, so there may be a better solution, like using countersunk flat heads, or tape.

Step 8: Make This Funny Cable

Now you need a cable to connect the 10 relay pins to the Arduino.  This is a weird one.  We've got the 10 female headers all nice in a row, but the male headers split the first and last off and those get connected together.  This is the power and ground.  This cable gets plugged into pins 2-9 of the Arduino.  I use these pins because pins 0-1 are used for serial communication with Max/MSP.  Pay attention to how the cable connects to each device as it may need a twist to get 1 to 1 etc.  I use hot glue and tape to cover the exposed solder connections to prevent crossed wires.

Step 9: Add the Power Cable

The power cable should be routed through the outlet box first.  The old construction boxes have built in strain relief ports on the bottom, you just jam the wire through.  Use one of the ports on the end of the box where the Arduino is NOT located.  This will give you some wiggle room when accessing the box internals.  Connect the GREEN wire to one of the GREEN outlet screws, the neutral wire to one of the SILVER screws and the hot wire to one of the power (staples) relay terminals.  If your hot / neutral cables are not labeled, the neutral wire connects to the larger of the two flat plug prongs.  Use your multimeter.

Step 10: UPDATE: Add a Fuse!

So after receiving so much excellent feedback from everyone I've made a few additions.  Get yourself a little fuse holder and and a fuse.  I'm using a 20amp 110v one because it's the only 110v variety my local hardware store had, though as people have noted a 10amp one may be better.  Wire this in on the hot (GOLD) side of the power cord before it gets to the relay board.  You can also see in this photo the upgrade to 14g wires and the splitting of each relay power wire to its own lead (versus the "staples" series used before).

Step 11: Close It Up

Use the remaining #6 screws and nuts to close up the box.

Step 12: Connecting to MAX

Before you test out the AC get your Max and Arduino code set up.  

The Arduino code comes from the ArduinoMax_InOut_forDummies from the Arduino playground.  Just upload the included sketch from there.

Then you can connect whatever AC stuff you want.  

Max code is in the text file.

<p>Would I be able to use this with Christmas lights and the Vixen software instead of MAX? :)</p>
<p>FYI: There are three wires used in a 120Vac AC Circuit such as you would control. Ground, Neutral, and Hot (Power). </p><p>The color coding for the connecting wires is Green, White and Black. (In a 220VAC Circuit, power is also supplied via a Red wire and, often the Neutral is not present,</p><p>While the Neutral and Ground and not described as &quot;Hot,&quot; neither is described as 'Cold.' If you were, indeed wiring all the SILVER connections together, these would be the Neutral connections and should be connected (joined, linked, etc) with a White insulated wire.</p><p>If you check the power cord you used, you may find there is a color-coded wire insulation for each of the three wires. On some power cords, one of the connectors is 'ribbed' linearly to define the Neutral conductor (or is it the Hot connector - got a meter handy?).</p><p>All in all an ambitious project and worth saving for future reference. I was impressed by the cover plate you made as well.</p>
<p>Did anyone actually try to build this with 14 AWG wire? I can't see any possible way to wire the &quot;staple&quot; jumpers with 14AWG. One wire barely fits in the socket, but two does not seem to be possible. Am I doing something wrong?</p>
<p>Thanx for this great posting. I plan on doing the same thing but with a raspberry pi. If I run into trouble I will hit you back.</p>
<p>Thanks, great instructable. I'm adapting some of what you did here for my own solution and have one question. What material are you using for the faceplate? </p>
<p>BAH. Answering my own question by reading further (&quot;It is masonite surfaced on both sides.&quot;). </p>
<p>Great project! Would like to know more about the coding of it if you could elaborate...</p>
<p>still need help in coding? maybe i can help you understand</p>
While appreciating all the efforts you have taken to assemble this system, one must say that, additional explanations are lacking and errors are evident. You have also have not provided schematics, no information as to what you are trying to control, lacks info on Laser cut face plate and the video clip is not explanatory. <br>You must remember, we are dealing with high tension wiring. <br>Thanks anyway, nice thought. <br>
<p>How is this high tension? You are getting home relay controls mixed up with the powerlines that go from Portland to San Francisco...</p>
<p>hi . can you help me how we can load MAX . cn you show me please . thanks you Sir</p>
<p>Why are you connecting the fuse leads to the right terminal, shouldn't it be the left terminal? If you connect it to the right then when the relay is off it will turn on the light and when the relay is on it will turn of the light. Is this correct?</p>
<p>Hi! </p><p>where is located the power (staples) ?</p><p>thank you!</p><p>marC:)</p>
<p>Thanks for this! I'm an old guy fussing around with an Arduino. I took several years of electronics but had a brain fart when it came to hooking mains A/C into a relay.</p><p>You also unwittingly supported US veterans (not that I am one). I've already got a circuit built up for Xmas lights on a helicopter in front of the American Legion Post 127, Buford, GA. Just to show them what can be done, each rotor has separate strings of lights. In an hour or two I'll be making them alternately flash like they're moving. The vets will LOVE this.</p>
<p>the hot wire to one of the power (staples) relay terminals.</p><p>where is it?</p><p>thanks!</p><p>marC:)</p>
<p>you missed the step where you add the ribon cable to the relay. I got this far and now I'm stuck.</p>
Hi, <br>More technical information about this type relay board, and pointer to schematics <br>on the ArduinoInfo.Info WIKI HERE: http://arduino-info.wikispaces.com/ArduinoPower#4-8
how do you make the faceplate
How do you do step 6 with a larger wire?
If you look closely at what hes done in step 11, you will see he went to larger wire, and connected each relay with its own lead to the fuse. Other than that looks like everything else is the same
I have a question about fuses. I recently was using a setup much like this to run some aquarium equipment, one of my pumps died and blew the solid state relay it was on, caused a fire, of which we luckily got put out on time before the whole house went up. Anyways, my question about fuses, I am going to rebuild the system using your instructable, but I would like to add a fuse to every relay, would a <a href="http://www.digikey.ca/product-detail/en/025101.5MRT1L/F3170CT-ND/1984466?itemSeq=141191382&uq=635223808936751307" rel="nofollow">PICO FAST 1.5A 125V AXIAL Fuse</a> work.<br> <br> I dont know a whole lot about fuses and breakers, so I've done abit of searching and it looks like a 65w 110ac pump would be around .5 amps. So I'm thinking a 1.5 would do just fine, as the SSRs I was using, also from sainsmart, are good for 2 amps. I'm sure not sure those little pico fuses would work, I picked them cause they look easy to use in a tight space.<br> <br> If anyone out there has an opinion on weather or not this is a good idea I'd love the help.
Great Project! Looks nice! <br>Adding DMX wouldn't cost that much. Just a MAX485 or sn75176 chip for about $1, a cheap .1 uf cap, and a $5 5-pin XLR connector (though you could use something cheaper). <br>
How could it be turned into a DMX receiver using the MAX485 chip, .1 uf cap, and XLR connector? Would love to add that in myself!
Here is one example of coding: http://www.mathertel.de/Arduino/DMXSerial.aspx. <br>There are a few example of implementation online. You basically hook up the MAX485 TX to Arduino RX. Put the .1uf cap across the MAX485 chip VCC and GND. (I actually use the sn75176 typically, but have had problems getting the whole thing to work without this filtering cap. I have been surprised to not see it in DMX shield designs.) On the XLR connector pin 1 connects to ground, pin 2 connects to MAX485 pin 7, pin 3 to MAX485 pin 6. I also recommend making a terminating jumper that allows you to connect or disconnect a 120 ohm terminating resistor across pins 2 and 3.
I'm in the parts-sourcing part of a project, and I can't believe how often the connectors and sockets are so significantly expensive compared to the actual electronics that plug into them. Atmega328p (Arduino processor) $2 each (25+), 28pin socket for it, $1 each. *boggle*
It has been very frustrating. I find for just personal projects I often forgo the connectors and just solder things together or find another alternative. That is probably the primary reason why a lot of cheap DMX devices use 3 pin XLR instead of 5.
excellent instructable, quick question how hard would it be to integrate a meter to actually see how much power the AC Relay is using?
I'm working on a project that has monitoring capabilities using an ACS712 chip - https://www.sparkfun.com/products/8882. This outputs a DC voltage as a function of the current, which can be AC or DC. https://www.sparkfun.com/datasheets/BreakoutBoards/0712.pdf
Don't know. Some one else suggested using a Kil-O-Watt for this purpose.
Excelent instructables!
mbmosher - Nice layout, clean wire dressing, solid mechanical layout - all excellent traits for a safe electrical project. I agree with your change to 14 gauge wire it should be used on every connection on the high voltage side(&gt;20 volts). Also direct connecting your circuit to the AC Main coming from the wall could be problematic. A 10 amp fuse or circuit breaker is adviseable. Circuit breaker switches are also available which would provide a master on/off switch capablity as well. I suggested a 10 amp fuse because the weakest point in the circuit is the relays, the circuit board should have been designed to carry atleast that much current. The relays have a maximum current rating of 10 amps @ 250 volts written on top. I am not sure what you wish to switch however you should take care never to exceed 1200 watts (120 volts * 10 amps = 1200 watts) or actually about 10% less (as a safety margin) with what you plug in. Never exceed the maximum rating of the weakest part in your circuit. <br>Great technique , What is next?? <br> <br>- Phil
Thanks for this - Based on everyone's feedback I've added a new Fuse step.
MBMosher, I like your work it is very clean and neat and I like that you used heat shrinkable tubing - very good. If you can find it a smaller fuse ie 10amps its much advised. Also since you used a fuse, fuses have different delays, blow rates, how long they will pass a given current before they blow open. A 10 amp slow blow fuse will not blow if there is a quick surge. Would be a good choice for your project. It will open if the surge lasts for more than a few hundred milliseconds in which case its likely something more than a surge or voltage spike. Great ible!
is there any way to connect multiple relay in connection to control more devices <br>
Given all the weird power situations it would probably be best to just make multiple realy boxes.
Two really big notes:<br> <br> First, I don't note any electrical isolation between the outlet terminals and the back of the relay board. There is a potential for deadly 120v AC to arc across the gap, through the arduino, through your attached PC, and through YOU!<br> <br> Add a non-conductive plastic/rubber barrier between outlets and relay board. Add a second one between relay board and Arduino. Better yet, figure a way to avoid having the Arduino inside the electrical box.<br> <br> Second: You could turn your project into a DMX-controlled relay. Take a look at my instructable on just that subject.<br> <br> <a href="https://www.instructables.com/id/DMX-Ardweeny-Node/" rel="nofollow">https://www.instructables.com/id/DMX-Ardweeny-Node/</a><br> <br> Best,<br> <br> Michael
Conventionally the silver &quot;cold&quot; terminals should be connected with white insulated wire, this side of the circuit is often referred to as the &quot;neutral&quot;. Connect the green &quot;grounding&quot; terminals with bare wire or green insulated wire.
kudos to you sir. again as a matter of safety this is a great comment - if you mix up the hot and neutral, in some occasions you could end up with the frame of some device being hot even if it is turned off. and if by chance you happened to have also unwittingly fused or switched the nuetral side of the setup at any point (as was mentioned in an earlier comment)- you make increase the chances for a &quot;shocking&quot; lesson to be learned. ( i have found that you only have to learn it once however ) <br> <br>Kudos to all though - great ible, great comments <br> <br>
for some reason the captcha isn't showing up on replies for me.... <br> <br>in response to the question of what to fuse, neutral or hot: <br> <br>In regards to residential wiring code and best practices, you NEVER fuse or breaker the neutral. <br> <br>Reasons for this are because: <br> <br>1) If the fuse burns or breaker trips on the neutral side, the entire circuit is still live, meaning someone troubleshooting the circuit can be electrocuted by a seemingly dead circuit. (this is also why switches should always be on the hot side as well, you don't want to turn off a lamp and electrocute yourself changing the bulb - the shell will still be live if you switch the neutral rather than the live) <br> <br>2) 2 prong appliances use the neutral as a ground because they are tied together in the main circuit panel. (ground is sort of a backup neutral) <br> <br>3) If there is a short to an external ground (ie through the casing and into structure or people) the electrical path will bypass the fuse or breaker; meaning it won't stop the flow of electricity. <br>If the external path has enough resistance to keep the current flow below the main circuit breaker's amp rating, it also won't trip, causing electrocution and/or fires. <br> <br>Always put fuses and breakers on the live(hot) side so that the entire circuit is dead when they blow. <br> <br>i.e. Think of plumbing a sink, you don't put your cut off on the drain because that just stops the water from leaving the sink. <br> <br>I know most transistors switch negative, but they are part of a logic circuit, not a safety device/circuit cut off.
I'll happily second that! <br> <br>Old school electricians used to &quot;switch&quot; the neutral. The best I could determine from talking to the old guys I learned from - the idea was to make the switch last longer. This was from early on in the days of &quot;knob and tube&quot; wiring when electricians were also working on radios and all other electronics. <br> <br>At that time, the majority of trained electricians were trained in everything electrical and the rules were not separated as much as they are now.
Great info, thanks!
I have tested my hardware with the blink sketch and changed the delays to 3000 and int led from 13 to 2 and then uploaded the sketch. I repeated this for pins 3-9 and they all turned the relays on and off every 3 seconds. So no problem with the hardware. I must assume my problem is with the software. I am using MAX runtime 6.0.8 and the arduinoMaxInOutforDummies.ino sketch from ArduinoMax-InOut-forDummies01. When I load your MAX file I see a message in the MAX window that says &quot;specified port not available&quot; then &quot;doesn't understand &quot;reset&quot;. I load the sketch on COM7 and when I re-select COM7 in MAX I see the same &quot;specified port not available&quot;. Anyone have any ideas?
After some digging around I changed <br>&quot;text&quot; : &quot;serial c 115200&quot; <br>to <br>&quot;text&quot; : &quot;serial g 115200&quot; <br>and it is working now. I am still getting a doesn't understand &quot;reset&quot; message though. <br> <br>If I try to change or set the port through MAX it stops working.
Yeah, that's how you hard write in a serial port - the trouble is that sometimes they change. Are you using a leonardo or uno arduino? Make sure the arduino is connected to the computer via USB before launching Max; serial with Max can be finicky.
Using the same hardware and an ethernet sheild I found and modified an ethernet sketch to control the relays. This sketh controls each rely with a specific URL. I have the IP set to The URL for pin 2 is$1 and&nbsp;$2 to toggle it on or off.<br> pin3 is $3 and $4<br> pin4 is $5 and $6<br> pin5 is $7 and $8<br> pin6 is $9 and $0<br> pin7 is $A and $B<br> pin8 is $C and $D<br> pin9 is $E and $F<br> <br> I didn't write this sketch. I just made a few mods. All credit goes to the original author.&nbsp;<br> <br> /*<br> &nbsp; Web Server Demo<br> &nbsp; thrown together by Randy Sarafan<br> <br> Allows you to turn on and off an LED by entering different urls.<br> <br> To turn it on:<br> http://your-IP-address/$1<br> <br> To turn it off:<br> http://your-IP-address/$2<br> <br> Circuit:<br> * Ethernet shield attached to pins 10, 11, 12, 13<br> * Connect an LED to pin D2 and put it in series with a 220 ohm resistor to ground<br> <br> Based almost entirely upon Web Server by Tom Igoe and David Mellis<br> <br> Edit history:<br> created 18 Dec 2009<br> by David A. Mellis<br> modified 4 Sep 2010<br> by Tom Igoe<br> <br> */<br> <br> #include &lt;SPI.h&gt;<br> #include &lt;Ethernet.h&gt;<br> <br> boolean incoming = 0;<br> <br> // Enter a MAC address and IP address for your controller below.<br> // The IP address will be dependent on your local network:<br> byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDA, 0x02 };<br> IPAddress ip(192,168,1,111); //&lt;&lt;&lt; ENTER YOUR IP ADDRESS HERE!!!<br> <br> // Initialize the Ethernet server library<br> // with the IP address and port you want to use<br> // (port 80 is default for HTTP):<br> EthernetServer server(80);<br> <br> void setup()<br> {<br> &nbsp; pinMode(2, OUTPUT);<br> &nbsp; pinMode(3, OUTPUT);<br> &nbsp; pinMode(4, OUTPUT);<br> &nbsp; pinMode(5, OUTPUT);<br> &nbsp; pinMode(6, OUTPUT);<br> &nbsp; pinMode(7, OUTPUT);<br> &nbsp; pinMode(8, OUTPUT);<br> &nbsp; pinMode(9, OUTPUT);&nbsp;<br> <br> &nbsp; // start the Ethernet connection and the server:<br> &nbsp; Ethernet.begin(mac, ip);<br> &nbsp; server.begin();<br> &nbsp; Serial.begin(9600);<br> }<br> <br> void loop()<br> {<br> &nbsp; // listen for incoming clients<br> &nbsp; EthernetClient client = server.available();<br> &nbsp; if (client) {<br> &nbsp;&nbsp;&nbsp; // an http request ends with a blank line<br> &nbsp;&nbsp;&nbsp; boolean currentLineIsBlank = true;<br> &nbsp;&nbsp;&nbsp; while (client.connected()) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (client.available()) {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char c = client.read();<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if you've gotten to the end of the line (received a newline<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // character) and the line is blank, the http request has ended,<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // so you can send a reply<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //reads URL string from $ to first blank space<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(incoming &amp;&amp; c == ' '){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; incoming = 0;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '$'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; incoming = 1;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Checks for the URL string $1 or $2<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(incoming == 1){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(c);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '1'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(2, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '2'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(2, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '3'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(3, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '4'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(3, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '5'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(4, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '6'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(4, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '7'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(5, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '8'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(5, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '9'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(6, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == '0'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(6, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'A'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(7, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'B'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(7, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'C'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(8, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'D'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(8, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'E'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;ON&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(9, HIGH);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(c == 'F'){<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;OFF&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; digitalWrite(9, LOW);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (c == '\n') {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // you're starting a new line<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentLineIsBlank = true;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (c != '\r') {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // you've gotten a character on the current line<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; currentLineIsBlank = false;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp; // give the web browser time to receive the data<br> &nbsp;&nbsp;&nbsp; delay(1);<br> &nbsp;&nbsp;&nbsp; // close the connection:<br> &nbsp;&nbsp;&nbsp; client.stop();<br> &nbsp; }<br> }<br> <br>
Very cool! I don't care what you plan to control with 8 channels of light main power, it is completely cool! Lightshows spring to mind obviously, but for my end, I have servers that sometimes freeze up, and replacement budget is slow in coming, so I have to go and power-cycle them. Would be much handier to just send the command to the powerstrip. Thanks!
Great project! Now I would like to make one myself:) <br> <br>One cool thing to add would be an ethernet shield and use the arduino as a client. <br>jgmrequel ideas are also awesome! <br>
Very cool project, these are the sorts of things that makes Instructables great.<br> <br> Some mods I would suggest or add myself:<br> <br> 1. if you are going for light loads, add replaceable fuses to each outlet or pair of outlets. Heavy loads, maybe a circuit breaker blade. Not only is the protection good for human life, but it could also protect electronics and minimize part replacement if a circuit or relay gets overloaded.&nbsp;<br> <br> 2. I'm a fan of measurements - perhaps you can take a Kill-A-Watt and integrate it into the power input, measure how much power goes through your box, integrate it with the Arduino to send measurements back to the program (like with the Tweet a Watt, but without the wireless).<br> <br> 3. If you have the room, perhaps you can integrate the Arduino power supply into the box itself, drawing power when the box is plugged in (and giving one less cable coming out).<br> <br> 4. Add an LED to each outlet so you can see which is live without having to look at the computer screen.<br> <br> 5. Since you still have all those analog pins, perhaps a variation is to add swtiches to outlets and add ammeter circuits to your outlets so that the Arduino can monitor current draw - plug in your phone to a charger, push a button to switch on the outlet. The moment the current draw is steady state (over a minute or two) at the level the charger would be at without the phone, arduino switches the outlet off and sounds a notification itself to let you know its done.&nbsp;<br> <br> (roots through parts bins, grabs 4 channel relay shield and small power strip, warms up soldering iron . . .)
As a side note, I am also a fan of Kill-A-Watt and my local library has them on the shelf. Worth checking into if you only use it every month or so.
Where is your local library? That's awesome! LEDs are a great idea too, the only reason I didn't put them in was me not liking lots of wires, but I will probably put them in in the future.

About This Instructable




More by mbmosher:Arduilay Mindflex Duel Bluetooth Arduino FIO Hack Solar Bike Stereo 
Add instructable to: