12
\$\begingroup\$

I have 3 12VDC/40A automotive relays (datasheet) that I want to use with my Arduino. Based on the tutorial I am following (link) I need transistor, resistor, and diode. I am not an electrical engineer therefore I am unsure about the parts and calculations I made.

For the start, relay coil resistance is 90+-10% Ohm per datasheet. So I proceed by calculating the current flow.

Voltage=Resistance*Current

Current=Voltage/Resistance

Current=12V/90

Ohm Current = 133mA

For the transistor I can get 2N3904 or 2N4401. At this point I have to calculate resistance for the base of transistor. In tutorial its as following

hfe = Ic / Ib

Ib = Ic / hfe

Ib = 0.03 A / 75 Ib = 0.0004 A => 0.4 mA

R1 = U / Ib

R1 = 5V / 0.0004 A

R1 = 12500 Ohm

2N3904 datasheet states the H(fe) is 30-300 when lc = 100mA (mine is 130mA) and Vce = 1V. At this point I have no clue what is going on, thus I need help.

Edit: Here is what I ended up with. RLY1 in the picture is 12VDC/40A (link)

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I was also told that I can use opto-isolator instead of resistor and transistor. Comments? \$\endgroup\$ – jM2.me Sep 28 '13 at 17:09
10
\$\begingroup\$

Let's design for worst case, that is a good practice.

\$Ic = 133\text{mA}\$

\$h_{FE} = 30\$ # according to the datasheet minimum 30, typically much better; @Ic=100mA

You can calculate Ib now:

\$I_b = \dfrac{I_c}{h_{FE}} = \dfrac{133\text{mA}}{30} = 4.43\text{mA}\$

\$V_{BE,SAT} = 0.95\$ # datasheet, nearest match is 50mA. Maximum value, practical value is probably much lower (0.65V)

Now let's calculate the base series resistance. This is equal to the voltage across the resistor, divided by the current through it. The current through the resistor is the same as the base current. The voltage across it is the rail voltage (5V) decreased by the base-to-emitter voltage of the transistor V(CE,sat).

\$R_B = \dfrac{U_{R_b}}{I_b} = \dfrac{V_{CC} - V_{BE}}{I_B} = \dfrac{5 - 0.95}{4.43/1000} = 913\Omega\$

With all the worst case engineering up to here, for once let's just round it up to the nearest E12 resistor value of 1kΩ (or 820Ω for worst case engineering, it will work with either).

\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you. I am somewhat lost on last part, but I can see how it's done. Would you mind helping with diode? Can I use 1N4007? \$\endgroup\$ – jM2.me Sep 28 '13 at 17:39
  • 1
    \$\begingroup\$ Any 1N400n should be fine, but if you have to order diodes then I'd select faster ones. \$\endgroup\$ – jippie Sep 28 '13 at 17:52
  • \$\begingroup\$ Question. Why did you pick hFE value 30? Was it because Ic was closer to my actual Ic of 133mA? I want to replace 2N3904 with TIP102 and there are two hFE values for Ic 3A = 1000 and Ic 8A = 200. I assume I would go with hFE 1000 since 3A is closer to 133mA. Correct? \$\endgroup\$ – jM2.me Oct 4 '13 at 5:48
  • \$\begingroup\$ If I have done my calculations right, then in order to use same relay with TIP102, I will need 16kOhm resistor on the base o.O \$\endgroup\$ – jM2.me Oct 4 '13 at 5:54
  • \$\begingroup\$ @jM2.me Sounds correct given that your TIP102 has a much (much) higher gain than the 2N3904. \$\endgroup\$ – jduncanator Nov 22 '16 at 4:26
4
\$\begingroup\$

You are right in that the relay coil seems to need 133 mA nominal. However, that's not worst case, and that assumes 12 V is applied accross the coil. Nevertheless, that's a good place to start, then we'll throw in a factor of 2 margin later anyway.

Let's say the minimum guaranteed gain of the transistor you will use is 50. That means the base current needs to be at least 133 mA / 50 = 2.7 mA. If your digital output is 5 V, then there will be about 4.3 V accross the base resistor after accounting for the B-E drop of the transistor. 4.3 V / 2.7 mA = 1.6 kΩ. To leave some margin, use about half that. The common value of 820 Ω should be good.

Now check back to see what the digital output must supply. 4.3 V / 820 Ω = 5.2 mA. Many digital outputs can source that, but you need to check that yours can. If it can't, you need a different topology.

\$\endgroup\$
3
\$\begingroup\$

Since you are using the transistor in a saturated switching configuration it is OK if you pump more base current into the part than actually required for the amount of collector current that you intend to sink through the device from the relay coil.

That is a practical limit to the maximum base current that you can inject in the case of the 2N3904 / 2N4401. That limit is not always explicitly stated in the data sheets for the parts but I can tell you from experience it is in the 5->6 mA range.

For a switching design you may want to plan for the minimum guaranteed Hfe plus a margin. So lets say you pick 25 as the worst case working Hfe. With a needed collector current of 133mA and a Hfe of 25 will result in a working base current of 5.32mA. This seems to be in the OK area for these transistor types.

It appears that you intend to drive the base from a 5V signal. With a nominal Vbe of 0.7V that leaves you with a 4.3V drop across the base resistor. Resistance to limit current to 5.32mA at 4.3V is approximately 800 ohms. Use an 820 ohm standard value base resistor.

Final note. If you are driving this direct from an MCU output pin the MCU may not be able to source 5.32mA at 5V output level. As such the MCU output will drop down some from 5V. This will reduce the base current some but since we calculated using worst case Hfe the relay drive will still work for most transistors that you will pickup out of the bag.

\$\endgroup\$
2
\$\begingroup\$

You can certainly put more current into the base of a transistor than that implied by collector current requirements and \$h_{fe}\$. In fact you usually need to - this ensures that under all normal operating conditions the circuit will continue to work as expected.

There are limits though - the data sheet for the transistor might tell you that absolute maximum base current is (say) 50 mA - you don't really want to go that high if collector current requirements and \$h_{fe}\$ imply 50 \$\mu A\$. So choose 500 \$\mu A\$. This will likely cover all eventualities.

However you need to work out if the circuit driving the base can continuously supply the current you decide upon. Again, the data sheet will inform you and you don't want to sail too close to this number either else you might be reducing the chips reliability.

There's another consideration too. A lot of CMOS devices will state that there maximum output current is (say) 20 mA BUT they'll also state a maximum power current of (say) 100 mA. This is fine if the chip is driving 3 outputs but what if the chip is an octal buffer. Realistically check the current output per pin AND double check on the power supply current - there may be a limit on this that prevents all o/p pins pushing out 20 mA.

\$\endgroup\$
1
\$\begingroup\$

Ib = Ic / hfe (Fine)

Ib = 0.03 A / 75 Ib = 0.0004 A => 0.4 mA

Hmmm! Ic = .13 A not 0.03 and I would take hfe to be about 50, rather than 75. (generally the small signal transistors have at least this gain) This gives Ib = 0.0026 or 2.6mA

For a 5V input the voltage drop across the input resistor will be 5 - 0.6V = 4.4V (remember the base-emitter drop needs about 0.6V before the transistor is turned on.) This gives;

                Rb = 4.4/0.0026 = 1k7

Now this is really a maximum value for the base resistor so chose a standard value resistance below this say 1k5 or even 1k0.

\$\endgroup\$
0
\$\begingroup\$

I would like to share this link, it has good information on using microcontrollers to interface with real world electronics. Look at Part 7 of Microcontroller Interfacing Table of Contents

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.