Please help me understand relays

I have a small project where i built a arduino on a breadboard to run a motion sensor then kick on some lights when it detects motion. the entire project is powered by a wall wart 12vdc 500mA. The breadboard's power strip on one side has the power regulated down to 5v with a LM7805 to supply power to the motion sensor and the chip and then I have the other side of the breadboard powered with 12v to supply power to the lights. The lights i plan on using are 12v 65mA and I will have 4 lights. Right now the signal from the (ATmega328) kicks on a mini relay I got at Radio Shack that is 12v1A.

I think this is the link to the right relay. http://www.radioshack.com/product/index.jsp?productId=2062481#

I have a couple issues with the relay as it clicks really loud when it is triggered and it's leads are really small and do not go into the breadboard very well so i am looking for an alternative. I really don't know much about electronics so i need help with what relay i need or can use and what all the ratings mean. I tried looking up some relays on DIgikey and Mouser but with all the filter options i didn't know what i needed. Can someone please help me with what these values tell me about a relay? Contact Rating @ Voltage; Coil Current; Coil Voltage; Control On Voltage (Max); Control Off Voltage (Min)?

I am also interested in reed relays or solid state relays as they look like they will work better in a breadboards...

Any tips or help is greatly appreciated...

-H-

Can someone please help me with what these values tell me about a relay? Contact Rating @ Voltage;

The purpose of a relay is to control an external circuit through the contacts of the relay. All relay contacts have a maximum voltage and maximum current they can switch reliably. Exceeding these ratings will result in contact burning, arcing, and in some case welding closed. You can use contact ratings well above what you are actually going to use in your external circuit. Note that some contact ratings for current are different if the current is DC Vs AC, but the datasheet for the relay will specify if that is the case.

Coil Current; Coil Voltage;

Relays are designed so that they work at a nominal standard voltage and AC or DC. You simply have to select a relays coil voltage to match what voltage you have avalible to work with. Common values are 5vdc, 6,12,24,48 volts in both AC or DC voltages. Each relay model will have a specific current draw when wired to it’s rated voltage. It’s value will be given in it’s datasheet. Sometimes instead of giving the coil current rating it will give the coil’s resistance, and one can calculate the coil current draw by coil volts / resistance in ohms = current in amps. Note that there are avalible simple small +5vdc reed relays that can be driven directly from an arduino output pin as their coil resistance is high enough to keep their current requirement around 10-12ma. Example:

Control On Voltage (Max); Control Off Voltage (Min)?

If a relay coil is rated as a 5vdc relay, what is voltage less then 5vdc that it will still turn on at?

If a relay coil voltage is reduced from 5vdc towards 0vdc, at what voltage will it switch off at.

These last two specs are not all that important in most arduino applications as one is usually applying the full coil voltage or no coil voltage, so these voltage threshold type specs are not something you have to be too concerned with.

Lefty

Thanks for the reply Lefty but i am still a little fuzzy about some things. I created the circut by reviewing some similar project online but i really dont understand how it works or why we put things where we did. I attached this pic to help our discussion.

So in the pic Number 1 is one side of the coil and gets the signal from the arduino. I believe the signal is 5vdc? The signal comes out of the Arduino, through the resistor, through the Transistor and onto the #1 side of the coil in the relay where there is also a diode connected.

So number 2 in the pic is the other side of the coil and it is connected to 12vdc and the other side of the diode.

Number 3 is connected to ground of the 12vdc.

Number 4 is not connected to anything

Number 5 is connected to the Ground side of my lights where the hot side of my lights are connected to 12vdc. (the other 2 wires coming from the lights wire are not connted to anything, i just used a old wire i had

Okay… here are my questions…

  • Since #2 of the coil is connected directly to 12V+ then is the signal from the arduino really connecting the other side of the coil to the ground side?

  • Why does the #2 side of the coil have to be hooked up with a diode and not just directly connected to the 12v+? I understand that the diode keeps a surge from getting to my ATmega but not really how.

  • Why are the transistor and resistor needed and how do i figure what values for these componets? If the amps I will draw change will these values also need to change?

  • So if i need a relay and the item I need to turn on is 12v and will draw around 260 mA then I need a 12v relay rated at at least around .5 amps???

  • So really simply what I believe is happening is that the lights are hooked up to 12v+ and when the relay is tripped it provides the ground side of the connection for the lights to work?

Any other tips or suggestions on what relay I should use for my circut are welcomed… Anyting else you think i may need to know is also appreciated and valued…

Thanks again

PS - how do i insert an image?

Relay.jpg

  • Since #2 of the coil is connected directly to 12V+ then is the signal from the arduino really connecting the other side of the coil to the ground side?

When the transistor is turned on then that is the source of ground for that end of the coil, from ground throught the emitter lead to the collector lead and onto the coil. What you are missing is a wire going to the negative terminal (ground) of your +12vdc supply to a arduino ground pin. That is required for the transistors base current to flow back to the arduino when the arduino output pin is commanded on (+5vdc).

  • Why does the #2 side of the coil have to be hooked up with a diode and not just directly connected to the 12v+? I understand that the diode keeps a surge from getting to my ATmega but not really how.

When a coil is turned off the magnetic field collapes causing a reverse voltage spike. Having a diode wired right across the coil terminals allows the spike to be clamped and discharged through the resistance of the coil. Otherwise this voltage spike can damage the transistor and in some cases the arduino output pin. Note that the #2 relay coil terminal wires directly to both +12vdc and the cathode lead of the diode.

  • Why are the transistor and resistor needed and how do i figure what values for these componets? If the amps I will draw change will these values also need to change?

The transistor is required because you are using a relay coil that requires +12vdc to turn on. An arduino output pin has only a +5vdc output so it can't directly power the relay coil. The transistor is used as an external switch controlled by the arduino +5vdc output pin, allowing the transistor to switch the current on and off to the coil. The transistor is selected that has voltage and current rating above that required by the relay's coil. This has no bearing on the voltage and current draw you will be using on the relay's switching contacts, that is a seperate specification of the relay and has no bearing on the transistor selected. The base resistor have to be able to allow enough current to flow through the transistor's base such the transistor turns on fully. 220 to1,000 ohms are common values to use

  • So if i need a relay and the item I need to turn on is 12v and will draw around 260 mA then I need a 12v relay rated at at least around .5 amps???

When one says a "12 volt relay" that implies a relay with a coil voltage of +12vdc rating, that is seperate from what voltage level and current rating the relay's contacts can handle, that is again a seperate rating and should be well above the voltage and current demands of the device you are controlling. Many 12 volt relays have contact ratings that can handle up to 120/220 volts AC and up to many amps.

  • So really simply what I believe is happening is that the lights are hooked up to 12v+ and when the relay is tripped it provides the ground side of the connection for the lights to work?

Correct, the switch contacts complete a circuit connection from your external power's ground to the device being controlled on then onto +12 volts. Remember the purpose of a relay is so there is complete isolation for the thing controlling to coil to the circuit you are controlling from the contacts.

Any other tips or suggestions on what relay I should use for my circut are welcomed... Anyting else you think i may need to know is also appreciated and valued...

Following you picture is a little difficult, it's always better to be working with a proper schematic drawing. Here is a drawing showing the proper wiring for a arduino controlled relay. Note that they don't show the external contact wiring to the device being controlled by the relay's contacts, it's assumed you know how to handle that part. Note the wire connection from the arduino ground pin to the transistor emitter lead and onto the ground of the relay power supply. That connection is often not made by newcomers and is required.

http://arduino.cc/playground/uploads/Main/relays.pdf