Transistor as a current limiter

L

Lauri Alanko

Guest
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.
 
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/°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
 
On 2013-07-05, 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?
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 ---
 
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
 
Hi. Thanks for your most comprehensive post.

In article <fblet8pl075ca2pu6oh0qhplur54os1dd3@4ax.com>,
Jon Kirwan <jonk@infinitefactors.org> wrote:

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.)
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.)

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.
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.

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:
Just let me see if I decipher the circuit correctly:

: Vcc +V
: | |
: | |
: | ---
: | \ / D6
: \ ---
: / R3 |
: \ |
: / .
: | .
: | . (more LEDs, perhaps?)
: | .
: |<e Q5 .
: PWM-----| .
: |\c .
: | |
This, I gather, is a PNP version of the feedback-based current
limiter. When PWM is low, Ic is limited to (Vcc-Vbe)/R3.

: | |
: | ---
: +-----, \ / D5
: | | ---
: | | |
: | | |
: Q4 c\| | |/c Q3
: |---+---|
: e<| |>e
: | |
: | |
: gnd gnd
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.

If you need to operate more LEDs than can be chained together
in one, single chain, you could use the following to extend
it:
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
 
On Sat, 6 Jul 2013 14:47:55 +0000 (UTC), Lauri Alanko
<la@iki.fi> wrote:

Hi. Thanks for your most comprehensive post.

In article <fblet8pl075ca2pu6oh0qhplur54os1dd3@4ax.com>,
Jon Kirwan <jonk@infinitefactors.org> wrote:

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.)

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.)

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.

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.

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:

Just let me see if I decipher the circuit correctly:

: Vcc +V
: | |
: | |
: | ---
: | \ / D6
: \ ---
: / R3 |
: \ |
: / .
: | .
: | . (more LEDs, perhaps?)
: | .
: |<e Q5 .
: PWM-----| .
: |\c .
: | |

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

: | |
: | ---
: +-----, \ / D5
: | | ---
: | | |
: | | |
: Q4 c\| | |/c Q3
: |---+---|
: e<| |>e
: | |
: | |
: gnd gnd

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.

If you need to operate more LEDs than can be chained together
in one, single chain, you could use the following to extend
it:

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.
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:

: Vcc +V +V
: | | |
: | | |
: | --- ---
: | \ / Dan \ / Dbn
: \ --- ---
: / Rset | |
: \ | |
: / . .
: | . .
: | . .
: | more more
: | LEDs LEDs
: Q1 | here here
: |<e Vcc . .
: PWM-----| | . .
: |\c | . .
: | | . .
: | | | |
: | Q3 | | |
: | |/c --- ---
: +---| \ / Da1 \ / Db1
: | |>e --- ---
: | | | |
: | | | |
: | | | |
: Q2 c\| | |/c Qa |/c Qb ... Qz
: |---++--| ,--|
: e<| | |>e | |>e
: | | | | |
: | | | | |
: | | | | |
: | | | | |
: | | | | |
: gnd | gnd | gnd
: | |
: '---------+------- ... Qz
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:

2. 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:

3. 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
 
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
 
"Lauri Alanko" wrote in message
news:krb7va$ffo$1@oravannahka.helsinki.fi...

This is not a problem, since I'm going to have tens of chains. The
scalability outweighs the constant costs.
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:
http://www.linear.com/product/LT3465

Here's one for about $1 that can work from 20-450 VDC and 20 mA:
http://www.mouser.com/ds/2/391/HV9921-26434.pdf

Paul
 
On Sun, 7 Jul 2013 08:13:30 +0000 (UTC), Lauri Alanko
<la@iki.fi> wrote:

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.
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:

: ,---------+------------MORE
: | |
: +V | +V | +V
: | | | | |
: | | | | |
: | | | | |
: | | | | |
: Q2 c\| | |<e Qa | |<e Qb
: |----+--+--| '--|
: e>| | |\c |\c
: | | | |
: | | | |
: | |<e Q3 | |
: +----| | |
: | |\c | |
: | | --- ---
: | | \ / Da1 \ / Db1
: | | --- ---
: | | | |
: |/c Q1 gnd | |
: PWM-----| | |
: |>e | |
: | | |
: | | |
: \ | |
: / R1 | |
: \ | |
: / | |
: | | |
: | --- ---
: | \ / Dan \ / Dbn
: | --- ---
: gnd | |
: | |
: gnd gnd
Note again that your PWM voltage should NOT rise above about
+V minus about 1.2V or more. So if +V is 5V then you want a
micro supply rail of no more than 3.6V or so. Or if Vcc is
5V, you want at least 6.5V for your LED rail.

I shouldn't have spoken before thinking more.

Jon
 
On Sun, 7 Jul 2013 05:08:52 -0400, "P E Schoen"
<paul@peschoen.com> wrote:

"Lauri Alanko" wrote in message
news:krb7va$ffo$1@oravannahka.helsinki.fi...

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

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:
http://www.linear.com/product/LT3465

Here's one for about $1 that can work from 20-450 VDC and 20 mA:
http://www.mouser.com/ds/2/391/HV9921-26434.pdf

