Connect with us

Transistor as a current limiter

Discussion in 'Electronic Basics' started by Lauri Alanko, Jul 5, 2013.

Scroll to continue with content
  1. Lauri Alanko

    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
     
  2. 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
     
  3. Lauri Alanko

    Lauri Alanko Guest

    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
     
  4. Jon Kirwan

    Jon Kirwan Guest

    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
     
  5. Jon Kirwan

    Jon Kirwan Guest

    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
     
  6. Jasen Betts

    Jasen Betts Guest

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

    Lauri Alanko Guest

    Hi. Thanks for your most comprehensive post.

    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
     
  8. Jon Kirwan

    Jon Kirwan Guest

    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:

    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
     
  9. Jon Kirwan

    Jon Kirwan Guest

    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
     
  10. Lauri Alanko

    Lauri Alanko Guest

    Thanks again for your explanations. You went into a bit more detail
    than I really needed, but it is no doubt valuable to some other
    readers.

    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
     
  11. P E Schoen

    P E Schoen Guest

    "Lauri Alanko" wrote in message
    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
     
  12. Jon Kirwan

    Jon Kirwan Guest

    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:
    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
     
  13. Jon Kirwan

    Jon Kirwan Guest

    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
     
  14. Jon Kirwan

    Jon Kirwan Guest

    Fixed Q2 in the above. It was shown as a reversed PNP with
    the collector in the wrong place. Now it's right.

    Jon
     
  15. Jon Kirwan

    Jon Kirwan Guest

    You could also operate Q1 as a switch if your +V and Vcc are
    the same:
    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
     
  16. Suppose Q2 slipped through non reversed?

    Don't worry about your brains. Without them you couldn't make a mistake :)

    petrus bitbyter
     
  17. Lauri Alanko

    Lauri Alanko Guest

    Of course there are ICs for every purpose nowadays, but "buy this
    chip" is kind of a boring solution to anything.

    Besides, I'm not convinced that the examples you show are ideal for my
    purposes.
    This is a boost converter intended for Li-ion batteries. I don't think
    step-up conversion buys me very much if I work with a 12 V power
    supply, already enough to drive several leds in a series.
    This is a switching current limiter. It sounds great, but since it's
    expensive relative to leds, one would ideally run it from mains to
    ensure it runs a maximal number of leds. Unfortunately dabbling with
    mains power directly is illegal for hobbyists where I live. (Also, I
    wouldn't dare touch it even if it weren't.)

    This looks more like what I need:

    http://www.linear.com/product/LT3746

    It controls 32 led chains of 13 V each. However, it has lots of extra
    features and costs 10 bucks, far more than 32 cheapo transistors.
    Also, it's surface mount. I'll stay with through-hole for the time
    being.

    Thanks for the suggestions, anyway.


    Lauri
     
  18. Jon Kirwan

    Jon Kirwan Guest

    I actually caught that mistake, right away. Note my
    self-reply shortly after?
    Hmm. An argument for being a machine, perhaps. ;)

    Jon
     
  19. Lauri Alanko

    Lauri Alanko Guest

    I understand the advantages of higher voltage, but I have decided to
    stick with 12 V, since 12 V power supplies are cheap and ubiquitous,
    and I'm not comfortable dabbling with higher voltages yet.
    I don't even know which leds I'm going to use yet. The ones I have
    currently are too directional. I also don't know yet how many I'm
    going to need. I intend to experiment and see how many I need to add
    until it looks good to my eyes.

    The idea is to make gadget that glows in different colors. The leds
    will be surrounded by a diffusion shell. It doesn't need to illuminate
    an entire room, but I certainly want the light to be noticeable.

    I'm now considering using 0.5 W leds. They are probably a bit less
    efficient, and won't spread the RGB colors quite as evenly, but at
    least there's less wiring. Heat might be a problem, though. We shall
    see.


    Lauri
     
  20. Jon Kirwan

    Jon Kirwan Guest

    "Not knowing" which LEDs may be used emphasizes the need to
    be able to support more than one series chain, since you
    don't know how many you can get into one series chain and the
    lighting effect may drive the total number of LEDs needed. A
    flexible design approach may then be an option worth
    considering.

    So I don't think time was entirely wasted. Though a better
    focus would certainly help select between design tradeoffs.

    Jon
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-