# Driving LEDs with a battery pack

#### Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

•  Subject
• Author
• Posted on
Hello,

I'm trying to drive some LEDs with standard batteries (eg. from a
battery holder with 3 AAAs in it). Should be easy ... right?

There's various colors of LED which need from 2.2 to 3.3 volts at
around 25mA and I want to drive maybe half a dozen from the battery
pack.

I can calculate the right resistor for any give voltage, no problem,
but how do I deal with the wide range of voltage over the lifetime of
the battery. With a brand new battery the voltage is around 4.6V but
as it discharges it goes down to about 3.3V (with about 10% battery
left). If I pick resistors which work at 3.3V then there's far too
much current when the batteries are new (I measured 60mA on some of
them and they get warm to the touch so I'm guessing that's bad)

So:

a) How delicate are LEDs? Is 60mA going to burn them out?

b) If it is, what's the simplest/smallest circuit which will give me
(eg.) 3.3V @ 150mA from a set of AAA batteries? Size is important as I
want to pack it into a small space.

I did some Googling and tried a 3.3V Zener diode to drop the voltage
but it only dropped the voltage by about 0.2V. I'm guessing the reason
for that is something to do with the the load current being quite high
which makes the Zener resistor very small (two or three ohms).

I also looked at voltage regulators but is seems a 3.3V regulator
needs a higher starting voltage than the batteries can provide.

Re: Driving LEDs with a battery pack
On Sun, 5 Jul 2009 11:22:29 -0700 (PDT), fungus

1. What are the specs on your LEDs?
If they're generic/Ebay unmarked units, limit the current to a max of
20ma.

2. Use a resistor value that limits the current at maximum battery
voltage.  Brightness will drop off some as the batteries age, but
probably not much.

joule thief
This is a circuit that boosts battery voltage with a minium number of
components.  The most common place to find a pre-built unit is the
common solar walkway light.  Many of these use a single NiCd or NiMH
battery and use a joule thief type circuit to  boost that voltage to
the 3+ volts needed for a white LED.

You can buy a kit for \$10:
http://www.nifty-stuff.com/LED-boost-circuit-joule-thief.php

John

Re: Driving LEDs with a battery pack

I've built these and they work, great.  Not hard to make, either.
But....

http://www.ledsales.com.au/kits/joule_thief.pdf

I read through it.  And the description under "How it works" is just a
little bit too simplified for me.  Perhaps the shortest possible
explanation that retains important details is:  the BJT turns on via
R1 allowing current through the collector winding to rise along a
ramp.  During the on-time, rates of flux change in the base winding
actually aids the battery voltage a little in keeping the BJT on still
harder.  At some point, though, the fast rise in collector current
demands more base current than can be supplied and the BJT tries to
limit the collector current.  In doing so, the collector winding goes
through zero volts across it and reverses its voltage to continue
driving the current through the LED.  But the rate of flux change in
the base winding also then reverses, opposes the battery supply, and
acts to turn the BJT completely off.  While the BJT is off, the
collector winding's current (and thus, the LED current) declines on a
ramp of its own.  As it does, the voltage across it required to drive
the LED also drops.  As that drops, so does the rate of flux change in
the base winding and thus it's voltage opposing the battery.
Eventually, the induced voltage isn't enough and the BJT is able to
begin turning back on.  As that happens, the voltage across the
collector winding reverses again and the base winding starts aiding
the battery, once again, snapping the BJT into fuller on conditions.
And the cycle repeats.

There are some additional details.  As the collector current rises, so
does Vce.  As Vce rises, the voltage across the collector winding
declines gradually, which results is lower rate of flux change and
that softens the supporting base current at the very time when more
base current is required due to the rising collector current.  So the
BJT doesn't turn off suddenly, but "rolls quickly into" the turn off.

Hobbyist view, anyway.

Jon

Re: Driving LEDs with a battery pack

Ebay specials... <g>

