loading
If you have ever wanted to control high voltages/currents with an Arduino, setup up a complicated light timer, or even have Siri turn on a Lamp. Then this is an instructable for you! In this instructable in a few simple steps we will build a self-powered smart relay (Arduino style) power box. This box will allow you to safely switch high voltages/currents and since it contains an Arduino compatible board you can program it as you see fit, or even connect it to SiriProxy. Then you just plug it in, and off it goes! Now let’s build it!



Materials Needed:

Project Box - similar to a 6x2x3, (http://www.radioshack.com/product/index.jsp?productId=2062282)
Smart Relay Board - http://www.sparkyswidgets.com/Products/Store/Details/tabid/81/ProductID/1/Default.aspx
BlueSmirf - bluetooth module http://www.sparkfun.com/products/582
Power switch - Similar to this will work fine (http://www.radioshack.com/product/index.jsp?productId=3118987)
Replacement power cord - something like this from Lowes, HD, Ace (http://tinyurl.com/72n7yqe)
Cable strain relief - Mouser part# 836-1200(http://tinyurl.com/7tlpkaw)
Snap in power plug(x4) - Mouser part# 693-4300.0703(http://tinyurl.com/7pb57h8)
transformer - pretty much any will work as long as it can supply enough for the relays (http://www.radioshack.com/product/index.jsp?productId=2102494)
diodes(x4) - 1n4004, any recitifing diode should work (the 1n400x line is good for the application, http://tinyurl.com/6qen2pg)
capacitor - 220uF electrolytic cap jsut to help keep things clean on the DC output side of the transformer Mouser part# 667-ECA-1HM221(http://tinyurl.com/7ylc8al)
extra wire(14awg) - this can be from the power cord just cut an extra bit off, (we need some for Neutral, Hot, and Ground)
Heat shrink - If you can get color coded great, if not your average Radioshack black stuff will work fine
Crimp connectors - Your standard automotive style crimp connectors for 14awg(male and female, blue colored ones)

Tools Needed:
Drill
3/32 drill bit
9/16 drill bit
Dremel - we'll use this to clean up our rough opening for the sockets and switch
Screwdrivers - a set of tech type screwdrivers should do fine(standard and philips)
Pliers/Wire Cutters - the strain relief can be difficult to push in, pliers make this much easier
Soldering Iron - A decent soldering iron with some good solder
Some better super glue than I used :)

Our main steps:
1)Build small unregulated power supply(the relay board has regulators)
2)Prepare enclosure(cut openings, pre fit switch and sockets, mount power cord)
3)Initial wiring of mains wires, wire to switch, preparation of unions, test switch and Vout of transformer
4)final wiring, soldering of union joints, heat shrinking, wiring of lv relay board power
5)wifi/bt/xbee module, then close it up and test it out

Step 1: Build DC Power Supply

Using the transformer, diodes and capacitor we are going to make a 12v unregulated power supply to provide a 12v DC source from the mains power cord. Since unregulated power supplies can vary quite a bit we used a 50v capacitor to make sure we have plenty of margin as this transformer was observed producing around 27v peak to peak with no load.

The basic steps to build this DC power supply are:
1)Create the bridge rectifier - Using the 4 diodes we will create the rectifier that will turn the AC current into DC and supply us with a fairly steady DC positive Voltage. Images 2,4,5 depict the layout and components needed for this portion. Notice the direction of the diodes and how half of the rectifier is tucked under the transformer. Placement of this portion should allow the transformer to sit on top of it and expose the positive half(as shown in main image). this allows for easy connection of the transformer secondary to our rectifier and help save some space(image 7). You can use the diode leads to make the rectifiers connection on the bottom side of the board(image 8)

2)Mount transformer- mount the transformer above the rectifier making sure the SECONDARY is on the rectifier side, solder the tabs on the under side to hold the transformer in place. now is a good timer to wire the secondary to the rectifier. And you can even add a couple short pieces of the 14/16awg wire on the PRIMARY side, we will need these later to wire the switch,sockets,relays.

