Transistor as a current limiter

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

Reply to
Lauri Alanko
Loading thread data ...

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.
Reply to
Jim Thompson

"Lauri Alanko" schreef in bericht news:kr6sdf$nah$ snipped-for-privacy@oravannahka.helsinki.fi...

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

Reply to
petrus bitbyter

--
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
Reply to
John Fields

"alpha dependent"

Bwahahahahahaha! John, You are such a hoot >:-}

...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.
Reply to
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.
Reply to
Jim Thompson

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:

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

Reply to
Lauri Alanko

Vbe will vary as -2mV/°C. If your temperature range is small, it shouldn't be an issue.

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.
Reply to
Jim Thompson

So, something like this:

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.

So, something like this one:

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:

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:

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

Reply to
Jon Kirwan

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

Reply to
Jon Kirwan

Beta is large and unpredictable, Vbe variations caused by temperature changes will be muliplied by it

--
?? 100% natural 

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---
Reply to
Jasen Betts

Right, that's what I was looking at after I was taught about the unreliability of beta. I was thinking of using a zener with emitter follower, or possibly a bona fide linear regulator IC, to lower the PWM voltage. But I'm not sure if they're suitable for fast switching. (Although I don't need to PWM all that fast, just faster than the human eye can see.)

Oh, definitely. This is for an illumination device that is meant to be used in room temperature, and I hope to avoid too much heat generation in the circuit itself.

Just let me see if I decipher the circuit correctly:

This, I gather, is a PNP version of the feedback-based current limiter. When PWM is low, Ic is limited to (Vcc-Vbe)/R3.

And this is a current mirror which ensures that Ic(Q3) = Ic(Q4). I don't yet have a full intuition of how it works, but I recognize the shape.

Indeed I do. The idea is to have enough leds to provide some visible illumination, and since as a beginner I'm not comfortable with dealing with voltages over 12 V, I'm going to need quite a number of LED series. That's why I wasn't very comfortable with the idea of using a regulator or op-amp for each series. They'd get expensive relative to the cost of the LEDs.

Your solution requires only a single transistor per series, not even a resistor. I still need to figure out how this "amplified current mirror" works, and I haven't yet had the chance to try it out, but at least on paper it seems quite optimal. Thanks again.

Lauri

Reply to
Lauri Alanko

So let's look at a revised (I renumbered the parts) version of the last circuit, which can handle several series chains of LEDs all operating at the same current:

Here, you can see that I've numbered Q1 to Q3 as the unique BJTs where you only need one of each no matter the number of added series chains. Qa to Qz would be chains up to 26.. but in reality it will be the number of series chains you need to apply. The LED series chains are numbered, accordingly, and have up to N in them (limited by the available rail voltage,

+V, divided by the required LED voltage during operation.) I gather you already know all this stuff, so I won't belabor it. You mainly want to understand Q1 to Q3, the first Qa, and Rset. (And already understand some of that, anyway.)

So, yes. Q1 and Rset determine the current. When your PWM drive goes to 0V (or very close to it), Q1's emitter will be about a diode drop above. I'm going to assume about 20mA per chain here. So this means that Q1's collector will need to source 20mA. Since I figure 0.7V for a collector current of

2mA, this means the Vbe of Q1 will be about 60mV more, or 760mV. That's the likely collector voltage when driven ON. So the current through Rset will be (Vcc-760mV)/Rset. It's reasonably predictable, so you can use it in a design. The main caveat here will be that Q1's Vbe will drift over temperature at about -2.1mV to -2.3mV (from memory.) So if Q1 warms up 20C, let's say, this amounts to a change of say 45mV, meaning the current will be (Vcc-715mV)/Rset. That's probably the most you have to worry about here. Other than that, you can predict it pretty well.