Quite a lot in my tests. If I select resistors for "brand new battery"
then for most of the life of the battery I see about half brightness.
This would be ok for an on/off indicator but the stuff I'm making is
decorative for a procession so I want them to be as bright as
possible.
I'm not worried if the life of the LED is reduced from 100,000 hours.

I found a ferrite bead in an old PC and lashed on up. It works
but isn't very bright (maybe only a quarter of 20mA brightness).

Re: Driving LEDs with a battery pack

you may be able to use a miniature light globe as a current regulator.
Look for something like a 15 - 25 ma globe, with a voltage rating of say
3 - 7.5 volts.  Wire it in series with the LED. As the battery voltage
reduces the globe dims, as the lamp filament cools it's resistance
lowers and hence somewhat compensates for the sagging voltage. (such odd
light globes are often supplied for illuminated switches and sometimes
for Wein bridge oscillators

Alternatively, connect a JFET (plus a low value resistor)as a constant
current source. Most JFET's will not work perfectly with so few volts to
play with, but it will be better than nothing.

For something sophisticated you could use almost any of the charge-pump
IC's to double the voltage and give you enough volts for a proper
constant current source or as a simple voltage doubler for when the
battery / led combo is just too low.

Re: Driving LEDs with a battery pack

Like this?

http://en.wikipedia.org/wiki/Current_source#JFET_and_N-FET_current_source

<g>

A few days ago I was thinking like this:

"It's just a battery and an LED, how hard can it be...?"

Re: Driving LEDs with a battery pack

A lot like that. If you put a resistor between the gate and source you
have some control over what the current limit is.

It's not hard. If you just want to hook up an LED then just a resistor
works fine.If you need constant brightness, maximum life, maximum
reliability or maximum efficiency then it gets more complicated.

Re: Driving LEDs with a battery pack

The circuit diagram just below that heading does not relate to the

Re: Driving LEDs with a battery pack
On Mon, 6 Jul 2009 03:15:40 -0700 (PDT), fungus

Was the battery voltage you used __below__ the on-voltage for the LED?
(In the joule thief thing, that's the way it is supposed to be.)

Jon

Re: Driving LEDs with a battery pack

Yes, I used a single battery...

I also tried two batteries to see if it would get brighter (it didn't)

Re: Driving LEDs with a battery pack
On Mon, 6 Jul 2009 14:06:28 -0700 (PDT), fungus

The brightness should also be affected by the base resistor value,
too.  Did you try changing it to a lower value -- say about half?  I
think that should lower the frequency, leave the duty cycle about the
same, and increase the peak current (not quite by double) -- with the
net effect of raising the brightness a little -- assuming the
transistor and LED can handle the peak.  If that works as expected,
you may consider trying even lower values.

Jon

Re: Driving LEDs with a battery pack

I'll put it together again with my variable resistor see what happens.

Can a joule thief power multiple LEDs?

How important are the number/neatness/type of wire of the windings
on the transformer? (or does it make little difference at 50kHz?)

Re: Driving LEDs with a battery pack
On Tue, 7 Jul 2009 14:57:42 -0700 (PDT), fungus

Make sure you wire up the transformer, correctly, too.  The base side
must _aid_ battery voltage when the transistor is on, not oppose it.
If it isn't working at all (or well), try reversing the leads there.

Yes, but don't wire them in parallel.  You'd wire them in series.
There is a limit, but with no more than 6 (I think you wrote that) the
required voltage ... at worst ... is 6*3.3V or 19.8V, which I think is
doable.  I could play with one here and see, to be sure.

The peak current, by the way, is pretty much set elsewhere in the
circuit.  What having the LEDs stacked up like that does, is to
dramatically reduce the duration of time they are pulsed.  The whole
things works by winding up to a peak current in the collector winding
-- that is set by the circuit itself and the transistor, not by the
LED.  However, once the transistor reaches that peak current in the
collector winding, it turns off.  And when it does, that current goes
into the LED (or chain of LEDs.)  Assuming that the voltage is low
enough that it doesn't "break" the transistor (20V shouldn't, in most
cases), the voltage will self-adjust to whatever is needed to drive
the LED(s).

However, with higher voltages, the transformer will dump its energy
faster.  (The time is inversely proportional to the required voltage.)
So the pulse is narrowed by stacking the LEDs.  This shouldn't change
the transistor ON time by much of anything, but it changes its OFF
time, and thus, reduces the effective duty cycle.  Which may mean you
need a higher peak current and thereby a lower base resistor to get it
(or more windings in the base circuit part of the transformer.)

Within reason, I think you are fine.  You cannot use bare wire, for
obvious reasons (shorts itself all over the place.)  If you use
insulated wire, your spacing will be pretty wide.  Better is 'magnet
wire' which has just enough insulation and not much more than that.

A similar number of windings is probably a good idea for both
windings.  I assume that's what you did.  But it isn't critical.  You
can wind more or less on either side and get by, just fine.  Too many
extra windings (like a multiplying factor of 5 or more) on the winding
that attaches to the base and you might get into areas where the
transistor base is so reverse biased when the LED gets pulsed that it
zeners and injures the transistor.  But as you can see, there is a lot
of room for error.  The main thing is to wire it up so that the base
winding _aids_ the battery voltage.  If you get it wrong, just wire
the other way and see how it goes.

I think 50kHz should be fine for most BJTs.  I don't recall the
frequency I measured before, but it seems it was in the 10's of kHz,
so your question is in the right ballpark.  There are also some very
fast rise/fall times going on, and probably some minor other effects
due to those.  But nothing I've needed to get concerned about, that I
recall.  I think you'll be fine.

Jon

Re: Driving LEDs with a battery pack

So *that's* why it didn't work when I put it back together
yesterday... !

I tried my variable resistor and it makes a bit of
a difference in brightness. I looked at it with an
oscilloscope and the resistor changes the pulse
frequency.

If you dial it too low the circuit makes a scary
whistling sound. A tiny bit more and it shuts off.

I did six LEDs and it works but quite dim. I tried two batteries
and it's a lot brighter (maybe twice) but still far less bright then
a single LED. In my informal 'point it at the wall' test all six
together were only putting out about the same amount of light
as a single LED at 10mA.

Unless this can be improved I'm not sure the JT is the circuit
for me.

(I tried three batteries and the transistor died. I went back
and checked the temp with two batteries and yes, it was
quite warm...)

I was using insulated wire because that's all I had.
Do you think the magnet wire fix (or at least help with)
my brightness problem?

The 60kHz number was from one of the web pages.
connected.

Re: Driving LEDs with a battery pack
On Thu, 9 Jul 2009 03:51:33 -0700 (PDT), fungus

hehe.

Yeah.  The frequency gets well into hearing range.

Pulse width goes down as the LEDs stack up.  It doesn't get better
that way.  But at least it works!

The computation of the peak current actually requires some reading of
the datasheet for the transistor, though you can approximate an overly
high estimate without much information.

I_peakmax = Beta*(N*(V_battery - Vcesat) + V_battery - Vbe) / R_base

Note that the transformer's primary or secondary value in Henrys
doesn't factor into this.  What it affects is how long it all takes.
So if you are hearing a terrible racket, that may mean your primary
has too high a value.  To fix that, unwind some windings.  That will
reduce the inductance (which goes by windings^2.)

You can see that R_base has a definite impact.  So does the battery
voltage.

To make much reasoned use of the above equation, N is the ratio of
windings: base winding count / collector winding count.  If that is 1,
which it probably is close to, then N=1.  You can boost the peak by
increasing that winding ratio a bit.  But the risk is that if you wind
the ratio too far, during OFF time for the transistor the base voltage
will be driven even further below the emitter.  More than 5V below and
it is likely the transistor will break down.  So you need to be
careful here.  If you are using a 1.5V battery only, you may be able
to go to N=3 or N=4.  If you are using higher voltages, then N=2 might
be a better limit.  This is why just keeping N=1 is so safe.  It aids
battery voltage, which is good, but not so much as to risk the
transistor.

As a 0th order aproximation, I'd use Vcesat that is equal to Vbe and
beta of 200 (for 2N2222 [which is typical], maybe a little more for a
2N3904.)  What happens very near turn-off on the transistor is that
the collector current rises along a clean ramp determined by the
collector winding inductance and the battery voltage (V/L is the
rate.)  But meanwhile, the base current remains largely flat (slightly
declining for most of the time.)  The ratio of the two, Ic/Ib, is the
beta.  At the first of the ON time, that's basically very close to
zero and during which Vce on the transistor is very close to zero
volts.  But eventually, as Ic increases, this beta value increases
past 1 and grows towards some transistor limiting value (say 200.)
During this later transition point, Vce also rises.  By the time Vce
reaches Vbe, the beta is pretty close to 200 on a 2N2222.  Maybe a
little less.  But in that area.  So let's assume Vbe is about 0.8V and
therefore Vcesat is the same.  That should get close.

Assuming N=1 and Vbe=Vcesat, the equation becomes:

I_peakmax = 2*Beta*(V_battery - Vbe) / R_base

With a 1.5V battery (fresh) and a 2N2222, an estimate becomes:

I_peakmax = 2*200*(1.5 - 0.8)/ R_base = 280/R-base

With R_base28%00 ohms, that would be 0.1A peak.  But as the voltage
droops, so does the peak current:

I_peakmax = 2*200*(1.1 - 0.8)/ R_base = 120/R-base

In that case, with 2800 ohms, to about 43mA.  Less than half.

Note that nowhere in the above equations is the transformer
inductance.  That mainly affects frequency.  To speed it up, use fewer
windings.  To slow it down, more.  Too fast and the transistor won't
keep up.  Too slow and it will blink or hum.

Higher battery voltages will improve your duty cycle, too, because the
time during which the LED is on is determined by the difference
between the required LED stack voltage and the battery voltage divided
into the inductance.  Higher battery voltages reduce the difference
and thereby increase the time.  So you might try doing that, just so
long as you stay underneath the LED stack's voltage and DON'T risk
protection there might be a good idea, now that I'm thinking about
it.)

There is another problem I forget to mention (I'm just a hobbyist.)
The transformer might get saturated.  This really becomes a problem
when you are using low frequencies.  So one idea is to REDUCE your
windings!  See what happens.

It probably can be, though I haven't considered your exact situation
and I probably need to do some playing, myself, before passing along
some ideas.  I'm short on these green LEDs (zero), so I need to get
some, first.

Ah.  Well, there is that.  But actually, I'm guessing you may have
zapped the base-emitter junction by the reverse voltage.  One
possibility here is to protect that junction by a reverse oriented
diode across it.  (Okay, I need to think more about that.)

To be honest, I'm not sure.  I think that mostly affects just how much
inductance you can wind.. but not much else.  When I said "better" I
just meant that you have a wider range of choices in winding.

Okay.  That suggests that you are about right, to me.  I wouldn't
reduce your windings much, then, unless you do that in conjunction
with reducing your base resistor value.  Cutting down the base
resistor value increases the peak current.  But getting there takes
longer.  Making that take less time, while keeping that lower value
resistor, means cutting down the inductance on the transformer's
collector winding.  So the two kind of go together.

Jon

Re: Driving LEDs with a battery pack

OK, another round of experimentation.

I reduced the number of windings. Fewer turns definitely makes
it brighter. I got down to four turns and I was like, "dude, one less
turn and it'll be there!"... but when I got down to three it stopped
working.

Now, my ferrite ring is about an inch across - much bigger than
the ones on the web pages. Would a physically smaller transformer
with better wire let me raise the frequency that last little bit...?

See pic here:
http://www.artlum.com/joulethief.jpg

(FWIW, the frequency was about 250kHz at four turns)

Yep. I'm back on three batteries again because the difference in
brightness is huge.

With three batteries and four turns my little transistor heats up
rapidly
and would probably only last half a minute if I left it switched on.
I assume I can get a higher wattage transistor to fix that problem.

... or maybe there's another fix.

It gets brighter with every turn I remove! See above.

It's getting closer. If I can up the frequency a little bit more and
solve the transistor overheating problem we could be there.

Here's my LEDs lit up:
http://www.artlum.com/lit.jpg

On the right is a green LED running at 20mA, you can see it's
putting out way more light than all the others combined.

I'm using a mixture of colors in my little test circuit - white, red,
green, blue

Changing the base resistor value has very little effect in the three
battery/four turns version. If the resistance gets too low the LEDs
actually get dimmer.

Re: Driving LEDs with a battery pack
On Thu, 9 Jul 2009 16:04:46 -0700 (PDT), fungus

Those volt-seconds are killing you.  Saturation of the core, my
ignorant hobbyist self tells me.

Hehe.  It had to happen at some point!  Imagine what zero turns would
have done for you, otherwise!!

I don't know just yet what's better here.  The smaller core will
likely saturate out earlier and that's not the right direction.  I'm
beginning to understand why those 60Hz transformers weigh a ton. (More
cross section is better.)  But it would be smaller.

I'm wondering about the core material itself, though -- iron?  Or
ferrite?  For higher frequencies, eddy currents become murder and the
ferrites that insulate lots of the little bits stomp on the currents.
But it's like lots of little air gaps, which can dominate the
reluctance.

In this case, the transformer is being used for two things -- each of
them in a bit of contrdiction to the other, as I understand it right
now.  It's being used to boost the battery voltage as seen by the base
of the transistor (the voltage across the collector winding creates a
rate of flux change that is 'seen' by the base winding as aiding the
battery voltage.)  For that, you want your basic transformer thing
that does NOT store energy but provides a low reluctance path to
transfer it to the base circuit.  On the other hand, when the
transistor turns off and the collector winding (might as well call it
the primary, I suppose) is left flapping in the wind, you want stored
energy that is now dumped via the LED.  For that, it's more like a
flyback thing (if I'm not abusing the term.)  You _want_ energy stored
in the magnetic field so that you can recover it now.  So now a nice
high reluctance air gap looks good to store the energy without
worrying over saturation issues.

However, the base doesn't require a 100% transfer of power.  It just
needs access to the voltage to help drive a small base current (low
power.)  So perhaps the air gap approach would enhance the situation
without a lot of sacrifice on the benefits of boosting what the base
sees for voltage.

Makes me wonder a little about slicing a nice thin (sub-millimeter)
wafer out of that donut you have so that there can be good energy
storage without saturation issues.

Here's a good place for some magnetics guru to chip in.  I'm getting
out of my depth.

Yeah.  Which is pushing things.  What was the base resistor value?

You are probably pumping some serious current through it.

Larger transistors will have lower beta, probably.  So that will
reduce your peak current.  Plus, they are probably slower.  You might
also consider some means of heat-sinking or finding something in a
TO-220 package (but with good beta) -- which makes adding a heat sink
very easy, plus the package is already pretty good.

Yes.  But that may actually be because of saturation in the core,
itself.  It turns out that it is the area underneath your volt curve
(volt-seconds, Webers, etc.) that saturate the core.  With low
frequencies, the applied voltage hangs around longer and therefore the
volt-seconds goes up.  That's bad, mostly because at some point the
whole thing just stops accepting any more volt-seconds and to fix that
the voltage goes to zero (and this means your transistor gets the
entire voltage applied to it and that makes it very hot if it stays ON
for long.)  When you upped the frequency by reducing turns, you
shortened the time and therefore also lowered the volt-seconds.  Which
is a good thing.  If you were saturating with more turns and a slower
ramp, you'd lose useful energy and the light would look weaker because
the duty cycle would be very low.  Reducing to fewer turns might have
kept you from saturating the core with the effect that the duty cycle
was better and more energy got to where it belonged.

have their peak sensitivity in the green -- something like 555nm, or
somesuch.  At least, your photopic vision.  Scoptic is slightly
different, peak-wise.

I'm kind of worried about the base-emitter junction, then.  With 3
batteries and let's say 6 LEDs, you are likely murdering the poor
thing.

What happens when the LEDs are pulsed on?  The collector winding has
(LED stack voltage - battery voltage) across it.  This induces that
voltage into the base winding, too.  That's going to be more than 10V
by itself.  It's got to drive the poor BJT far into the negative
region relative to the emitter.  Perhaps you should look at that with
a scope.  If you see it going more negative than about 4V, problems.
Espectially if you don't see a ramp, but instead some kind of flat
(square wave looking) bottom at a negative voltage from 5-7V or so.
That means your poor BJT is zenering, I think.

Need that base protection, perhaps.

Jon

Re: Driving LEDs with a battery pack

Hang on a moment -- unless I'm mistaken, this type of
circuit *relies* on saturation of the core for its
operation. As soon as saturation occurs, the transistor
turns off.

So saturation isn't bad, it's necessary! The only
question is how long you want to let the inductance
charge up before it occurs.

--
Greg

Re: Driving LEDs with a battery pack

I don't think so.  I can do the calculations, and achieve accurate
results from them, without taking saturation into account.  I'll try
and give a more detailed account than I have, if interested.

Jon

Re: Driving LEDs with a battery pack

I think you _are_ mistaken.

No.  Saturation of the core isn't required.  This would work on an air
core transformer, I believe.

....

The base current starts out unaided by any induced voltage on the base
winding, but still turns the BJT on.  Once that happens, though, the
collector drops immediately to near zero (there is no collector
winding current to speak of, at that point.)  This places a near-fixed
voltage across the collector winding, which allows the collector
current to rise according to V/L.  Almost from the first moment this
takes place, there is an induced voltage in the base winding due to
the rate of flux change on the collector winding which adds to the
battery voltage (if wired with the correct orientation, of course) and
this increases the base current to it's initially 'highish' value of
(2*V_bat-Vbe)/R.

At first, the Vce of the BJT remains very close to zero because the
Ic/Ib is well below 10.  (The BJT is severely saturated.)  But as Ic
rises along the ramp of V/L, while at the same time Ib remains close
to fixed, it eventually reaches the point where Ic/Ib goes over 1,
then goes over 10, then goes over 20, etc.  During this time, the Vce
rises, too.  As that happens, the induced voltage on the base winding
declines due to a falling rate of flux change.  That reduces the base
current, but does so exactly at the point when higher Ic requires
more, not less, Ib.  In other words, the aiding voltage by the base
winding is falling and _reducing_ base current right at the point
where Vce is rising and reducing the voltage across the collector
winding.

Suddenly, the beta just isn't enough and the BJT attempts to reduce
Ic.  As soon as it 'tries' to do that, though, the collector winding
immediately responds by reversing its polarity as the only possible
response to allow a reduction in Ic (V/L must reverse its sign.)  But
that immediately causes the base winding to also reverse its polarity
and __oppose__ the battery voltage that is struggling to drive current
into the base.  The whole thing collapses with the battery voltage
opposed by an overwhelming reverse polarity, base current goes to
zero, base voltage goes below ground, etc.  The BJT is off at this
point.

After the collector winding reverses voltage, current is driven now
through the LED as the reversed-sign V/L allows the current through it
to decline along a ramp (the LED maintains a fairly fixed, but
gradually declining V/L.)  At some point, the LED is no longer able to
accept much current (non-linear decline, as well) and the collector
winding's field entirely collapses and has no energy remaining.  It's
voltage goes to zero, so does the induced voltage on the base winding,
the battery is now able to generate some current into the base of the
BJT, the BJT turns back on, a voltage is applied to the collector
winding, the collector winding induces a renewed aiding voltage on the
base winding, the base current rises a bit, and the whole cycle
repeats.

No saturation of a core invoked here.

But I disagree.  And, it appears, so does LTSpice where I don't have
to add any saturation effects to get it to oscillate just fine.

Hope that helps.  Or, if you find good fault with my reasoning, it
will help me.  Either way, it's all good.

Jon