Forums

Transistor as a current limiter

Started by Lauri Alanko July 5, 2013
Hello.

I need to wire some leds, and I figure that a transistor for each
series is a good way to ensure that the leds get constant current,
with the additional benefit that I can run PWM through the base of the
transistor to control the brightness.

However, I'm unsure about the best way to do this. The most common
design I see is this:

V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND
                  -----
                    |
                   V2

That is, Q1 is NPN, and the load is connected to its collector, V2 to
the base, and R1 to the emitter. This limits the collector current to
about:

Ic = (V2 - Vbe) / R1 

I see how this works, but adding a resistor under the load seems
to increase the minimal voltage dropout (and thus lower the maximum
current limit) unless V2 is very low. Another approach is the following:

V1 ---- LOAD ---- \Q1-> ---- GND
                  -----
                    |
           V2 ---- R1

That is, we just limit the base current directly. Here the collector
current is:

Ic = beta ((V2 - Vbe) / R1)

This seems better to me. We can use an arbitrary voltage at V2 (a 5V
PWM signal should be fine), and the minimum dropout is just the
transistor's Vce at saturation.

However, I haven't seen the second circuit anywhere. Is there some
non-obvious problem with it?

Thanks,


Lauri
On Fri, 5 Jul 2013 16:31:43 +0000 (UTC), Lauri Alanko <la@iki.fi>
wrote:

>Hello. > >I need to wire some leds, and I figure that a transistor for each >series is a good way to ensure that the leds get constant current, >with the additional benefit that I can run PWM through the base of the >transistor to control the brightness. > >However, I'm unsure about the best way to do this. The most common >design I see is this: > >V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND > ----- > | > V2 > >That is, Q1 is NPN, and the load is connected to its collector, V2 to >the base, and R1 to the emitter. This limits the collector current to >about: > >Ic = (V2 - Vbe) / R1 > >I see how this works, but adding a resistor under the load seems >to increase the minimal voltage dropout (and thus lower the maximum >current limit) unless V2 is very low. Another approach is the following: > >V1 ---- LOAD ---- \Q1-> ---- GND > ----- > | > V2 ---- R1 > >That is, we just limit the base current directly. Here the collector >current is: > >Ic = beta ((V2 - Vbe) / R1) > >This seems better to me. We can use an arbitrary voltage at V2 (a 5V >PWM signal should be fine), and the minimum dropout is just the >transistor's Vce at saturation. > >However, I haven't seen the second circuit anywhere. Is there some >non-obvious problem with it? > >Thanks, > > >Lauri
The first way is best. Relying on Beta is called (appropriately) suicide bias. Certain prima donnas here will disagree.... it's not their circuit that will fry. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
"Lauri Alanko" <la@iki.fi> schreef in bericht 
news:kr6sdf$nah$1@oravannahka.helsinki.fi...
> Hello. > > I need to wire some leds, and I figure that a transistor for each > series is a good way to ensure that the leds get constant current, > with the additional benefit that I can run PWM through the base of the > transistor to control the brightness. > > However, I'm unsure about the best way to do this. The most common > design I see is this: > > V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND > ----- > | > V2 > > That is, Q1 is NPN, and the load is connected to its collector, V2 to > the base, and R1 to the emitter. This limits the collector current to > about: > > Ic = (V2 - Vbe) / R1 > > I see how this works, but adding a resistor under the load seems > to increase the minimal voltage dropout (and thus lower the maximum > current limit) unless V2 is very low. Another approach is the following: > > V1 ---- LOAD ---- \Q1-> ---- GND > ----- > | > V2 ---- R1 > > That is, we just limit the base current directly. Here the collector > current is: > > Ic = beta ((V2 - Vbe) / R1) > > This seems better to me. We can use an arbitrary voltage at V2 (a 5V > PWM signal should be fine), and the minimum dropout is just the > transistor's Vce at saturation. > > However, I haven't seen the second circuit anywhere. Is there some > non-obvious problem with it? > > Thanks, > > > Lauri
There is a problem and it is obvious. The beta of a transistor is not a parameter you can rely on. Look at the datasheet of any transistor and you will find the beta given in a range. The beta of an ordinary 2N3904 for instance may vary between 30 and 300. Depending on the manufacturer you may find other values. Another important property is temperature dependency. Without the right measures the current through a transistor may increase due to rising of the temperature. This will increase the dissipation so the transistors temperature will rise further and so on. In your first proposal this problems are prevented due to the resistor in the emitter circuit which provides the necessary negative feedback. The behaviour of the second schematic is practically unpredictable except that sooner or later it will fry itself. So with the right circuit you can set the maximum load current by R1 and V2 as by the formula you wrote down. PWM is done by switching V2 on and off. petrus bitbyter
On Fri, 5 Jul 2013 16:31:43 +0000 (UTC), Lauri Alanko <la@iki.fi>
wrote:

