# Battery capacity meter

#### moxhamj

##### New Member
I'm pondering a little project to measure the capacity of a rechargeable battery. I did a quick search and one of manuka's projects came up http://picaxe.orconhosting.net.nz/bikeamph.jpg

Here is the problem. You go along and buy a rechargeable battery and it has 2600mAh printed on the side. But is it really 2600mAh? I've got some that are more like 400mAh, even when new. But heck, why not print 2600mAh on the side anyway, as the customer will never know! The best guide to the true capacity seems to be weight - proper ones (eg Duracell rechargeables) are a lot heavier.

Then there is the problem of older batteries. The capacity of a pack is the capacity of the lowest cell.

So - a picaxe 08M, a 10 ohm resistor and a battery holder. A flashing led to indicate it is discharging. V=IR and R is constant so V can be used to measure the current.

Discharge down to 1V and then hold that value. (I'm pretty sure you can discharge a single cell right down to 0V. The problem with reverse voltage only occurs with multiple cells. And it simplifies the circuit not to have a shutoff circuit. Though I suppose you could use a relay or mosfet or transistor).

The biggest problem might be a display. Displaying 2200mAH is 4 digits. Maybe 4 7 seg displays with a daisy chain of HC595s?

Or - there is the active thread at the moment with a LCD display only using 2/3 of the memory space of an 08M.

Or - I wonder if you could just output a voltage on pin 2 of an 08M using pwmout and make the voltage proportional to the aH measured? eg 2200mAh is 2.2V. Run it into an analog voltmeter (or a DVM, which may actually be cheaper than a voltmeter).

So at the very simplest level, an 08M, 100R resistor, reset button into 1 pin, pwmout of one pin, readadc on one pin, and flashing led on one pin to indicate it is discharging. I think that is all it needs.

Hmm - what about flashing the led a different number of times to indicate a number, eg 11 flashes then a pause is 1100mAh. Then you don't need a display.

Any other ideas?

Last edited:

#### goom

##### Senior Member
Common wisdom suggests that NiMH or NiCad cells should not be discharged below 1.1V, or they could be permanently damaged. They have little capacity left at 1.1V anyway.
"Good" (i.e. expensive) chargers usually provide a measure of capacity when charging and discharging.

#### LizzieB

##### Senior Member
If you want the measurement to be somewhat comparable to the manufacturer's rating then you need a constant current discharge of 0.1 times the capacity, e.g 260mA for your 2,600 mAh unit, not a simple resistive load. Morse code is a single pin data readout solution.

#### Haku

##### Senior Member
If you just want to charge AA/AAA batteries to their maximum capacity without damage and also be able to find out their true capacity (useful as they degrade over time), get one of these, individual LCD screens for each battery to monitor time/voltage/mA (charge or discharge rate)/mAh:
http://www.amazon.com/Crosse-Technology-BC-700-Battery-Charger/dp/B000RSOV50
I got one earlier this year and it's been so useful, it can do an automatic charge/discharge/charge/discharge cycle to 'rejuvinate' the battery and get it storing more energy than if it was just charged with a cheapie charger, but can take days when you set the mA low for the charge/discharge cycle.

However I can see why it would be useful to be able to build your own AA charger circuit for projects where you don't want the hassle of swapping batteries out and can just plug a charging lead in.

Last edited:

#### moxhamj

##### New Member
Ah, a charger with a capacity meter. That looks interesting.

Re the discharge, yes, 0.1C so at 1.2V average might need to change the resistor. To get it exactly 0.1C, could set it so it is 0.1C at 1.1V (250mA, 1.1V=4.4R) then pulse the discharge say at 90% ratio if the battery is at a higher voltage so the current stays on average at 0.1C. (Though of course C is unknown and may be 400mAH, not 2500mAH) And a switched discharge circuit could do the power off at 1.1V as well. So - one transistor eg BC337 and a resistor.

And no reset button is necessary as the picaxe could start when it detects voltage on the battery pin, ie starts when the battery is inserted.

Last edited:

#### manuka

##### Senior Member
This is all complicated by battery age, load history & ambient temperature! The Forum's electrochem. expert no doubt will shortly weigh in with deeper insights...

#### BeanieBots

##### Moderator
I've posted several schemes here for Pb technologie which would work just as well with other technologies.

NiCd and NiMh can be discharged down to 0v but it's not good practice. It's well known that Pb suffers the deeper the discharge, but all the other technologies also suffer the same issue but to a much lesser extent.

You are quite right that there are many rogue batteries out there with markings such as 2700mAH and clearly only containing enough chemicals for 500mAH. However, even a genuine 2700mAH cell is only likely to give 500mAH when brand new or been left unused for a few years. This is because the cell needs to be 'formed' prior to use.

These days, cells are often 'formed' prior to sale but if it has been in stock or your cupboard for many months or even years, the process will need to be done again before full capacity can be achieved. So, don't be too hasty in throwing out those under capacity units. Try re-forming them. A quality charger will have a function for doing it. Otherwise, simply charge at constant current of C/20 for 48 hours before first time use. Then discharge down to 0.9v and repeat. This will need to be done up to 5 times before full capacity is obtained. Also, periodicaly discharge to less then 0.8v to prevent dendrite formation which can cause internal shorts worste case and high self discharge on a good day.

I'm talking solely about AA cells here:-

There is also the confusion between capacity and charge/discharge rate.
A larger capacity cell (NiMh) such as the one made by GP claims 2900mAH.
If you discharge it at more than about 200mA, you will be lucky to get 500mAH out of it. The electrodes are so thin with that amount of chemical that they simply can't keep up. A unit of lower capacity will give you more AH at higher currents. Confusing, yes, but a fact none the less. Similar issues apply to charging. Charge a 2900mAH GP NiMh cell at more than 500mA (C/6) and it will quickly vent and die. However, a 500mA cintered cell unit could be charged at 2000mA (4C) with no ill effects unless over charged.

Conclusion, bigger is NOT always better and won't always give you more AH.
It depends on how you use them.

EDIT:
If you want (what I call) a budget charger, try something like this.
http://www.mahaenergy.com/store/viewItem.asp?idProduct=423
The dirt cheap ones are simply battery destroyers and the very high capacity cells will be destroyed by them very quickly.

Last edited:

#### hippy

##### Technical Support
Staff member
Discharging a battery can be done through a PICAXE-08M and others; select an R which will give the required discharge rate ( limited to I/O sink current though ), connect from battery + to an ADC pin; when READADC you can read the voltage, when LOW you will be discharging via the R, a HIGH will charge the battery but also limited to I/O pin sourcing current limit. You can use multiple I/O and multiple R to increase the current up to the port current limit.

I did some experimenting with a PICAXE-08M charging and discharging single cells and the project worked well, being able to detect battery present, discharge, and detect positive or negative delta-V when the battery is charged. That and more comprehensive battery charging projects should be somewhere on the forum.

#### flyingnunrt

##### Senior Member
Could youi use something like this
http://delabs-circuits.com/cirdir/theory/tutors/doc00009.html
to give you a constant load.
and time the discharge to a cut off point. to 1.0 volts or maybe even to a delta dI/dt point and then display the percentage of time that discharge took to get to the cut off point.
ie if 1000 mAh pack is drained at say 100 mA then 100% capacity should run for 600 minutes. so for example a 750mAh capacity battery pack would only last 450mins approx. (450/600*100=75% capacity)
You could then process this further depending how you want the information displayed.
Plan B:
Just use SANYO eneloops.

#### BeanieBots

##### Moderator
Agree with flyingnunrt on both circuit idea and the use of SANYO eneloop cells.
The enloop cells offer extremely good shelf life and do what they say on the tin. Their 2000mAH capacity might seem smaller than some of the 'others' available and they may be a bit more expensive but extensive testing has proven them to be a far superior battery than most of the others claiming similar or more capacity.

Last edited:

#### manuka

##### Senior Member
Wise words BB -and initially a mere 34 minutes later as well! I confess to an electrochem. background myself, but decades of hands on recharging (mostly Pb-acid/Ni-Cd/NiMH,Li-ion but also such "exotics" as NiFe & Zinc Air) has left me a tad cynical about rigid approaches.

Bells & whistles may be nice, but the field can be as much an art as a science. I've brought cordless drill Ni-Cd batteries back to life when others swore they were useless, but equally have sworn at new offerings (NiMH) that die prematurely. My el cheapo pocket charger (US\$5 !) leaves digital camera AA NiMH more energetic (= more pix) than a delta-V smart charger costing 10 times as much.

We're not dealing with squeaky clean capacitors of course, and all manner of unrelated side reactions,load profile & physical effects (perhaps contact corrosion or mere dehydration!) may be also at work. Consider the old skin flint trick of biting the battery case (ARGH!) or gently tapping the top terminal of C-Zn AA/AAA cells. This may move non depleted chemicals into an active position, & possibly gain a few minutes extra use. Even warming AA cells to body temperature may bounce them back to life in freezing conditions. FWIW such survival knowledge may save your bacon...

Stan. (owner of a still working 38 year old Sanyo AA NiCd - not an Eneloop!)

Last edited:

#### BeanieBots

##### Moderator
Indeed Stan, there are countless pages of theory published out there and some really wild claims including the "tesla charger" which (wait for it) even claims of over-unity charge methods!

Nothing beats good old hands on experience with batteries and 'best' methods vary considerably between manufacturers both in theory AND in practice.

The latest high capacity offerings in the AA range can be VERY fragile on both charge and discharge. IMHO, anything over 2000mAH should be avoided unless it's for lowish current use and really does require the higher capacity.

VAPEX make a good 2700mAh cell.
The VANSON 1800mAh unit is a good all rounder.
Only ever tried 10 units made by "ACTIV". Eight were DOA
As for GP. Don't. Just don't
Anything more than 100mA into/from their 2900mAh unit will kill it
Their 600mAh unit can take a fair bashing but 600mAh is a bit small these days.

Not tried many of the latest 'hybrids' but "Eneloop" and "Instant" have stood up well.

Impressed with your 38 year old cells. I thought I was doing well with some NiCd cells now 22 years old and still at 75% capacity.

#### manuka

##### Senior Member
Make that cell singular. They were a pair, but about 15 years back (just pre NiMH) someone nicked one during a class handround. Brand names for Low Self Discharge (LSD) NiMH batteries include -

AccuEvolution from AccuPower,
Hybrid from Rayovac,
Eneloop from Sanyo,
Infinium from Panasonic,
ReCyko from Gold Peak,
Instant from Vapex
Hybrio from Uniross.

I've only used Eneloop, but agree on their performance. Mmm- that LSD acronym could be confused...

#### BeanieBots

##### Moderator
I prefer £Sd Doh, given away my age!

I'll have to give some of those other LSD units a try.

#### manuka

##### Senior Member
Stick with electrochemicals- fewer side effects. And as for £sd - swap you a 1948 thrupence for a pre war ha'penny?

Showing MY age - useless fact of the day -apparently Lucy herself has just passed on. She was at pre-school with John Lennon's son, Julian, when both were aged 3. It was Julians childish picture of her that inspired his Beatles dad to compose the 1966 song "Lucy in the Sky with Diamonds".

#### BeanieBots

##### Moderator
Despite sifting my change for years, never did find a 1933 ha'penny.
Still got a few fathings somewhere though. They went out around the same time I came in.
Your mention of the thruppence reminded of a school chum who realised it was the same size as a BC light fitting and thought it would 'amusing' to fit one between bulb and socket.
Actually, it WAS rather amusing in a spectactular sort of way.

Anyway, I think we digress a little.
Where's Doc gone?

#### manuka

##### Senior Member
Well at least we're back on an electrical topic! Perhaps you shouldn't have mentioned that thrupenny party trick, as all manner of global Forum lurkers will now be eyeing their local loose change & bayonet fittings. ES lamp housings thankfully preclude such mischief.

#### flyingnunrt

##### Senior Member
Stan. (owner of a still working 38 year old Sanyo AA NiCd - not an Eneloop!)

So how much capacity does it have now?

#### moxhamj

##### New Member
Doc is here. Frantic at work. 31 patients in 3 hours and they are still coming in the door. Will post something intelligible when it quietens down...

#### Andrew Cowan

##### Senior Member
I did this (see a post somewhere in the finished projects system).

To maintain a constant R, I used a shunt resistor to measure current (0.33 ohms), and a FET (PWM into the gate) to act as the load resistor.

The PICAXE could keep the current within 0.05mA.

Worked very well and simply!

A

#### manuka

##### Senior Member
And it's after local midnight! Are these humans or koalas? Side effects from drinking too much local firewater to settle last weeks red dust maybe? Baby boom as a result of the early 2009 heat wave? Popped in to read the latest "Silicon Chip" - which has a brilliant coverage of a new far IR thermal image viewer (Aust \$5000 !). I've used such imagers extensively, but not realised termites could be spotted deep in woodwork with these viewers. You might consider one for the waiting room to allow patients to do some early thermal diagnosis.

You'll have to be firm Dr-A - tell them medicine is just your day job.

So how much capacity does it have now?
This Sanyo AA NiCd I'd say still has about half of it's original 500 mAh, but self discharge is higher than I recall from the 1970s. It's sat neglected for years(& endured several zaps) however.

Thought: Given the nightmare Samoan rumble, maybe the SiChip Sept. "PEBBLE" earthquake issue is in demand?

#### BeanieBots

##### Moderator
Manuka, you mentioned zaps.
Have you ever actually tried "zapping" which alegedly gives a permanent extra few 10's of mV to the terminal voltage.
I know several car racers who swear by it.

Tried it myself, not very scientifically documented or controlled but I believe it did yeald an increase. However, all units that were "zapped" failed with internal shorts a dozen or so charges later while those that were not "zapped" did not.

#### Andrew Cowan

##### Senior Member
I 'zapped' a NiCd cell which wouldn't charge, and was at around 0.2v.

It seemed fine after that.

A

#### manuka

##### Senior Member
BB: A few mV! My past zaps have been pretty subjective & largely confined to NiCd AAs (when they were costly) & odd size cordless drill NiCd cells.

#### moxhamj

##### New Member
Back online. \

Andrew Cowan, I'll have to check that circuit of yours, it looks interesting.

There are all sorts of levels of complexity in such a project. You can have a discharger with just one 08M. Add a charger with a couple more transistors, so now it is a charger/discharger/exerciser/rejuvenator. But that gets complicated, and needs switches to select the function and then a display and suddenly it is up to a 20X2 with an LCD. Not impossible by any means, but my eyes do glaze over a bit when I ponder the tedium of writing menu code and code to manipulate strings one byte at a time. I'm tending to use CP/M boards once menus and strings are involved as the code ends up easier to write.

But in terms of a little device that can tell you the approx capacity of a battery, I reckon an 08M could do this. Mind you, I'm very impressed with that charger mentioned on the first page. I read through some of the documentation, and they talk about being able to 'match' cells. They mention a figure of +/-5% so you can have a pile of batteries of various ages and brands, and you can then select four (say) to go in your xyz device and if those 4 are closely matched, then when one goes flat, the others go flat very soon afterwards, which limits the reverse charge state which is the killer of many batteries.

Thinking about that more, I think capacity matching may well be a key to prolonging battery life.

Hmm - ideally what you want is a bank of 20 battery holders, and you can put your entire collection of batteries into it, set it going and it spits out the capacity of all of them ranked 1 to 20 with the capacity and then you can select a group that look close to each other.

#### moxhamj

##### New Member
Fantastic work. Reading it all now...

#### BeanieBots

##### Moderator
@Andrew, I talking about "zapping" which alegedly raises the cell working output voltage slightly on a good working cell to increase maximum power of a racing pack as apposed a 'zap' which can (and often does) kick a duff cell back into life.

@manuka, a few 100's of mV.

Just trying to find any real life experience on "zapping".
Myth or anything in it? Gut feel is myth.

"Zapping" = typically the application of around 12v (from a car battery or similar) at several 10's or even 100's of amps for a fraction of a second directly across a 7.2V race pack with the idea that the on load voltage will be slightly (and permanently) increased thus giving improved perfomance.

'burp' charging can certainly reduce internal resistance on tired cells and a good high current 'kick' will certainly move the electrolyte around which again will help a tired cell, but does anyone have any conclusive results on good cells?

Sorry Doc, hijacked again.
For simplicity I don't think you can beat using PWM into a moving coil meter to show capacity. From a 5v supply using just a resistor for current regulation should be reasonably constant over the voltage range between full (<1.4v) and flat (>1.0v).

If all you want is comparative capacities rather than absolute, it should work quite well.
If the cells you are testing are old and have been lying around unused for a while, I'd go for a fully automated hard coded 'refresh' sequence.
Something like:
Discharge to 0.8v
48hr charge at C/20
Discharge to 0.9v
24hr charge at C/10
Measured discharge to 1.0v

OK, it will take a few days to give you a result but at least you will KNOW that any low capacity is the result of a dead cell rather than one which required reforming from lack of use.
Also, all tested units will start from a known condition which a simple charge/discharge would NOT gaurantee.

Or, simply get yourself the unit I linked to earlier.
I have one and rate is as one of the best. My sole criticism is that the lowest charge current is 200mA and the default (if you just insert a cell and forget) is IMHO too high at 1A

#### moxhamj

##### New Member
No problem hijacking. Often goes off in interesting directions!

Re zapping, my understanding was that it blew away the tiny dendrites that formed. Mainly a Nicad problem vs NiMh. My practical experience is that cells that needed zapping got only a few more charges and that was at greatly reduced capacity.

Re capacity, exact mAh may not be necessary. +/-10% is ok on the true value. Discharge through a fixed resistor at roughly 0.1C. Calculate V at regular intervals and sum the values. Gives the area under the curve that Andrew was seeking. BB's comment, I agree; there is something cool and 'steampunk' about a panel meter driven by pwmout. http://www.futurlec.com/Panel_Meters.shtml and scroll down - only \$10. Even though LCD and LED displays are slightly cheaper, I like panel meters!

#### BeanieBots

##### Moderator
Full agree about panel meters Doc.
My PV system has a really nice ex-aircraft 270 degree movement fuel gauge which convieniently shows "Empty" & "Full" at each extreme. Consumes a mere 1mA at FSD which is much less than any serial LCD offering.

If your current is fairly constant, then measure & time will give pretty good results. If the load is very variable, has fast changes and long periods at very low current, then you might like to consider an analogue approach to the integration as employed here:-

#### fernando_g

##### Senior Member
speaking of batteries

I've been an owner of a Honda Civic hybrid for 4 1/2 years. These vehicles use a large array of NiMh batteries, so my comments may be useful on this thread.

At the beggining of this year, I started noticing that during my daily commute, the freeway on-ramp acceleration would deplete more lines in the SoC indicator. Additionally, on my return home, the freeway off-ramp would not charge back as many lines. The change was very small, noticeable only to someone who is driving daily the vehicle, but concerned me that this was an early warning of impending battery pack failure, whose replacement can be expensive.

Anyways, I mentioned this to the dealership's service technician the next time I took it for service. He consulted the computer screen, and advised me that the vehicle would have to stay overnight.

Next morning that I picked up the vehicle, I immediately noticed an improvement, and this improvement has lasted for many months now, so it was not just a band-aid. The batteries were truly rejuvenated.

What did they exactly do tho the pack? The tech only said that they had connected it overnight to a special Honda "charger".

Exactly what that charger does, is a big mystery, but I can bet a couple of beers that both Honda and Toyota have done tons of research on rechargeable batteries, and must have some interesting -but propietary- charging algorithms.

#### BeanieBots

##### Moderator
I don't want to spoil your idea that they "rejuvinated" your batteries but I very much doubt it. Under constant use, rejuvination is not required.

With a very large high voltage pack such as those used in Hybrid car, a periodic equalisation charge is required. (the controller should do this automatically. You may sometimes spot it doing it, eg engine doesn't cut even when SoC = full) Also, the SoC meter automatically degrades the battery performance over time in a pessimistic manner to prevent any real damage to an individual cell. In other words, the SoC indicator gets told that the capacity is lower than it actually is.

Most hybrid controllers are very gentle on the batteries in order to get maximum life from the pack. Typical algorthyms will not permit less then 60% discharge or more than 80% charge.

A gentle overnight charge will safely take the pack up to 100% followed by a discharge down to 80%. This results in a slightly higher terminal voltage for the same REAL SoC and hence the SoC meter THINKS the capacity has increased. (the controller's USEABLE capacity HAS actually increased but not the ACTUAL battery capacity)

Alternatively, they may have actually replaced just one weak cell which will bring up the capacity of the whole pack.

#### fernando_g

##### Senior Member
BB:
you may be right, "rejuvenation" may not be the best word to describe the process, most likely it was an equalization consisting of several slow discharge/charge cycles.

You are also correct in pointing out, those controllers are gentle and sophisticated, for instance when it is very warm the controller delays the recharge of the battery.

Hybrid naysayers are the very first to point out, the battery pack's replacement costs. Thus I'm sure that optimizing battery pack life expectancy is a primary goal for the automakers.

#### BeanieBots

##### Moderator
Unfortunatley there are still a lot of naysayers that don't have a clue how a hybrid car works. It's not helped by the likes of Jeremy Clarkson doing a comparison with a Golf GTi when being driven at 70mph down a motorway

Maybe if he'd compared them in stop-start traffic for a few miles on the M25 during rush-hour then his conclusion would have been different.

Toyota offer a lifetime gaurantee on their battery, so replacement cost doesn't come into it. Also nicely demonstrates their faith in the battery/charger.

#### LizzieB

##### Senior Member
Toyota offer a lifetime gaurantee on their battery, so replacement cost doesn't come into it.
Not in the USA, it's 8 or maybe 10 years depending on the state. Plenty to be found on ebay...

#### BeanieBots

##### Moderator
IMHO, even 10 years speaks volumes.
Bet you no replacement fuel tanks come with more than 1 year!
(no, that's not a challenge for anyone to spend hours googling for one)

#### Haku

##### Senior Member
Back on the topic of charging NiMH AA's, does anyone have a circuit+code to use a Picaxe to simply peak charge an AA without damaging it?

I'd like to be able to build an AA charger that peak charges the batteries and changes an LED from red to green signalling a charged battery, one that can individually monitor and charge a bank of 8 AAs at once, most likely have to use 2 or more Picaxes to pull that off.

#### moxhamj

##### New Member
How ironic Haku - I took your advice in post #4 and went and bought a proper charger. It works really well. My Duracell batteries rated at 2600mAh are indeed 2650mAH. My dodgy no name no brand batteries rated at 2200mAh are in fact 180mAh. No wonder the kids have been complaining about only getting 3 songs out of their MP3 players!

This sort of proper charger (eg La Crosse BC700 or MAHA MH-C9000) has all sorts of modes including one which rejuvenates cells by cycling them over about 3 days. This process really does work and you can see the capacity rising back to where it ought to be.

My conclusion from this is that battery charging is a lot more complicated than it first appears. At the very least, it involves some algorithms to pick the small voltage peak when charged and a display and a keypad to enter parameters like the charge rate. It is more than just a constant current, as this is what my other chargers do, and the measured capacity is lower than it should be and this clever charger is managing to get the cells back to that original capacity.

Maybe it can be done with a picaxe, but it would probably be an 18X minimum if it needs to do the display etc. And measure volts on all cells independently.

My conclusion is that it is cheaper to buy a proper charger! But that doesn't mean it couldn't be a good challenge for someone wanting to do it with a picaxe.

Last edited:

#### Haku

##### Senior Member
My conclusion from this is that battery charging is a lot more complicated than it first appears.
I think you're right, I have a BC700 and it's a really nice charger, only letdown is the fiddlyness of the settings when you want to put all 4 in the same charge/discharge mode & amperage at the same time.
I lent it to my mum so she could properly charge her batteries for her camera when she went on holiday and really liked it so now I got to get her one

The other drawback is it can only deal with 4 batteries at once when there's times I'd like to charge 8 (sometimes more) at once, hence asking if there was already a circuit+code for a Picaxe charging setup.

Have to say I'm dead impressed with the low self discharge AAs you can get, using Uniross Hybrio now.

#### BeanieBots

##### Moderator
Agree with every word Doc.

I think Hippy posted diagram & code for a delta-peak single cell charger.
I knocked up a PP3 type type delta-peak charger but never posted it because it used all manner of components not readily available. (because I had them rather than it needed them). It used the 'burp' method for rapid charge.

Have a look at my Pb charger for some inspiration.