Q1's sourcing its collector current into Q2. (If Q3 were removed and Q3's base jumpered to its emitter in the empty socket, the circuit would still work. So let's look at that, first, and ignore Q3 for now.) In this case, Q1's collector will be positive enough to turn on both Q2 and Qa (we'll ignore the other chains, for now, too.) But Q1's collector current must go through Q2's collector, with only a slight amount of that current (set by Rset) diverted to provide the base currents of Q1 and Qa. So most of it.

Let's pause a moment. I'm sure you recall one of the BJT equations:

  1. Ic = Is * ( e^(Vbe/(kT/q)) - 1 )

The "1" value there is jiggered in so that Ic goes exactly to zero when Vbe is zero. Just accept it. It's a model. The value of kT/q at room temp (20C) is about 25.25mV (you can compute it yourself on google, entering:

  1. k*((273.15+20)kelvin)/(charge of electron)

Normally, the value of e^(Vbe/(kT/q)) is so large in the active mode, that the value of "1" in the equation can be ignored. This makes it easier to isolate Vbe, into:

  1. Vbe = (kT/q) * ln( Ic/Is )

(If you haven't already figured it out, a BJT uses a base emitter voltage to determine collector current, not a base current... the base current is a side effect due to charge recombination which just happens to luckily slew around with collector current in mostly lock-step form.)

So now you can see something here. You can figure out Q2's Vbe from its collector current, Ic, using equation 3. Since the collector current is set by Rset, driven into Q2 by Q1, then Q2's Vbe will be set by that current. Now, Q2's base voltage will be applied to Qa's base and equation 1 will apply to Qa, causing it's collector current to "mirror" the driven collector current of Q2. Kind of nifty, eh?

So, in short, Q1 forces a current into Q2 causing it's base to attain a set voltage above its emitter, which then drives the base of Qa (whose emitter is at the same place as Q2's), which then determines Qa's collector current.

Now for the problem. Both Q2 and Qa do require some base current. It's not much, but it takes away from Q2's collector current. If you only had Qa, you could probably live with it. But if you add more chains, each additional base current starts to add up. So how to remedy this? Stuff in Q3. Q1's collector will now have to also turn on Q3 (with a Vbe voltage, of course, in order to get Q2's base turned on. Q3 does require a base current for this, so Q2's collector current will be diminished by this. However, Q3 is only supplying base currents for Q2 and Qa to Qz, so it's base current won't be very much (Q3's collector and base currents added together supply the required base currents of Q2 and Qa to Qz, and it's base current will divide that by its beta.) Adding additional Qb, Qc, and so on increases the sum (or the required collector current of Q3) but this increase is barely felt on Q2's driven collector current because it's effect is divided by Q3's beta. This is a much better situation and means that you really don't have to worry about adding more chains to the circuit.

The current mirrors can work down into near saturation. The main thing is that you know, a priori, that you have enough

+V to operate your LEDs at the desired set current.

A neat thing about a current mirror, by the way and if you recall my earlier comment about temperature affecting Vbe, is that the mirror BJTs are all operating at the same collector currents and roughly speaking at the same Vce (except for Q2, sadly.) So they all dissipate the same power, roughly, and heat up about the same. (You could also make them thermally coupled.) So their Vbe will drift about the same over temperature changes, and this means that their collector currents won't budge much from the design.

One idea that is sometimes applied in cases where wasting the same LED current on Q1 and Q2 (means that if you have 5 chains of LEDs, each at 20mA, you are using 120mA from the supply with 20mA of it NOT going to LEDs), is that you can stuff a resistor into the emitter to ground leg of Q2. Then a lesser current into its collector will jack up its base higher, causing Qa's collector current to "imagine" that it should provide more current than is being sunk by Q2. This causes other problems (temp drift) and there are limitations. But you could certainly consider the idea of dropping your Rset current downward to 2mA, for example, using a factor of

10 multiplier (which means you need a Q2 emitter resistor that drops 60mV at 2mA, or a value of 30 ohms at a guess.) You could experiment there, if you want to.

Jon

Reply to
Jon Kirwan

I forgot to mention the Early Effect. This is a change in Ic versus a change in Vce. (It can be modeled by adding a resistor from collector to emitter on the BJT.)

This effect does impact the circuit's accuracy. Q2's Vce may be either larger or smaller than the Vce of Qa through Qz. If the Vce voltages were all the same then the accuracy would be pretty good. But let's say you only had one LED in each chain, that +V=12V, and that the LED needs 3V. Then the Vce at Qa through Qz would be 9V. But the Vce at Q2 (with Q3 in place) would be about two Vbe's or on the order of 1.4V or so. This is a much bigger difference. If you measured the currents, you would find a noticeable difference between Q2's collector current and Qa's. As you added more LEDs to Qa's chain, dropping it's required Vce, by adding another two LEDs let's say, then Qa's Vce would be 3V and much closer to Q2's Vce. And therefore the currents would now be closer to each other. It's not a huge effect, as most BJTs have fairly large values of VA (the larger the less the effect is.) But it's something to be aware of if you tinker around with this circuit and wonder about variations you may see.

Jon

Reply to
Jon Kirwan

I haven't yet tried this out (I'm away from my components) but in Falstad's simulator this doesn't seem to work unless there is a resistor in Q1's base. Otherwise the (ideal, zero-impendance) low-level pin will drain all current through the base. In real world things might work differently.

Anyway, since the current reference is now shared by the entire circuit, I might as well use some more expensive current source, e.g. one based on an op-amp or voltage regulator:

gnd---(->)----- to current mirror | |/c PWM---R1--| |>e | gnd

Is there some advantage here over the simple resistor-transistor current source? It would seem that here the PWM control isn't draining any of our meticulously measured current. Which current source would be most suitable for a fast switching load?

Actually I had forgotten about this before I saw the current mirror design. I remembered BJTs as current-controlled devices, and had forgotten that they can also be viewed as voltage-controlled.

The most crucial thing, evidently, is that the exact ratio of current control is unpredictable, whereas voltage control is much more reliable (given that the current mirror depends on the same voltage producing exactly the same current on both transistors).

This is not a problem, since I'm going to have tens of chains. The scalability outweighs the constant costs.

Besides, it's not wasting the same _power_: I will generate the current reference from +5V, whereas the leds will use +12V.

Neat trick. I might consider that if I only had a few leds in a battery-powered device.

Lauri

Reply to
Lauri Alanko

If you want bottom line best efficiency and lowest cost, especially for something that may be used in production, some of the single chip LED drivers are really amazing:

formatting link

Here's one for about $1 that can work from 20-450 VDC and 20 mA:

formatting link

Paul

Reply to
P E Schoen

That's my fault. I was just spinning this out without a brain in my head. Q1's base should never go below two Vbe's above ground in the circuit I provided.

Your PWM output is ground-referenced and the circuit I gave you really wants the output to be Vcc-referenced, which isn't going to happen. If you turn the entire circuit upside down, though, then things work (if your micro Vcc is at least 1.2V less than your LED driving rail) because then your micro PWM signal is properly referenced.

Sorry about that.

Here's the reversed method:

Reply to
Jon Kirwan

Yeah, we've had a number of discussions about LED driver chips here and they are good to have! I just figured the OP was interested in more than just buying an IC.

Jon

Reply to
Jon Kirwan

Reply to
Jon Kirwan

You could also operate Q1 as a switch if your +V and Vcc are the same:

Reply to
Jon Kirwan

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.