>Hello. > >I need to wire some leds, and I figure that a transistor for each >series is a good way to ensure that the leds get constant current, >with the additional benefit that I can run PWM through the base of the >transistor to control the brightness. > >However, I'm unsure about the best way to do this. The most common >design I see is this: > >V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND > ----- > | > V2 > >That is, Q1 is NPN, and the load is connected to its collector, V2 to >the base, and R1 to the emitter. This limits the collector current to >about: > >Ic = (V2 - Vbe) / R1 > >I see how this works, but adding a resistor under the load seems >to increase the minimal voltage dropout (and thus lower the maximum >current limit) unless V2 is very low. Another approach is the following: > >V1 ---- LOAD ---- \Q1-> ---- GND > ----- > | > V2 ---- R1 > >That is, we just limit the base current directly. Here the collector >current is: > >Ic = beta ((V2 - Vbe) / R1) > >This seems better to me. We can use an arbitrary voltage at V2 (a 5V >PWM signal should be fine), and the minimum dropout is just the >transistor's Vce at saturation. > >However, I haven't seen the second circuit anywhere. Is there some >non-obvious problem with it? > >Thanks, > > >Lauri
--- Neither circuit is ideal since the first one is alpha dependent and the second one is beta dependent. You should try something like this: (View with a fixed-pitch font) Vs | [R2] | [LED] | C Von--[R1]--B NPN Q1 E | GND R1 is used to limit the current into the base-to-emitter junction of Q1 to about 10% of the current required to drive its collector-to-emitter junction into saturation with R2 and the LED interposed between the supply and the transistor's collector, and with R2 being used to limit the current through the LED -- JF
On Fri, 05 Jul 2013 16:09:49 -0500, John Fields
<jfields@austininstruments.com> wrote:

>On Fri, 5 Jul 2013 16:31:43 +0000 (UTC), Lauri Alanko <la@iki.fi> >wrote: > >>Hello. >> >>I need to wire some leds, and I figure that a transistor for each >>series is a good way to ensure that the leds get constant current, >>with the additional benefit that I can run PWM through the base of the >>transistor to control the brightness. >> >>However, I'm unsure about the best way to do this. The most common >>design I see is this: >> >>V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND >> ----- >> | >> V2 >> >>That is, Q1 is NPN, and the load is connected to its collector, V2 to >>the base, and R1 to the emitter. This limits the collector current to >>about: >> >>Ic = (V2 - Vbe) / R1 >> >>I see how this works, but adding a resistor under the load seems >>to increase the minimal voltage dropout (and thus lower the maximum >>current limit) unless V2 is very low. Another approach is the following: >> >>V1 ---- LOAD ---- \Q1-> ---- GND >> ----- >> | >> V2 ---- R1 >> >>That is, we just limit the base current directly. Here the collector >>current is: >> >>Ic = beta ((V2 - Vbe) / R1) >> >>This seems better to me. We can use an arbitrary voltage at V2 (a 5V >>PWM signal should be fine), and the minimum dropout is just the >>transistor's Vce at saturation. >> >>However, I haven't seen the second circuit anywhere. Is there some >>non-obvious problem with it? >> >>Thanks, >> >> >>Lauri > >--- >Neither circuit is ideal since the first one is alpha dependent
"alpha dependent" Bwahahahahahaha! John, You are such a hoot >:-}
>and >the second one is beta dependent. > >You should try something like this: (View with a fixed-pitch font) > > Vs > | > [R2] > | > [LED] > | > C >Von--[R1]--B NPN > Q1 E > | > GND > >R1 is used to limit the current into the base-to-emitter junction of >Q1 to about 10% of the current required to drive its >collector-to-emitter junction into saturation with R2 and the LED >interposed between the supply and the transistor's collector, and with >R2 being used to limit the current through the LED
...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Fri, 05 Jul 2013 09:38:11 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

