connect a 12V relay to the Arduino
To connect a 12V relay to the Arduino you need the following things:
- 1 Arduino
- 1 diode for example 1N4007
- 1 NPN transistor forexample 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
Step 1Measure 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.
Otherwiseyou 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 notimportant 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.
Step 2Calculate how much current will flow
The formula you need is asimple one:
(maybe people in England or the US know the Voltage as "V" but I will refer to it as "U" as we call it in here)
U = R * I
OK, but we want the current "I" right ? So just dividethrough the Resistance "R".
U = R * I / :R
I = U/R
For my relay that would be:
I = 12V / 400Ohm
I = 0.03 A => 30 mA (That is Ic)
The Arduino can handle up to 20mA but its better to usea transistor even if your current is only 20mA. So for 30mA you definitely need one.
Step 3Choose your transistor
First find the Datasheet of your transistor. For example search for "2N2222...
Leer documento completo
Regístrate para leer el documento completo.