Go Down

### Topic: Transistor Driven Relay (Read 849 times)previous topic - next topic

#### Mitchell Christensen

##### Feb 09, 2012, 05:02 pm
Hey,

I need to drive a relay from my Arduino, and I have the following design,

Here is the 2N5210 (NPN) Data Sheet http://www.fairchildsemi.com/ds/2N/2N5210.pdf.

According to the data sheet, I should expect the following,

hFE = 250; IC = 10mA, VCE = 5.0V
VCE(sat) = 0.7V; IC = 10mA, IB = 1.0mA
VBE(on) = 0.85V; IC = 1.0mA, VCD = 5.0V

Given all that, and the fact that the relay coil is 208 Ohms, I'm expecting the following:

IB = 2mA
ICE = 20mA

Am I even close?  I plan on building a bunch of these over the weekend, so any advice would be much appreciated.

-Mitch

#### mmcp42

#1
##### Feb 09, 2012, 05:11 pm
reverse diode across the relay coil to absorb the spike
there are only 10 types of people
them that understands binary
and them that doesn't

#### PeterH

#2
##### Feb 09, 2012, 05:13 pm
You need to add a flyback diode across the relay coil, otherwise the voltage spike when you switch it off will fry the transistor.
I only provide help via the forum - please do not contact me for private consultancy.

#### Mitchell Christensen

#3
##### Feb 09, 2012, 05:15 pm
Oh, of course.  Got it...thanks.

I'm most concerned bout my expectations around the current through the coil/transistor.  I need 13mA minimum to activate the coil.  I should be fine with 20mA, but I need to make sure I'm at least in the ballpark.

-Mitch

#### mmcp42

#4
##### Feb 09, 2012, 05:19 pm
the other question is what ddoes the relay say it needs?
there are only 10 types of people
them that understands binary
and them that doesn't

#### Mitchell Christensen

#5
##### Feb 09, 2012, 05:25 pm
Here is my updated schematic (adding the flyback diode).

Here is the data sheet for my relay http://www.pickercomponents.com/Data_Sheets/PC458_Data_Sheet.pdf.

The relay data sheet says 5V and 208 Ohms.  It doesn't say anything about current requirements so I called them and the guy told me it needs 13mA to operate.

Thanks so much for the help.

-Mitch

#### mmcp42

#6
##### Feb 09, 2012, 05:27 pm
looks good to go then
there are only 10 types of people
them that understands binary
and them that doesn't

#### PeterH

#7
##### Feb 09, 2012, 06:36 pm

The relay data sheet says 5V and 208 Ohms.  It doesn't say anything about current requirements so I called them and the guy told me it needs 13mA to operate.

By my reckoning, 5V through 208 Ohms results in about 25mA not 13mA. Perhaps that reply meant that the relay can be operated at a lower voltage than the nominal 5V. If it really only needs around 15 - 25mA, you could conceivably drive it directly from the Arduino as long as you have the flyback diode.
I only provide help via the forum - please do not contact me for private consultancy.

#### Mitchell Christensen

#8
##### Feb 09, 2012, 07:08 pm
My original design drove and optocoupler directly from pin 4 of an Atmega328P (Arduino UNO).  For some reason I could only get 13mA out of the Atmega chip (see http://arduino.cc/forum/index.php/topic,90600.0.html) when the pin was HIGH.  Since the opto I was using had a CTR of 50%, this wasn't nearly enough to operate the relay.  Try as I might, I just couldn't figure out the low-output current (i.e. 13mA on pin 4) problem so I decided to use a transistor approach and eliminate the opto completely based on comments from members of this forum.  With a transistor I only need a couple of mA out of pin 4 to drive the coil at 20mA.

This does feel like putting a bandaid over the real problem, but I am otherwise stumped.

-Mitch

PS Keep in my that I'm no longer using an UNO.  I have migrated to my own board design based on an Atmega328.

#### PeterH

#9
##### Feb 09, 2012, 08:35 pm

Try as I might, I just couldn't figure out the low-output current (i.e. 13mA on pin 4) problem so I decided to use a transistor approach and eliminate the opto completely based on comments from members of this forum.  With a transistor I only need a couple of mA out of pin 4 to drive the coil at 20mA.

OK, that does make sense. I don't know what the impedance characteristics of the Arduino output pins are, but you can't assume they can supply max voltage and max current at the same time. If they won't supply enough power to operate the relay, that isn't an option. In any case driving the relay via a transistor is the correct solution. It is more or less safe to assume that the chip won't drive any mechanical devices directly, but the current you were quoting seemed so low that I just had to ask the question.
I only provide help via the forum - please do not contact me for private consultancy.

Go Up

Please enter a valid email to subscribe