>On Fri, 5 Jul 2013 16:31:43 +0000 (UTC), Lauri Alanko <la@iki.fi> >wrote: > >>Hello. >> >>I need to wire some leds, and I figure that a transistor for each >>series is a good way to ensure that the leds get constant current, >>with the additional benefit that I can run PWM through the base of the >>transistor to control the brightness. >> >>However, I'm unsure about the best way to do this. The most common >>design I see is this: >> >>V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND >> ----- >> | >> V2 >> >>That is, Q1 is NPN, and the load is connected to its collector, V2 to >>the base, and R1 to the emitter. This limits the collector current to >>about: >> >>Ic = (V2 - Vbe) / R1 >> >>I see how this works, but adding a resistor under the load seems >>to increase the minimal voltage dropout (and thus lower the maximum >>current limit) unless V2 is very low. Another approach is the following: >> >>V1 ---- LOAD ---- \Q1-> ---- GND >> ----- >> | >> V2 ---- R1 >> >>That is, we just limit the base current directly. Here the collector >>current is: >> >>Ic = beta ((V2 - Vbe) / R1) >> >>This seems better to me. We can use an arbitrary voltage at V2 (a 5V >>PWM signal should be fine), and the minimum dropout is just the >>transistor's Vce at saturation. >> >>However, I haven't seen the second circuit anywhere. Is there some >>non-obvious problem with it? >> >>Thanks, >> >> >>Lauri > >The first way is best. Relying on Beta is called (appropriately) >suicide bias. Certain prima donnas here will disagree.... it's not >their circuit that will fry. > > ...Jim Thompson
Or use an LM317 plus one resistor... look up LM317 as a current source. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
In article <qftdt8d60gp5rkohv5u43qgal9ilvgpl34@4ax.com>,
Jim Thompson  <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:
> The first way is best. Relying on Beta is called (appropriately) > suicide bias. Certain prima donnas here will disagree.... it's not > their circuit that will fry.
All right, so the problem is that there is lots of variance in beta between individual specimens, so I cannot rely that the same resistor on base will always bring about the same current at the collector. Hence amplification with transistors should always be based on feedback, like with op-amps. This is good to know, thanks to all responders. So back to the first design:
> >V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND > > ----- > > | > > V2
As I said, my concern here is that R1 increases the minimum voltage dropout, which may hurt efficiency, unless V2 is sufficiently low. But if V2 is low, the current limit depends greatly on Vbe. Is Vbe a more reliable number than beta? More concretely, suppose V1 is nominally a 12 V voltage source that might perhaps fall down to 11.5 V. The load would be five leds in a series, each with a maximum voltage drop of 2.2 V. If Q1 has Vce(sat) of 0.2 V, this means that R1 must not drop more than 0.3 V. If Vbe = 0.7 V, V2 must be at most 1 V. If we want the current limit to be 20 mA and V1 = 1 V, then R1 must be 15 ohm. But if we designed the circuit like this, and then one specimen of the transistor had Vbe of 0.8 V, then the current limit would be (1 V - 0.8 V) / 15 ohm = 13 mA, which wouldn't light the leds very well. So can we expect more consistent values across specimens for Vbe than for beta? Lauri
On Fri, 5 Jul 2013 23:28:54 +0000 (UTC), Lauri Alanko <la@iki.fi>
wrote:

