Tuesday, September 7, 2010

Simple Arduino SSR Controlled AC Extension Cord or Outlet

***Disclaimer***
Working with wall AC electricity is very dangerous. Make sure everything is unplugged while you are working on wiring. If in doubt, always assume it is live.

Also note: The relay I used does not "click" when it switches state, so do not use that as a test of whether your code it working or not.


Requires:

Arduino
Solid state relay (here's the one I used ~1.5 week delivery)
Small gauge wire
Electrical tape
Extension cord

Step 1: Strip a section of the extension cord so that two (or three if there's a ground pin) wires are showing. Sometimes the ground will also be a metal sheath around the other two wires. In this case the cord just has a hot and a neutral wire. The black is usually hot. The hot wire is the one which the relay is going to be wired to. If you wire it to the neutral wire, then if the relay's input is low, it doesn't mean that there is no electricity to the load, just no complete circuit through the wire.



Step 2: Cut the black wire to make two ends. Strip both ends to connect to the relay.



Step 3: Use a screwdriver to round the bare leads if desired, then screw them down to the two loads on the relay. Be sure to look at the datasheet for the relay to know which pin should come straight from the wall and which should go out to the load. The datasheet for the relay I used can be found here. It's an HFS15 made by Hongfa Technology.



Step 4: Use electrical tape or other insulation to be sure that all metal is covered. It would be very dangerous to leave the screw heads here exposed because anything conductive could bridge the two points and get zapped by 110 V.


Step 5: Use two short small gauge wires to connect to the input line of the relay. These wires will go to the arduino, so be sure they fit inside the connectors.



Step 6: Next task is to program the arduino and wire the relay to the arduino. The pins you plug your control lines to will of course change based on your programming. However you program it though, the ground of the input signal will go the "GND" pin on the arduino. The other wire will go to a digital I/O pin. When the pin is set to HIGH it will turn on the flow of electricity to the load. When it's turned to LOW or if the arduino loses power, it will turn off the flow of electricity.



I admit, it looks really ugly. I may get a project box or something to put all the connections in to make it water proof and neater.


I am using this to control lights and water for my aeroponics system so that if I'm gone for a weekend I don't need to have someone come over and babysit my plants. That being said, the code I wrote is very bad and basic. It gets the job done but is definitely not my final code.

10 comments:

  1. very interested in this project!!!have things progressed?

    ReplyDelete
    Replies
    1. Things have gone very well! I now have all the electronics nicely encased in a box, and I have set up the aeroponics system with my mother who is an avid gardener and now enjoys fresh herbs even in the winter without having to go outside.

      Delete
  2. Good one man. Thanks for the info :) Simple things like this can be so helpful for many people. Again, Thank for sharing.

    ReplyDelete
  3. AUS/NZ Power Cable 3-pin Plug Extension Cord
    Regular Australian or Brand-new Zealand mains 3-core power cord. Normally used in homes to supply mains electric power around different plans.

    For details : http://www.dueltek.com.au/pages/power-cables

    ReplyDelete
  4. LOVE U!!!!!... looks very easy, it doesnt matter right either number 3 or 4 SSR connected to GND and no resistor required right?... Maybe can hook up with a heat sink to dissipate unwanted heat

    ReplyDelete
    Replies
    1. My bad... number 4 got -ve so must connect it to Gnd, and number 3, connect to any Digital Pin on Arduino right?

      Delete
  5. I found your blog very useful and informative. Thanks for sharing.
    Protector Extension Lead Strip

    ReplyDelete