3)Place Capacitor- Place the capacitor and use its leads to wire into the positive and negative rails (the long lead is + on the cap), then solder it into place.

4)make the final connections to the negative(ground) and positive rails of the rectifier (here we used a 3 pin connector but you can hard wire a DC power plug, or even straight to the relay board input).

Step 2: Prepare Enclosure

This step is pretty straight forward; we will locate our holes and make them :)
We need two 1"x1" square cutouts for the snap in sockets; these should be located in the middle of the enclosure towards the top. I drilled a few small holes around the perimeter and finished the cutout with a sharp exacto knife, but needed a bit of touch up the dremel.

After we finished the socket cutouts its time to drill a couple 9/16 holes one for the power cord and one for the power switch.
The location of these is fairly important as we need to skirt by the transformer, and still wire our Load IN and Out from the switch. As shown in the images we placed them inline on the left of the box with the switch on the inside of the transformer.

Now we need to drill our 9/16 starter hole and finish it with the dremel to match our power switch size (You could use a 7/8 I believe to accomplish this in a single task). As before the location should match up with the power cord and transformer to give us enough room for a decent wiring job.

An easy way to drill these larger holes is to only apply enough pressure to lightly drill; a sharp bit will try and grab which can make it difficult. Also a drill press with a fixture would make this extremely easy lol.

Once our holes are finished we can put the strain relief on the power cable and crimp with the pliers. If you are using the power cord wire as our extra wiring, you will want to make sure to cut our extra off now. Inserting the strain relief can be quite difficult, especially with the larger awg wire. If you find it too hard you can trim a slight bit off the hole, but I recommend using the 9/16 as it makes a really nice stable fit.

The last part of this step is to mount the power supply and relay board to the enclosure base. Then general layout we chose is shown in the last picture and gives enough spacing to fit our switch and sockets in. Once they are located mark the holes and drill them with a 3/32 drill bit. We used standard pcb mounting screws to moun the boards down, you may have to adjust the drill size for your available hardware.

Step 3: Initial HV Wiring

This is another straight forward step, we are going to pre wire the HV top end and get some of our feeder wires ready. All this step(and the next step) really involves is:

1) Pre cutting our jumper wires(shown in the first image.
2) Trim our Power Cord inputs and place a connector on the Load In(HOT) and feed it into the switch.
3) Cut the Neutral on the Power Cord to fit on the switch(like the HOT) then place a connector on the Neutral and a feed line for both sockets and the transformer.
4) Place a connector on the Ground plus a single feed line for the other socket, these will go straight to the sockets.

Now is a good time to pre wire the bottom end too, this doesnt require much more then tying the relays input(HOT) to the transformer HOT and making a short jumper that will plug into the output on the power switch. Then we can just tie the neutral bus togther in the next step right before we do our final wiring.

As you can see there isnt much involved, but this step is important to ensure our box will be safe to operate. By placing heat shrink over all the connections and having lightly soldered connections will ensure that no shorting will occur and that the HV lines wont work themselves free!

Step 4: Final Wiring

This step is really just an extension of the previous one, and is straight forward as well. All we really need to do in this step is to finish the HV wiring. As shown in the first picture we have the top and bottom ends pre wired and ready to take heat shrink and final connection to each other.

In the 2nd image we attached the neutral bus and placed a female connector on the HOT lead which will connect to the switch output.(the switch will allow us to kill power from the switch back) The bottom end is wired so that the transformer and both load in(s) on the relay board are tied to a small jumper that will be connected to the power switch. The neutral connects only to the transformer on the bottom end.

After the ends are connected, we can prepare our HOT leads from the relays to the sockets. These should be long enough to make final assembly easy enough, but not too long to cram everything together. (These are shown connect to sockets in image 3) Once these leads are ready we can wire up each of the sockets. I made a few different lenghts untill I found one that was long enough to get an ISP plug on to perform programming(you can also use a usbtoserial Rx-Tx,Tx-Rx,DTR-Reset, just as it were an arduino mini or such)