>In article <qftdt8d60gp5rkohv5u43qgal9ilvgpl34@4ax.com>, >Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote: >> The first way is best. Relying on Beta is called (appropriately) >> suicide bias. Certain prima donnas here will disagree.... it's not >> their circuit that will fry. > >All right, so the problem is that there is lots of variance in beta >between individual specimens, so I cannot rely that the same resistor >on base will always bring about the same current at the collector. >Hence amplification with transistors should always be based on >feedback, like with op-amps. This is good to know, thanks to all >responders. > >So back to the first design: > >> >V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND >> > ----- >> > | >> > V2 > >As I said, my concern here is that R1 increases the minimum voltage >dropout, which may hurt efficiency, unless V2 is sufficiently low. But >if V2 is low, the current limit depends greatly on Vbe. Is Vbe a more >reliable number than beta?
Vbe will vary as -2mV/&#2013266096;C. If your temperature range is small, it shouldn't be an issue.
> >More concretely, suppose V1 is nominally a 12 V voltage source that >might perhaps fall down to 11.5 V. The load would be five leds in a >series, each with a maximum voltage drop of 2.2 V. If Q1 has Vce(sat) >of 0.2 V, this means that R1 must not drop more than 0.3 V. If Vbe = >0.7 V, V2 must be at most 1 V. If we want the current limit to be 20 >mA and V1 = 1 V, then R1 must be 15 ohm. > >But if we designed the circuit like this, and then one specimen of the >transistor had Vbe of 0.8 V, then the current limit would be (1 V >- 0.8 V) / 15 ohm = 13 mA, which wouldn't light the leds very well. > >So can we expect more consistent values across specimens for Vbe than >for beta? > > >Lauri
You could always use an OpAmp... output to transistor base, feedback to Vin- from emitter-R1 junction. Vin+ biased by +0.3V Or use only 4 LED's ;-) ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Fri, 5 Jul 2013 16:31:43 +0000 (UTC), Lauri Alanko
<la@iki.fi> wrote:

