Charging While Wall-Warting

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
smariotti
Posts: 28
Joined: Wed Aug 08, 2007 11:15 am
Contact:

Charging While Wall-Warting

Post by smariotti »

I've been searching far and wee for example circuits for a battery charger that can be switched in and out when the device is plugged into a wallwart or not, but the device can be operated whether plugged into the wall or not.

As with many things electronics-related, my newbie-status makes me wonder when I can't find references to what I want to do whether it's just one of those "no brainer" dead-simple things that people take for granted or it's an idea that I just flat can't describe adequately.

I have a device I want to power. It's going to need 5v (I have a 7805 for that part) and 3.3v (I'm working on this part right now) but all of this needs to be supplied by a set of NiCd or NiMH AA cells (4 or 6 of them, I haven't yet settled as I don't know how many mAh I'm going to need.)

I have an LM317 in hand that I want to use in either a battery charging circuit, a 3.3v supply circuit, or (preferably) both.

Is this really just as easy as calculating the mA output I want based on the cells I'm charging, hooking the output of the LM317 up to the positive battery terminal, and then driving the 3.3v part of the circuit off the same line? That can't be true, can it?

What about using some kind of diode (I have 1N4148's handy) to separate the LM317's output into the circuit-supply (higher current) part and battery charger (lower current via a resistor) part?

To make things even more confusing for me, I suspect I need to make a voltage divider between the LM317's output and the reference voltage input to get the 3.3v I want. I'm feeling a bit like the guy on Jeopardy with the really negative score.

Any help or pointers would be greatly appreciated. Even if it's just "RTFM, n00b" with a references to a FM I can go R.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi there,

So are you saying that you want the charger to turn off when
you unplug the wall wart, or you want both the charger and the
device the battery is powering to turn off?
LEDs vs Bulbs, LEDs are winning.
User avatar
Chris Smith
Posts: 4325
Joined: Tue Dec 04, 2001 1:01 am
Location: Bieber Ca.

Post by Chris Smith »

Your post is not just about its header statement?......


If on and off were your only issue when you plug in the wall wart, a simple relay or SCR/ Triac will do that job.

As to tapping off the main supply to make two other voltages, yes you can do that as well.

You can also add in diodes or the resistor idea for a little more separation but you must also calculate if the power and voltage will allow you to do this.
rshayes
Posts: 1286
Joined: Tue Mar 04, 2003 1:01 am
Contact:

Post by rshayes »

Sometimes you can use diodes to do the switching automatically.

Use a wall wart with enough output voltage to power a battery charger. The output of the battery charger would have a diode between it (anode) and the battery (cathode). When the wall wart is connected, the battery charger will be able to charge the battery through the diode. When the wall wart is disconnected, the battery charger output will be zero, and the diode disconnects it from the battery.

Add a diode from the wall wart output (anode) to the regulator input (cathode). Add another diode from the battery positive (anode) to the regulator input (cathode). Whichever voltage is higher, the wall wart or the battery, will power the output through the regulator. If the wall wart is plugged in, it will be the higher voltage (since you chose it that way), and it will power the battery charger and the regulators. If the battery voltage is higher than the wall wart output, it will power the regulators.

Since the voltage is only a few volts, you may want to use shottkey rectifiers, to minimize the voltage drop in the diodes. This is most critical on the connection between the battery and the regulators. Using diodes rated for currents 5 or 10 times the actual load current will also lower the voltage drop.

You may need to replace the 5 volt regulator (7805) with a version having a lower dropout voltage. A 7805 will require about 8 volts input to function properly.

Remember that your battery pack may be about 1 volt per cell when it is fully discharged.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi there,

Here's a schematic of a battery backup power supply, with a 5 volt
output. Note NiCds are used, not NiMH cells, because NiMH dont
fair as well when being charged through a resistor. Although NiMH
will work here too, they wont last as long as the NiCds.

Note also that no diodes are required on the outputs of the
regulator ic's, so the voltage is very close to 5 volts. The
top regulator takes over when the wall wart is plugged in
as it's output is ever so slighly higher than the lower regulator.
When the input power fails or wall wart is unplugged, the lower
regulator output is higher than the upper regulator output so
the external circuit runs off of the battery power.


Image
LEDs vs Bulbs, LEDs are winning.
smariotti
Posts: 28
Joined: Wed Aug 08, 2007 11:15 am
Contact:

Post by smariotti »

Brilliant!

Thanks, gentlemen. If I do my math right, then diodes will do the trick. This is a perfect learning project for me right now since I'm just getting comfortable with basic of circuit designs using resistors, caps, transistors and 555 timers for driving LED's and piezo buzzers. Power supply circuitry is a great next step since I'm going through alkaline batteries like mad.

I have a handful of LM317/337's I scavenged out of the cast-offs from a neighboring LCoS HD TV company next door to my office. In outsourcing their R&D branch, they had a bunch of throw-away that they let me pick over before it was sent to the landfill and I turned up a ton of SMD stuff, some power supply parts, a bag of 3904's, some useful enclosures, a bunch of various IC's (most SOIC) and so on. I'm chomping at the bit to put some of this together in useful ways.

Thank you for the schematic MrAl! I've studied it, and I believe I understand everything except one minor point. You have a 47 Ohm resistor from the top LM1086's ground pin to ground. Why is that? And why is it absent on the bottom LM1086? It seems like a tweak, and I'm wondering why. Is that to help with the switching behavior when plugging in and unplugging the wall wart? Does adding resistance there somehow increase the minimum potential when it's active?
smariotti
Posts: 28
Joined: Wed Aug 08, 2007 11:15 am
Contact:

Post by smariotti »

Here's a whack at adapting that circuit for 5v and 3v supply. Does this look sane?

Image

The 3.3v regulators I have are some 3.3v LDO regulators from National. I'm not familiar with the 5-pin variety. The two extra pins appear to be SHUTDOWN and ERROR, both are true when low.

The app notes say to pull up to V-input with 10k resistors, so I notated it that way.

http://cache.national.com/ds/LP/LP3873.pdf

The other modification is to use the 7805DT instead of the LM1086-5's.

I'm trying to get my 7.2v battery pack to 5, and then to 3.3 and have both available to my circuit.
rshayes
Posts: 1286
Joined: Tue Mar 04, 2003 1:01 am
Contact:

Post by rshayes »

The purpose of the 47 ohm resistor is to make the output voltage of the upper regulator slightly higher than that of the lower regulator. The regulator with the highest output will supply the load current. When AC power is not present, the output voltage of the upper regulator will fall (no input, no output) and the lower regulator will supply power from the battery.

You want a higher input voltage from your wall wart. The diode going to the battery will drop about .7 to .8 volt, which leaves 6.7 to 6.8 volts. This is insufficient to charge a 7.2 volt battery. If the wall wart produces 12 volts, the voltage availoable to charge the battery is 11.2 volts. The 4 volt difference will appear across the resistor. The charging current will be set by that voltage difference divided by the resistance. If fully discharged, the battery pack may be as low as 6 volts, so select a nominal charging current at less than the maximum charging current for the cells used.

The difference between the battery voltage (7.2 volts) and the output voltage (5 volts) is only 2.2 volts. This is a little low for the 7805 type of regulator. This only gets worse as the battery discharges. You will probably need a low dropout regulator instead of the 7805.

The lower regulator(IC2) and its input capacitor (C2) can be eliminated if you add a diode from the battery positive terminal (anode) to the pin 1 of the upper regulator (cathode) . This diode should be a shottky rectifier with a generous current rating such as 5 amps. This should reduce the drop across this diode to .3 to .4 volts. If the regulator is a low dropout type and can operate with .6 volts between the input and output, this will still allow operation when the battery pack drops to 6 volts (full discharge).

If necessary, this diode could be replaced by a low resistance FET switch, but this is more complicated, since a signal will be needed to control the FET switch.
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi again,

I havent tried a simulation using 7805 regulators, and there is
another slight problem with using those rather than the ones
specified in the drawing. The 7805 regulators might need
a bit more input voltage to work correctly such as 8 volts input
while the regulators specified in the drawing only require about
1.5 volts above 5, which is 6.5 volts to work correctly. The
reason is because those regulators are 'low dropout' type
regulators (a specially designed type of regulator) while the
7805 type is not.

The other point about your drawing is that although the 7.5 volt input
(i assume it's a wall wart) might work because the peaks
will be higher, be aware that you should probably use a
9v or higher type wall wart instead. This is so that you can
choose a charge resistor (R1) that provides a decent charge
current over the range of low line to high line input voltages.
You should design for a min of 15 percent less than nominal
and 15 percent more than nominal, at the very least, and
better than that if possible. Once you do this you will find that
your resistor value comes out too low with input voltages
that are too low and causes too high of a current swing from
low line to high line, but with a higher input voltage the resistor
can be chosen to better keep the charge current constant over
low and high line conditions.
LEDs vs Bulbs, LEDs are winning.
smariotti
Posts: 28
Joined: Wed Aug 08, 2007 11:15 am
Contact:

Post by smariotti »

Thanks for your thoughtful responses. I did some more rummaging through my workshop supplies (boxes of junk) and didn't turn up any low dropout voltage regulators I could use, but did find a 9v wall wart. I have some LM317 adjustable voltage regulators, but in looking at the spec sheets, I think they'd complicate my circuit and confuse me. I did see some app notes in the PDF that suggested applications for battery charging and using the ADJ pin of the regulator to effectively pinch off the voltage when the batteries were charged. It sounds cool and all, but I'd rather pursue the fixed voltage regulators and get a working circuit than run the risk of just getting confused in the midst of this project.

So given a 9V wall wart, and taking into account the considerations mentioned, I did a little more head scratching and came up with:

1. A 9v supply gives the 7805 a voltage difference of 4v, allowing for it to operate closer to its comfortable range for outputting 5v.
2. Assuming a 1v drop across the 1N4004 (worst case?) my battery of cells gets 8v to work with, which leaves 0.8v in head room within which I can adjust the current.
3. I have 300mAh NiCd AA cells at 1.2v each. 6 of them gives me 7.2v and 1800mAh.
4. A rule of thumb I've found for charging NiCd's is C/10 for my 1800mAh for 180mA charging current for 14 hours.
5. To get my 180mA from my 0.8v, I need a 4.4444 Ohm resistor in there. So that means 5 ohm.

I can see what was said about needing a larger voltage source to charge that battery... at 5 ohms +5% tolerance on these resistors means += 0.25 ohms which swings the current from 152mA to 168mA.

A 4 ohm resistor += 5% will yield 188mA to 213mA.

So I'm stuck with choosing between slight undercharge or slight overcharge. I think in this case, though, I'll probably just use a 4ohm metal film resistor (?)

Here's the modified schematic:

Image

Does that sound reasonable? In the future, I see the advantage of using low dropout regulators and will have some on hand. Or maybe I'll figure out how to use the LM317. That thing seems useful.

Oh, and MrAl, how do you run simulations? I use EAGLE to do layouts and as a general circuit notebook program. It'll do simple rule checking, but nothing fancy (unless I don't understand how to use EAGLE which is definitely a possibility.)
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi again,

Well, i mentioned a 9v wall wart off the top of my head, but
really the min here should be a 12v wall wart. The reason for
this is because as the cells age their internal resistance
rises and during charge their terminal voltage can go up to
1.5 volts or so. Since 6 cells at 1.5 volts each is 9v,
that means you need a wall wart higher than that. 12v
would work out very nicely, as you could use maybe a 75 ohm
5 watt resistor for charging. That would provide a decent
charge rate for your 300mAh cells. BTW, 300mAh sounds kind of
low for NiCds, are you sure they are that low?

Some notes....

Your actual charge resistance should be partly governed by
the frequency of power outages you expect to see. Low frequency
means you should charge lightly, high frequency of outages mean
you should charge a bit more.

You have to check your final design at high line and zero
battery voltage to make sure the charge resistor does not
overheat and burn up. BTW, a flameproof type is recommended
here but not mandatory.

Next we have to do a thermal analysis to find out what the
size the heatsinks for the regulators are going to be.
For this we need to know your output current requirements
for both the 5v and the 3.3v lines.

There is free simulation software available at the Linear Tech site.
It's called SwitcherCad II or III. Do a search on their site or
just look for the free simulation software. You draw your circuit
and then do a simulation. It's worth checking out for sure
if you are going to be doing these kinds of circuits.
LEDs vs Bulbs, LEDs are winning.
Robert Reed
Posts: 2277
Joined: Wed Nov 24, 2004 1:01 am
Location: ASHTABULA,OHIO
Contact:

Post by Robert Reed »

Hello MrAl
"There is free simulation software available at the Linear Tech site.
It's called SwitcherCad II or III. Do a search on their site or
just look for the free simulation software. You draw your circuit
and then do a simulation. It's worth checking out for sure
if you are going to be doing these kinds of circuits."

I have seen this available and have been tempted to down load it. Do you know how long the learning curve might be on this?
smariotti
Posts: 28
Joined: Wed Aug 08, 2007 11:15 am
Contact:

Post by smariotti »

MrAl wrote:Well, i mentioned a 9v wall wart off the top of my head, but
really the min here should be a 12v wall wart. The reason for
this is because as the cells age their internal resistance
rises and during charge their terminal voltage can go up to
1.5 volts or so. Since 6 cells at 1.5 volts each is 9v,
that means you need a wall wart higher than that. 12v
would work out very nicely, as you could use maybe a 75 ohm
5 watt resistor for charging. That would provide a decent
charge rate for your 300mAh cells. BTW, 300mAh sounds kind of
low for NiCds, are you sure they are that low?
I found a 12v wall wart that I snipped the connector off of many moons ago. I think with a little creativity and some heat-shrink tubing I should be OK---and I have a 12v supply for my circuit!

You're right. The NiCd cells are 700mAh, not the 300 I'd said. And on the cells themselves is a charge rate they recommend (50mA) so most of my charging math is done. That means my resistor is R = V/I or 11v/0.05A = 220 Ohms.

One last question! (I swear... ;-)

The cells are in series, do I adjust the charge current at all or treat the battery as one big cell for this purpose? Most of the schematics I've looked at have done so.

In some cases where there's a uC involved or a custom charging chip like a Maxim one, I've seen much more complicated circuits that isolate the cells of the battery and charge them in turn. I don't think something like that makes sense for this application if 14 hours per cell for 6 cells requires 84 hours to charge by battery!
User avatar
MrAl
Posts: 3862
Joined: Fri Jan 11, 2002 1:01 am
Location: NewJersey
Contact:

Post by MrAl »

Hi again,

Robert:
I'd say you should be up and running within an hour or two.
It might take a little while to get used to drawing the
circuit, it's a little tricky, but not too bad really.
I'd be happy to walk you through your first circuit
drawing/analysis if you'd like via another thread here
or even PM's here...no problem. Whatever you choose to
do, even if it takes a week, you wont be sorry you spent
the time i promise.

smariotti:
Oh im glad you had a 12v wall wart laying around. That
should do it. The only other concern then is thermal
management...we have to know your output currents.

"The cells are in series, do I adjust the charge current
at all or treat the battery as one big cell for this purpose?
Most of the schematics I've looked at have done so."
You adjust the charge current based on the nominal cell voltage
of 1.2 volts times the number of cells, but also look at the charge
current when each cell is:
1. zero volts each
2. 1.5 volts each
and at 120vac line input at
1. plus 15 percent
2. minus 15 percent
Looking at these operating points tells you what value the charge
resistor has to be as well as what power rating it has to have.
The power rating for example is found from looking at high line
and zero volts for each cell after you have decided on a value
of resistance for the resistor.
Lets take a minute or two to talk about the charging current...
For a 700ma pack and a C/10 charge, the current would be 70ma,
however be aware that a constant charge of C/10 might lead to
cell damage in as little as one year. The cells will still
'work' after a year but they wont hold as much charge as when
new. The reason for this is because the cells constantly
overcharge when the input power happens to be ok. This means
if you live in a location where the power rarely goes out, the
cells will constantly overcharge. NiCd's are made to take this
a bit, but it still reduces their overall capacity after as little
as one year. The better idea is to use as low a charge current
as possible but not too low as to prevent the cells from being
fully charged. This number is a bit hard to find, because as
the cells age it might change. Roughly speaking, C/20 might be
too low so maybe C/15 would be ok, as long as the power doesnt
go out too often of course.
The best way however is to charge once per day
at the C/10 rate for a period of time that is long enough to replenish the
self discharge in one day. The only problem
here is that it takes a timer circuit that can switch the charger
'on' for maybe 30 minutes per day, once per day, unless the
power goes out and then comes back on in which case it would
charge for a whole 24 hours. You may not want to go this route
however, as this requires a micro controller ic and program, so
50ma sounds like a good compromise.

BTW, the charge current flows through all of the cells at the
same time, meaning that at a given charge current one cell takes
the same amount of time to charge as all the cells (all cells
in series). Also, the time to charge is calculated from multiplying
the Ah rating of the cell by 1.4 and then dividing by the charge
current (low charge rates). For any number of 700mAh cells in series,
700 times 1.4 is 980 and divide that by 50 (for 50ma) and you get 19.6
which is almost 20 hours charge time.
The resistor value is selected from the nominal supply voltage
minus the diode drop minus the nominal pack voltage, all divided
by the charge current. For 12v input and 7.2v pack, this gives
you about 86 ohms but 100 ohms should work just fine. At high
line you have 13.8v input nominal and with zero pack voltage
the power in the 100 ohm resistor is 1.9 watts, so use a resistor
with a power rating of twice that or 4 watts, but 5 watt resistors
are more commonly available. For cooler operation use a 10 watter.
Some wall warts will put out more than their rated voltage for
low currents too, so you would have to do a test to make sure
the resistor power rating can handle the extra voltage. For
example, for low currents a 1 amp, 12v wall wart might put out as much
as 17 volts dc, which means the resistor would have to handle almost
3 watts of power, so a 10 watter for this resistor makes a lot of sense.

You still have to mention your output currents so we can make sure
your regulators dont overheat.

.
LEDs vs Bulbs, LEDs are winning.
ecerfoglio
Posts: 108
Joined: Thu Nov 25, 2004 1:01 am
Location: Buenos Aires Argentina
Contact:

Post by ecerfoglio »

I've seen much more complicated circuits that isolate the cells of the battery and charge them in turn. I don't think something like that makes sense for this application
Those systems are used when you want to get a charge into the battery ASAP - some charges seem to promise to get a full charge in only a few minutes :shock: :shock:

At high charging currents you have to monitor the battery's voltage and/or temperature and, with some chemistries like litium do it at cell level to mantain a balance between cells.

With a slow / trickle carge (like C/10 or less current) there is no problem.

In fact, after charging a NiCd or NiMh battery at high rate most charges swich to a trickle current to equalize the cells.
E. Cerfoglio
Buenos Aires
Argentina
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests