[Confused] Calculation for Transistor

MikeML

Joined Oct 2, 2009
5,444
...I would like to ask can I control a relay using this circuit? The relay has 60 ohm resistance...
If you are going to drive a 60Ω relay, then why did you leave the 10Ω resistor in place? You have effectively reduced the current that the transistor is switching from E/R = 5/10 = 500mA to 5/(10+60) = 71mA. What does that do the base current requirement and R3?
With the 10Ω left in place, you are wasting 10/60 of the voltage that would otherwise appear across the relay coil?

When you switch a relay, the inductance of the relay coil becomes important because you have a RL time constant when switching the relay on. You also store energy in the inductance that does bad things to the transistor as you switch the relay coil off. You must add a "snubber" (sometimes called "catch") diode around the relay coil to prevent killing the switching transistor with the huge inductively induced voltage spike that would otherwise happen as the transistor turns off.

Here is a case when a time-domain transient .tran simulation is appropriate. I have modeled the dynamic behavior of the relay coil as an inductor which has your specified 60Ω resistance but I added ~90mH of inductance. If you know, or have a way of measuring the actual coil inductance, then use your number. 90mH is a guess that comes from experience.

I have modified the simulation such that the independent variable is time. I changed V2 into a pulse generator that emulates a port-pin. Also based on my experience, I selected a pulse duration to switch the relay which is about as fast as a small relay can be expected to switch on/off. Large relays could not follow a pulse this short...

I selected a fixed value of R3 that I guessed would provide sufficient base current to Q1 because now its maximum Ic is E/R = 5/60 = 83mA. Lets see how I did?

209t.gif

First, look at the timing of V2 (red trace). It turns on at 1ms and off at 14ms.

Note the current through the relay coil (yellow trace). It shows a RL time-constant both turning on and turning off. The peak current reached is ~83mA, just as predicted. Note the voltage at the collector V(c) blue trace. When the transistor is on, it settles to a "saturated" voltage of about 0.1V, meaning there is 5-0.1 = 4.9V across the relay coil. Now look at what happens when the transistor turns off at 14ms. I will let you explain what is causing V(c) to jump ~0.7V above the 5V supply voltage, dwell there for ~7ms before finally settling back to 5.0V.

Finally, look at I(R3) green trace. With R3=470Ω, the current sourced by the port pin is ~5mA. Q1 is asked to switch 83mA with a base current of ~5mA. Do you think that is enough? How do you tell?
 

Thread Starter

sdas86

Joined Mar 18, 2015
26
If you are going to drive a 60Ω relay, then why did you leave the 10Ω resistor in place? You have effectively reduced the current that the transistor is switching from E/R = 5/10 = 500mA to 5/(10+60) = 71mA. What does that do the base current requirement and R3?
With the 10Ω left in place, you are wasting 10/60 of the voltage that would otherwise appear across the relay coil?

When you switch a relay, the inductance of the relay coil becomes important because you have a RL time constant when switching the relay on. You also store energy in the inductance that does bad things to the transistor as you switch the relay coil off. You must add a "snubber" (sometimes called "catch") diode around the relay coil to prevent killing the switching transistor with the huge inductively induced voltage spike that would otherwise happen as the transistor turns off.

Here is a case when a time-domain transient .tran simulation is appropriate. I have modeled the dynamic behavior of the relay coil as an inductor which has your specified 60Ω resistance but I added ~90mH of inductance. If you know, or have a way of measuring the actual coil inductance, then use your number. 90mH is a guess that comes from experience.

I have modified the simulation such that the independent variable is time. I changed V2 into a pulse generator that emulates a port-pin. Also based on my experience, I selected a pulse duration to switch the relay which is about as fast as a small relay can be expected to switch on/off. Large relays could not follow a pulse this short...

I selected a fixed value of R3 that I guessed would provide sufficient base current to Q1 because now its maximum Ic is E/R = 5/60 = 83mA. Lets see how I did?

View attachment 85742

First, look at the timing of V2 (red trace). It turns on at 1ms and off at 14ms.

Note the current through the relay coil (yellow trace). It shows a RL time-constant both turning on and turning off. The peak current reached is ~83mA, just as predicted. Note the voltage at the collector V(c) blue trace. When the transistor is on, it settles to a "saturated" voltage of about 0.1V, meaning there is 5-0.1 = 4.9V across the relay coil. Now look at what happens when the transistor turns off at 14ms. I will let you explain what is causing V(c) to jump ~0.7V above the 5V supply voltage, dwell there for ~7ms before finally settling back to 5.0V.

Finally, look at I(R3) green trace. With R3=470Ω, the current sourced by the port pin is ~5mA. Q1 is asked to switch 83mA with a base current of ~5mA. Do you think that is enough? How do you tell?
Dear Mike,
Wow, that is a very detailed explanation. For the questions you asked:
1. I will let you explain what is causing V(c) to jump ~0.7V above the 5V supply voltage, dwell there for ~7ms before finally settling back to 5.0V.
Answer: There are energy stored in the coil after the power is turn off. The energy in the coil will discharge through the diode D1 for approx. 7ms before settling back to 5V. Am I correct?

2. Do you think that is enough? How do you tell?
Answer: This question I am not too sure. I try to answer it here. For nominal operation, the base current should be 1/10th of collector current. So:
Ib= 83mA x 1/10 = 8.3mA

Based on simulation, the current at I(R3) = Ib is less than 4.9mA. My answer is that this current is insufficient. Am I correct?

Thanks. :)
 

MikeML

Joined Oct 2, 2009
5,444
...For the questions you asked:
1. I will let you explain what is causing V(c) to jump ~0.7V above the 5V supply voltage, dwell there for ~7ms before finally settling back to 5.0V.
Answer: There are energy stored in the coil after the power is turn off. The energy in the coil will discharge through the diode D1 for approx. 7ms before settling back to 5V. Am I correct?
Yes, and the collector voltage is clamped at one diode drop above Vcc (5V). If you simulate this, plot the current through D1. Notice its peak magnitude.

2. Do you think that is enough? How do you tell?
Answer: This question I am not too sure. I try to answer it here. For nominal operation, the base current should be 1/10th of collector current. So:
Ib= 83mA x 1/10 = 8.3mA

Based on simulation, the current at I(R3) = Ib is less than 4.9mA. My answer is that this current is insufficient. Am I correct?
Depends on who you believe? If you believe me, it is good enough. If you are extremely conservative, then reduce the resistance of R3 a bit more...
 

Thread Starter

sdas86

Joined Mar 18, 2015
26
Yes, and the collector voltage is clamped at one diode drop above Vcc (5V). If you simulate this, plot the current through D1. Notice its peak magnitude.
Depends on who you believe? If you believe me, it is good enough. If you are extremely conservative, then reduce the resistance of R3 a bit more...
Dear Mike,
I believe your guide is correct. I am going to test it out on my hardware now to see if it solve my problem.
Thanks for all the help.
 
Top