Paul
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
 
On Sun, 07 Jul 2013 02:23:54 -0700, I wrote:

: ,---------+------------MORE
: | |
: +V | +V | +V
: | | | | |
: | | | | |
: | | | | |
: | | | | |
: Q2 e>| | |<e Qa | |<e Qb
: |----+--+--| '--|
: c/| | |\c |\c
: | | | |
: | | | |
: | |<e Q3 | |
: +----| | |
: | |\c | |
: | | --- ---
: | | \ / Da1 \ / Db1
: | | --- ---
: | | | |
: |/c Q1 gnd | |
: PWM-----| . .
: |>e . .
: | . .
: | . .
: \ . .
: / R1 . .
: \ . .
: / | |
: | | |
: | --- ---
: | \ / Dan \ / Dbn
: | --- ---
: gnd | |
: | |
: gnd gnd
Fixed Q2 in the above. It was shown as a reversed PNP with
the collector in the wrong place. Now it's right.

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

: ,---------+------------MORE
: | |
: +V | +V | +V
: | | | | |
: | | | | |
: Q2 e>| | |<e Qa | |<e Qb
: |----+--+--| '--|
: c/| | |\c |\c
: | | | |
: | | | |
: | |<e Q3 | |
: +----| | |
: | |\c | |
: | | --- ---
: \ | \ / Da1 \ / Db1
: / R1 | --- ---
: \ | | |
: / gnd | |
: | . .
: | . .
: R2 |/c Q1 . .
: PWM----/\/\-----| . .
: |>e . .
: | . .
: | | |
: gnd | |
: --- ---
: \ / Dan \ / Dbn
: --- ---
: | |
: | |
: gnd gnd
Adds a resistor is all.

In this case, you want to account for the two Vbe's reaching
from Q2's emitter to its base and then from there to Q3's
base. And also account for a small Vcesat for Q1 (you will
operate Q1 as a saturated switch here.)

Let's say 20mA again and Q1 needs to operate saturated. So
figure about 1/20th of 20mA for the base drive. Or 1mA. Q1's
Vbe will be 0.76V or so. From there, I'm sure you can compute
the value of R2, knowing a base current of 1mA and whatever
Vcc your micro has.

R1 will have to accept that Q2's +V emitter source voltage
will be dropped by 0.76V + 0.66V or so, perhaps 1.42V at a
guess? And you have another .1V or .2V for the Vcesat. So
call it 1.5V to 1.6V lost. So R1 will be set by (+V -
1.6V)/20mA, roughly. Then you don't need different rail
voltages to operate the darned thing. You just need more than
2V or so at the rail.

Jon
 
On Sat, 6 Jul 2013 14:47:55 +0000 (UTC), Lauri Alanko <la@iki.fi>
wrote:

Hi. Thanks for your most comprehensive post.

In article <fblet8pl075ca2pu6oh0qhplur54os1dd3@4ax.com>,
Jon Kirwan <jonk@infinitefactors.org> wrote:

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.)

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.)
The common emitter circuit I suggested earlier: (View using a
fixed-pitch font)

.. V+
.. |
.. [R2]
.. |
.. [LED]
.. |
.. C
..Von--[R1]--B NPN
.. Q1 E
.. |
.. GND

Allows you to use a voltage way below V+ for the PWM control (Von) you
want to implement, with absolutely no speed penalty, and by choosing
R1 properly allows you to make beta variations in various Q1's
irrelevant.

For example, if you were to use a 12V LED supply and an LED string of
4 LEDs with a drop of 2.2V per LED with a current of 20mA through the
string, the circuit would look something like this:

9.1V
/
..+12V>--[R2]---+
.. |A
.. [LED]
.. |
.. [LED]
.. |
.. [LED]
.. |
.. [LED]
.. |K
.. +-- <0.1V
.. |
.. C
.. Von--[R1]--B 2N3906
.. Q1 E
.. |
..GND>----------+

With Q1's Vce(sat) equal to about 0.3V and the drop across the string
equal to about 8.8V, what's left for R2 to drop is about 3.3V.

With 20mA through the string the value of R2 would be:

12V - 9V
R2 = ---------- = 150 ohms.
0.02A

With 20 mA through it, a 2N3904 will have an inherent beta of over
100,:

http://www.fairchildsemi.com/ds/2N/2N3904.pdf


but for our purposes, if we drive the base with 10% of the collector
current we'll force the circuit to have a beta of 10, no matter what,
which will get rid of any of the issues surrounding "suicide" biasing.
Assuming Von is a logic level which varies from 0V to 5V, and that Q1
has a Vbe(sat) of 0.9V with an Ic of 20mA, then R1 has to drop 4.1V
with 2mA through it, which comes out to 2050 ohms.

2000 ohms is a standard 5% value, and would be fine for R1.

For R2, 150 ohms is a standard value, and with 20mA through it it
would dissipate:

P = I˛R = 0.02A˛ * 150R = 60 milliwatts,

so if you're using thru-hole parts a 1/4 watt package would be fine;
likewise for R1.

--
JF
 

Welcome to EDABoard.com

Sponsor

Back
Top