3
\$\begingroup\$

I'd like to know what would be the best resistor values for R5,R6,R7 at the PNP and NPN transistors, if I want to use the circuit below. Assume the LEDs Vf =2V at 20mA.

Will the circuit values I have below be good enough to make it work? I think maybe using R6=1k, R7=1K and R5=10K will make the circuit better.

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ Yes, you can do it that way and I think you have figured out values that will work. But with 16 V of available overhead, why not use an active current source? You've plenty of control overhead voltage for it and it would be more generally reliable and useful. You'd never need to again adjust resistor values when throwing LEDs at the circuit. (Still, the 800 Ohm resistor will be effective, given all of the voltage overhead you are exchanging there. Don't get me wrong. Your circuit is fine.) \$\endgroup\$
    – jonk
    Aug 23, 2021 at 1:29

4 Answers 4

9
\$\begingroup\$

Resistor Regulation

Your drawn schematic (not your proposed values) is fine enough. The regulation is about like this:

$$\begin{align*} \%\,I_{_\text{LED}}&=-\%\,V_{_\text{LED}}\cdot \frac{1}{\frac{V_{_\text{CC}}}{V_{_\text{LED}}}-1} \end{align*}$$

In this case, you have four \$2\:\text{V}\$ LEDs, so \$V_{_\text{LED}}=8\:\text{V}\$ in the above equation. This means that you'd get a -5% change in current for a +10% change in the summed LED voltage. And that's probably adequate. That's why I said it was fine as it was.

However, if you wanted to swap in four white \$3.3\:\text{V}\$ LEDs now, then this is a +65% change and you should expect a -33% change in the LED current. So it's not so good, in that regard. You'd have to recalculate \$R_8\$ and replace it.

Drawn Schematic and Written Values

These work out fine. Your \$R_5\$ and \$R_7\$ wind up being a resistor voltage divider with \$R_{_\text{TH}}\approx 910\:\Omega\$ and \$V_{_\text{TH}}\approx 21.8\:\text{V}\$. Give the emitter at \$24\:\text{V}\$ and an estimated \$\mid V_{_\text{BE}}\mid\approx 750\:\text{mV}\$, the base current is \$\frac{24\:\text{V}-21.8\:\text{V}-750\:\text{mV}}{910\:\Omega}\approx 1.6\:\text{mA}\$. And that's more than fine enough for a collector current of \$20\:\text{mA}\$.

Your written replacements would be \$R_{_\text{TH}}\approx 910\:\Omega\$ and \$V_{_\text{TH}}\approx 2.2\:\text{V}\$ (maybe slightly higher depending on the I/O pin driver BJT saturation voltage.) This would mean a great deal more base current -- far more than needed. And it would require more base drive current compliance from your I/O pin.

It can work. But I don't see the need to go there.

Current Regulation Approach

If you are interested in something that will just work right regardless of the LED type, then try this:

schematic

simulate this circuit – Schematic created using CircuitLab

You can substitute almost any LED type in there, mix or match. Doesn't matter. And you won't need to recalculate and replace a resistor if you change LED types.

\$\endgroup\$
2
  • \$\begingroup\$ @Citi If you want to read up on this current regulation circuit of Q1 and Q2, search for current mirror. \$\endgroup\$
    – Aaron
    Aug 23, 2021 at 13:33
  • 1
    \$\begingroup\$ @Aaron What I wrote isn't a current mirror. But just see my link here for the details of what it actually is and how to design it. \$\endgroup\$
    – jonk
    Aug 23, 2021 at 17:19
4
\$\begingroup\$

I would increase R5 to 10 K. It's function is to assure a crisp turn-off of Q3. To do that, it doesn't have to be such a low value. That low value shunts current away from the base-emitter junction, decreasing the "firmness" of Q3's saturation.

Other than that, all good.

UPDATE:

4574 mentions a "required" current in R5, but gives no justification for this idea. And frankly, I don't know what he is talking about.

When Q4 is off, there still is a very small leakage current through it. R5 prevents this current from going through the Q3 base-emitter junction. Keep in mind that the Q4 and Q5 combine for a possible gain of over 10,000. That is enough for very very small currents to actually do something.

Also, his math supports something called "dangle-biasing", where resistors are chosen based on the minimum current required for the beginning of saturation. This is the worst way to design a saturated switch. The problem is that the open-loop gain of a transistor varies significantly with temperature, age, collector current, and from part-to-part do to production process variations.

The standard rule of thumb for a transistor acting as a saturated switch is that the base current be 1/10th of the switched collector current. So for an LED current of 20 mA, you want a base current of 2 mA in Q3. This is the collector current in Q4, so its base current wants to be around 200 uA. With these current values and a generic Vbe of 0.6 V, you can calculate R6 and R7.

The rule comes from the 1950's, when transistors had much lower gain and higher leakage, which is why I think it is a bit heavy=handed for today's components, so I see those calculations as the maximum currents needed. Still, it is a well-understood starting point.

From here, other factors enter. Making all three resistors the same value is a benefit in a production environment: lower inventory and purchasing costs, less setup time for placement robots, or fewer errors if hand-placed, etc. If system power is an issue, reworking the calculations based on a ratio of 1:20 instead of 1:10 saves current without noticeably affecting the voltage across Q3 when on (Vcesat). Note that Q4 is only driving Q3, not the load, so it does not have to be super-ultra-wonder saturated.

Back to R5 - A good starting point is that it is 10x R7. However, the larger it is, the more slowly Q3 will turn off. We don't know what the LEDs are doing, or if their turn-off time is critical, so this might not be an issue. Similarly, R6 affects the turn-on and turn-off times for Q4. A large value for R6 might be great for power savings, and work fine for the currents in the circuit, but work against you in switching performance. Life is choice.

\$\endgroup\$
3
  • \$\begingroup\$ But changing R5=10k, according to user4574, I'll need to change R7 as well \$\endgroup\$
    – Citi
    Aug 23, 2021 at 2:48
  • \$\begingroup\$ See my answer update. \$\endgroup\$
    – AnalogKid
    Aug 23, 2021 at 12:32
  • \$\begingroup\$ I had intended to say R7 current, not R5. Thanks for spotting my error. 195uA + 0.6V/10K = 255uA (with VBE = 0.6V). \$\endgroup\$
    – user4574
    Sep 8, 2021 at 5:13
2
\$\begingroup\$

The original values will work just fine.

If the LEDs are red (worst case), their forward voltage will be about 2 volts. If Q3 is fully turned on, with negligable voltage drop, the LEDs will drop 8 volts, leaving 16 volts across R8. Since R8 is 800 ohms, LED current, and Q3 collector current, will be 20 mA.

When used as a switch, a good design goal will assume a gain of 10. 20 will often work, but 10 is a good, solid conservative number. This means that the base current of Q3 should be about 2 mA. If Q4 is fully turned on, you'll get about 2.3 mA through R7 (23 volts divided by 10k), so R7 should work just fine.

This in turn means that the base current for Q4 should be at least 0.2 mA.(Gain of 10, remember?). Assuming about 1 volt drop across the base-emitter junction of Q4, that leave 4 volts across R6, for a base current of 0.4 mA, which is twice as much as it needs.

Would your proposed changes be better? Define better. 20 mA of base drive will turn Q3 on harder, but the change in collector-emitter voltage simply won't change much - it's already turned on hard. Power dissipation in R7 will go from about .05 watts to 0.5 watts, and that will require a heftier resistor to handle the power.

Current required from the IO port will increase from about 0.4 mA to 4 mA. As far as I know, this is well within the abilities of a PIC GPIO pin.

I expect your proposed changes will work, but I don't see how you will gain anything by making them, and you will increase the current levels associated with the driver. Frankly, I don't see any practical advantage.

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

The values you have would appear to work.

Assuming the 2N2907 transistor saturates at about 0.4V VCE then the current through the LEDs is about...

(24V - 0.4V - 4*2V) / 800 ohms = 19.5mA.

So R8 = 800 ohms is just about right for 20mA.

In the range you are using it the 2N2907 has a gain of about 100. To get 19.5mA out of the collector you are going to need 19.5mA / 100 = 195uA of base current.

(SEE 2N2907 DATASHEET)
https://www.onsemi.com/pdf/datasheet/p2n2907a-d.pdf

If the base emitter voltage of Q3 is about 0.6V then you have another 600uA of required current that needs to flow in R7 in order to turn on the Q3.

The saturation voltage on the 2N2222 is going to probably be less than 0.3V in the range you are operating it at.

(24V - 0.6V - 0.4V) / (600uA + 195uA) = 29K ohms

Anything less than 29K ohms will work fine for R7. Picking something a bit smaller, offers some safety margin. Your value of R7 = 10K probably a good pick with R5 = 1K.

But note that if R5 were increased to say 10K ohms then the required R5 R7 current drops down to 255uA and you could probably use a 49.9K resistor for R7, which would save 50mW or so. That might not sound like much, but its a 10% efficiency gain in this circuit.

R6 = 10K is a good choice, but R6=100K would also work well and save 1 or 2 mW of power.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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