>I need to wire some leds, and I figure that a transistor for each >series is a good way to ensure that the leds get constant current, >with the additional benefit that I can run PWM through the base of the >transistor to control the brightness. > >However, I'm unsure about the best way to do this. The most common >design I see is this: > >V1 ---- LOAD ---- \Q1-> ---- R1 ---- GND > ----- > | > V2 > >That is, Q1 is NPN, and the load is connected to its collector, V2 to >the base, and R1 to the emitter. This limits the collector current to >about: > >Ic = (V2 - Vbe) / R1 > >I see how this works, but adding a resistor under the load seems >to increase the minimal voltage dropout (and thus lower the maximum >current limit) unless V2 is very low.
So, something like this:
>: +V >: | >: | >: --- >: \ / D2 >: --- >: | >: | >: . >: . (more LEDs, perhaps?) >: . >: . >: | >: | >: --- >: \ / D1 >: --- >: | >: | >: | >: |/c Q1 >: PWM------| >: |>e >: | >: | >: | >: \ >: / R1 >: \ >: / >: | >: | >: gnd
Yeah. This circuit works fine regarding the current limiting so long as Q1 is in the active region. Since in general this means that the collector is above the base junction voltage, this means you lose headroom due to Vbe and whatever voltage drop you decide for R1. Most folks doing this are "stuck" with their PWM control voltage coming from a micro and so the base voltage is 3.3V, 3.5V, 3.6V, or 5.0V, most likely. And the collector needs to be higher. So it really hurts a lot. An alternative would be to lower the base drive voltage somehow and use a tiny voltage drop across R1. But that often isn't all that practical (though don't snort at it -- it may be a good answer.) Doing this also makes things more dependent upon the emitter's internal kT/q voltage and therefore the programmed current will vary more over BJT temperature changes. kT/q is about 26mV at room temp and it varies about 90 microvolts per delta-K. If you were to go to the trouble to setting R1's voltage drop to 100mV (and the PWM drive therefore to about 850mV or so), even a 20K delta would mean perhaps a 2% shift in current. Which is probably okay. Most of the trouble here is in setting up a low output impedance PWM voltage at some livably small value. And even at the 850mV I mentioned, the collector still needs to be above that. So some headroom is still being lost.
>Another approach is the following: > >V1 ---- LOAD ---- \Q1-> ---- GND > ----- > | > V2 ---- R1 > >That is, we just limit the base current directly. Here the collector >current is: > >Ic = beta ((V2 - Vbe) / R1) > >This seems better to me. We can use an arbitrary voltage at V2 (a 5V >PWM signal should be fine), and the minimum dropout is just the >transistor's Vce at saturation. > >However, I haven't seen the second circuit anywhere. Is there some >non-obvious problem with it? > >Thanks, > >Lauri
So, something like this one:
>: +V >: | >: | >: --- >: \ / D4 >: --- >: | >: | >: . >: . (more LEDs, perhaps?) >: . >: . >: | >: | >: --- >: \ / D3 >: --- >: | >: | >: | >: R2 |/c Q2 >: PWM----/\/\-----| >: |>e >: | >: | >: gnd
This case depends upon beta. And beta varies from part to part, device family to device family, and varies a LOT over temperature, as well, on the same exact part!! Take a look at the beta diagram for some BJT and look at the curves they provide at different temperatures, for example. And then go take a look at the tables where they specify MIN and MAX and TYP for the beta value for the part. It's not a design parameter to design on, most of the time. This is bad design. Another approach you could consider for PWM uses more transistors, but it buys you headroom. It's also partly like your first circuit example -- you should "recognize" that part of the following circuit, I think:
>: Vcc +V >: | | >: | | >: | --- >: | \ / D6 >: \ --- >: / R3 | >: \ | >: / . >: | . >: | . (more LEDs, perhaps?) >: | . >: |<e Q5 . >: PWM-----| . >: |\c . >: | | >: | | >: | --- >: +-----, \ / D5 >: | | --- >: | | | >: | | | >: Q4 c\| | |/c Q3 >: |---+---| >: e<| |>e >: | | >: | | >: gnd gnd
In this case, your PWM signal is inverted but still works similarly to your first circuit. R3 in this case sets your current. Note that this circuit shows Vcc separate from +V. Your PWM signal comes from your micro, so you want to make sure that you use Vcc from the micro supply here. (Otherwise, if you used +V there and if +V is above Vcc, then you couldn't turn it off.) This allows +V to be different than Vcc (larger, often, if you have a series chain of LEDs.) If you need to operate more LEDs than can be chained together in one, single chain, you could use the following to extend it:
>: Vcc +V +V >: | | | >: | | | >: | --- --- >: | \ / D8 \ / D10 >: \ --- --- >: / R4 | | >: \ | | >: / . . >: | . . >: | . . >: | . . >: |<e Q8 Vcc . . >: PWM-----| | . . >: |\c | | | >: | | | | >: | |/c Q9 --- --- >: +---| \ / D7 \ / D9 >: | |>e --- --- >: | | | | >: | | | | >: | | | | >: Q7 c\| | |/c Q6 |/c Q10 >: |---++--| ,--| >: e<| | |>e | |>e >: | | | | | >: | | | | | >: gnd | gnd | gnd >: | | >: '---------+----------MORE
Q9 is added because the base drives for the additional BJTs (Q6, Q10, and more, if needed) starts to count for something and you need a way to supply the extra without shifting your programmed current around based on how many extra "legs" you add. Just some additional thoughts to add, is all. Do what works for you. I can tell you already know enough probably make things work "good enough" no matter which way you go, though. Best wishes, Jon
On Fri, 05 Jul 2013 16:56:42 -0700, I wrote:

><snip> >>: Vcc +V >>: | | >>: | | >>: | --- >>: | \ / D6 >>: \ --- >>: / R3 | >>: \ | >>: / . >>: | . >>: | . (more LEDs, perhaps?) >>: | . >>: |<e Q5 . >>: PWM-----| . >>: |\c . >>: | | >>: | | >>: | --- >>: +-----, \ / D5 >>: | | --- >>: | | | >>: | | | >>: Q4 c\| | |/c Q3 >>: |---+---| >>: e<| |>e >>: | | >>: | | >>: gnd gnd > >In this case, your PWM signal is inverted but still works >similarly to your first circuit. R3 in this case sets your >current. Note that this circuit shows Vcc separate from +V. >Your PWM signal comes from your micro, so you want to make >sure that you use Vcc from the micro supply here. (Otherwise, >if you used +V there and if +V is above Vcc, then you >couldn't turn it off.) This allows +V to be different than >Vcc (larger, often, if you have a series chain of LEDs.) ><snip>
I forgot to add something. Q3's collector can go fairly low here and still work acceptably. If you know you have enough +V to cover your series LED chain at the programmed current, you are good to go and don't need to worry much even if Q3 goes towards saturation. The current will be close enough for your needs and repeatable, regardless. Jon