Bringing our Neutral and ground leads in first and finally wiring in the HOTs. This part can be a bit difficult with the tight spaces but with proper offsets (one side cables up, the other down slightly) makes this part easier. After our sockets are wired we can finish off the HV wiring by tying the socket HOTs into our relay boards open Load pins as shown in images 4,5,6.

At this point you can pretty much program it how you want and let it go, but we'll add a bluetooth module(could be wifi, xbee whatever) in the next step before we close it up.

Step 5: Wireless and Closing It Up!

This step is the easiest really, since I intend to use this with SiriProxy and its going to be pretty close to the server I decided to take a bluetooth module and put it in. This will expose a comport on the SiriProxy server that I can connect to and tell Siri to use! There are many many ways that one could communicate with this box this is just one!

I just plugged the BlueSmirf Gold into the Rx,Tx,Vcc,GND pins that are available on the relayboard. its that easy, besides tucking it out of the way :) The relayboard also breaks out a number of analog and digital pins in case someone wants to add sensors or attach external relays, etc...

Now all you have to do it close it up and test it out!

I hope you enjoyed this instructable and found it useful!!
Please visit our website for more projects, ideas and products!
How do we give our own commands to siri?
Basically you catch your phrase, letter, number with regular expressions then perform tasks based on your keywords, phrase whatever. If you know ruby fairly well its quite easy, if not follow a few online tutorials for ruby or RoR to get up to speed then its just a matter of working out what you want to do :)
Ok sir, then how should I embed those to your smart box? <br>I need detailed information. <br>In here you are telling to Siri to on relay 01 right ? <br>So then I want to program it to &quot;Switch on lights&quot; like wise. <br>I need full details :) <br>
If I wanted to set this up for 5 volts what would I have to change to configure it for the reduced voltage?<br><br>Thanks, great Instructable
Do you mean switch 5v with the relays or just use 5v for the input without a transformer? I guess my answer would be similar either way, there really isnt much to change on the output side as the relays are able to handle 0-240V AC/DC. As for using 5v as the power source if its a regulated and fairly clean source simply wire it in to the Vcc and Ground(+5v and gnd on Arduino).<br><br>You can really adapt this design to any Arduino type board and most relay setups even SSRs the concept is virtually the same, just make sure the relay is overrated a tad for the design and bobs your uncle :)
I am looking to take 110 AC and convert it to 5 V DC to drive a sensor network. This way I will not need to draw power from my arduino. I was look for a way to get to 5V with out using a wall wart to do the change as wall wart are very bulky.
How small are you looking for? a 1000mA capable ipod charger is tiny.
A combination of a varistor, cap and diode would achieve this for you, It doesnt provide isolation from the mains however. Atmel uses a version of this to power the circuit for a power monitoring system as seen in this app note http://atmel.com/dyn/resources/prod_documents/doc2566.pdf
very nice! this is so legit! =D i'mfollowing ya!
Thanks a lot, working on a few more for the near future :)
cool! please post pics and schematics of the stuff you make!
Great tutorial! More please :)
Nice! Have you looked at solid state relays? They are optically isolated and only need 5 volts at a few milli-amps to turn on. However most of them can only switch an AC load.
Yeah I actually have a desing with SSR's but at the load level the MR's can do you need a fairly large heatsink on them(so they arent rated as much as this one is), but they are great for PWM applications where adjustable speed or dimming capabilites are needed. I should put that design up too, thanks for the suggestion.

About This Instructable

14,517views

84favorites

License:

Bio: We are a small open source hardware electronics design and fabrication shop that specializes in arduino style projects, and interfacing the world around us. We ... More »
More by SparkysWidgets:How to Solder SMD ICs the easy way! Smart Relay Power Box(SiriProxy Compatible) 
Add instructable to: