New here, question about relays

Hello everyone, I have just finished the Getting Started with Arduino book and am planning the budget for my first project. As part of my project, I will need to individually control several 110v AC outlets that will be housed in a box. Since I plan to make several of these boxes if my prototype works out, I need to keep costs down. What is the cheapest and or the most cost effective way to control the 110v outlets with the Arduino Mega? Thanks for the help and suggestions!

Thanks for the help and suggestions!

I am not sure you will thank me but I would suggest not doing anything with mains for your first project. Mains can kill and cause fires if you don't know what you are doing. It is not very forgiving of mistakes.

That being said you can use a mechanical relay or a solid state relay (SSR) but what is important is the current rating of what you want to switch. I would always switch at the most 80% of what the current rating of your relay is.

As you don't say what you want to switch and what current it draws then specific advice is impossible.

(1) Be careful.

(2) Do some basic research: http://www.google.com/#q=arduino+relay

(3) Be careful.

(4) Work out the sizing of your relays based on what the loads will be. Look at the specs for those types of relays. I suspect you may not easily find a relay that can switch 20A @ 250V (a common spec) that has a 5Volt coil. In any event find a relay that switches your load.

(5) Design the circuit to drive its coil. Likely a small signal transistor can do the job.

(6) Be careful

Be careful.
If you're using a mechanical rely, don't forget the snubber diode.
Be careful.

I am siding with others in saying that anything with mains current is a bad idea as a first project. Unless you have prior experience with that sort of interfacing, it can be a hazardous undertaking. If you have -no- experience with mains current (ie, you haven't even hooked up a homemade lamp) - stop now, and concentrate on something a little closer to your experience level...

Something else to add:

Keep your small signals traces/wires well away from your mains current traces/wires. You don't want any possibility of accidental bridging of mains to the Arduino or other small signal areas. Remember to ground the case if its metal. It would also be advisable to implement a small fuse or resettable circuit-breaker on the mains side.

:slight_smile:

Thanks for the quick reply's everyone. Looking back, I should have been more specific about my background and project before asking a question so broad.

In the Marines I worked on airfield lighting when not performing my duties as an Aircraft Recovery Marine. I often worked with 440v AC with our Fresnel Lens Optical Landing System, as well as 220v lighting with our Tactical Precision Approach Path Indicators. I am familiar with working with relays (though no expert), but was looking for guidance on the best method with the Arduino.

For my project, I am wanting to build a nice fish tank controller with which I can switch on the power outlets for the pumps, heater, lights, powerheads, etc. Low voltage DC input SSR's seem to run around $15 USD from what I have seen so far, and I didnt know if there was a cheaper method that could be used since I plan to use six to eight of them per controller (I have a couple friends interested in controllers too if I can keep the costs down). Thanks again for the help!

On a side note, I have had the enjoyment of grabbing 220v DC not only once, but twice before. I tend to be very cautious with electricity these days... :o

You're not looking at the right place. A local surplus store will have relays for cheap. If you want to shop online and don't want ebay, here you go:

I bought a couple of relays from them. Didn't have time to test yet but everything else I bought works as they should.

http://dipmicro.com/store/index.php?act=viewCat&catId=527

You might want to check out this project: http://www.hydra-reef.com

My version is using an MCP23008 port expander to control some relays already packaged in an 8 port relay strip. It accepts a 12v control signal to activate the relays. I have a dedicated 12v supply across the transistors. When I apply 5v from the arduino through the port expander it allows the 12v signal to flow through the transistors, thus activating the relays.

The relay strip is here: http://www.guitarcenter.com/Chauvet-SR-8--Relay-Pack-103688057-i1384700.gc

It even has a DB9 serial connector on it for the connections to your setup. I detailed most everything in the thread listed on the project site. I also have pictures and a pin diagram I made for the serial connector here: http://s1011.photobucket.com/albums/af238/DustinsReef/Hydra/

Some great info, thanks everyone. I think I have enough info to proceed. I have ordered my Mega and will begin working on the sketch shortly, look for updates in the exhibition section in a couple weeks!

Thanks again,
-Mike