Connecting a 12V relay to Arduino

Connecting a 12V relay to Arduino
To connect a 12V relay to the Arduino you need the following things:

- 1 Arduino

- 1 diode for example 1N4007

- 1 NPN transistor for example 2N2222 (in the US) or BC548 (in Europe)

- 1 relay for example one with coil voltage 12V and switching voltage 125VAC/10 A

- 1 multimeter
 
Remove these adsRemove these ads by Signing Up
 

Step 1Measure the coil resistance

Measure the coil resistance
We are going to measure the coil resistance to calculate the current.

First we must find the coil:
On some relays the pins are labeled so you can just measure at pin 2 & 5.


Otherwise you have to measure at every pin:

Between two pins you should have between 100 and 10 000 Ohm. Remember that value. That are the two terminals of the coil. The coil is not polarized so its not important which one goes to V+ or GND.

If you have found those there are only three left. Between two should be a connection (if you measure a few Ohm its okay but everything above 50Ohm is too much). One of them is NC and one is COM. To find out which is which let one probe connected and connect the other to the pin that’s left over. If you connect the coil to 12V DC it should make a clicking noise. If your multimeter now shows a low resistance you have found COM and NO. The one probe you didn't move is COM the other is NO.
« Previous StepDownload PDFView All StepsNext Step »
23 comments
Nov 6, 2011. 8:20 PMgamingman says:
Major point: Make sure you connect the 12V ground to the Arduino ground, or it will not work.
Feb 23, 2011. 8:20 PMgabriel.hahmann says:
I'm using a 5v relay and It is not working. By mistake I bought a 2N2222A, wich I saw on the datasheet had a Vebo of 6V, could you tell me if these is the problem? Congratulations for the great howto!
Nov 25, 2009. 10:56 AMthecageybee says:
Hi there.   Brilliant post.   Very informative, the formulas you have provided have been very helpful, as without them I'd of just been blindly putting components together.  Likely with disastrous results.

I've got a couple of questions for you though.

First the easy one.  Could you explain the formula in step 5.  What is "U_L", "L", "delta i" and "delta t"?  Where do I find their values in regards to the components I'm going to use.  Just not sure if it matters what rating diode I use, or if it's merely mathematical proof that I will need a diode and any diode will do.

Lastly, I'm going to be applying this for a project of my own, but want to make sure I can get the relay circuit working before I get an Arduino.  Can I simulate the arduino by applying a 5v positive to where the arduino would go, with the negative to ground in the circuit?

Again, many thanks for this guide, and thanks for any help you can give me.

Regards,
The Cageybee
Nov 25, 2009. 12:37 PMthecageybee says:
Oopps!  'mybad.  Need to read the whole of the post.   Second question answer in step 7.

Appologises!  :-)
 The Cageybee
Jan 19, 2009. 7:44 AMDecypher4 says:
Why are you using a 12V excitation relay with the Arduino? 5V excitation SSRs that can handle a 120V 40A AC load are cheap and readily available. Did you just have a 12V relay laying around?
Sep 9, 2009. 1:56 AMDoom2099 says:
SPDT 5v amp realy $5.08 radioshack direct2U order
Jan 19, 2009. 3:14 PMDecypher4 says:
I guess it also depends on your definition of cheap.

This one is $15.00 US

http://www.allelectronics.com/make-a-store/item/SSRLY-42/40-AMP-SOLID-STATE-RELAY/1.html

There are a bunch here too. There's a million different options to sort through, and I've seen them as cheap as $9.00 US.

http://search.digikey.com/scripts/DkSearch/dksus.dll?Cat=1048664&keywords=solid%20state%20relay

Happy hunting.

Cheers
Aug 15, 2009. 5:17 PMandrew101 says:
well i can get a 12 volt relay with 2 seperate switches for 4 $ canadian at my local ripoff store. i suppose i could get them cheaper online but its eaiser to buy them there.
Jan 21, 2009. 7:25 AMDecypher4 says:
That's cheaper than 9 bucks. Good instructable.
Aug 15, 2009. 5:15 PMandrew101 says:
cool. i made oneawhile ago that i can trigger thru serial to turn on and off some relays. i didn't realise i should add a diode. good tip :)
Jun 29, 2009. 10:40 AMjtbz76 says:
I made this circuit and when the 5v signal from arduino is off the the relay stays on until the 12 volts is disconnected. Its like the transistor is staying on. Any hints??
Jun 29, 2009. 9:24 PMjtbz76 says:
Nope i didnt pay attention that the diagram said view from bottom so i had the emitter and collector reversed. works great thanks!!!
Feb 17, 2009. 2:23 PMinane says:
Can I do without the transistor? I have a reed relay that claims a nominal current of 20mA...shouldnt the Arduino be able to drive it directly?
Jan 20, 2009. 5:31 PMruss_hensel says:
Microwave ovens ( the control panel ) usually have this type of relay ( more or less ) sometimes 3 of them. Coil voltage typically 12 or 24 volts. Voltage need not be very exact or regulated. Cost normally 0, priceless if you manage to kill yourself on the high voltage.
Jan 19, 2009. 2:02 PMRCURV says:
super useful, I'm planning a sub project an this is just the thing
Jan 18, 2009. 4:57 PMjoejoerowley says:
Great! I was just looking for something like this! Thanks, Joe
Jan 18, 2009. 12:07 PMBongmaster says:
usefull :)

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
4
Followers
2
Author:homunkoloss