Rechargeable Battery Capacity Tester

148,189

342

95

Posted

Introduction: Rechargeable Battery Capacity Tester

Do you have a pile of AA rechargeable batteries in your drawer? Some are old, some are new, but which sets would you bring with your camera on your next trip, and which ones are past their useful life? I like using rechargeable batteries, but I’m certain that some of them are not living up to the stated capacity on the label.

So how good are those batteries? Simple battery testers measure the voltage, but that’s not what we need – we want to find the overall capacity of the battery. How long will a battery last from the time it’s fully charged to the time that the “low battery” indicator comes on your device?

You can see this in action in a video in the last step of this instructable.

Step 1: This Is a Job for a Microcontroller

A simple way to test a battery would be to attach a load resistance to a fully charged battery and monitor the voltage until it drops below its useful value. The amount of time the battery lasts indicates its capacity.
That is a quick solution to the problem, but it involves watching a voltmeter for a few hours. That’s no fun at all. With a microcontroller, like the good old AVR chip, we can make a rechargeable battery tester that does the work for us. My tester puts AA batteries through a discharge test and reports the capacity in milliamp-hours (mAh) so you can compare battery capacity.

Design features
The tester can test multiple cells individually, and display the results on an LCD.
The tester discharges the battery while monitoring the voltage of the batteries. When the low threshold is reached, that cell is done it disconnects the load from the battery. When all tests are complete a series of beeps alerts the user. The tester identifies the type of battery by its initial voltage allowing both NiCd and NiMh batteries to be tested.

The design is based on the ATMega168 (or 328) microcontroller, which has 6 A/D converters on the chip, so these will be used to read the battery voltages and determine the load current. Since each battery will require two A/D converters per cell, the maximum number of cells is three.

I built two of the testers, first using an Arduino board as a development system, and then a standalone device that will be more compact, and free up the Arduino for other projects.

Step 2: Main Parts

Here's what you need:

  • An Arduino board
  • or a ATMega168 or 328p chip and associated parts for the standalone version - see the schematic for details.
  • A Nokia 5110 graphic LCD.
  • Three MOSFETs -- used to switch the resistive load on and off.
  • Resistors to discharge the battery
  • Resistors to interface to the LCD
  • A small speaker typically found in PCs.
  • Circuit Board or breadboard.
  • A holder for AA batteries. This has to be modified so that each cell is wired individually.
  • A case to house the project

Step 3: Circuit Design

The discharging circuit is relatively simple, each battery has a corresponding load resistor that discharges the battery when the FET is switched ON. The switching is controlled by the microcontroller. The microcontroller’s A/D converter is used to monitor the battery’s voltage. A second A/D converter is connected to the FET to determine the current going through the load resistor. The current is calculated by subtracting the FET voltage from the battery’s voltage, which results in the voltage across the resistor. Dividing by the resistance gives the discharge current. Multiply this by the time and you get the milliamp-hour value.

If you look at the code, you’ll notice that the math is not quite this straightforward. The microcontroller reads the battery status every second, calculates the amount of charge drawn during the past second and adds it to the total. In that short amount of time there is only a fraction of a milliamp-hour that has been used, so it would be rounded off to zero if we’re not careful with our integer math. So instead of tallying the number of milliamp-hours, I tally the number of microamp-hours. That will be 1000 times larger so no worries of rounding down to zero. When milliamp-hours are displayed, the charge is divided by 1000.
The code is well commented, so the details can be seen there.



Load resistor
The resistor needs to dissipate a bit of power, so size does matter in this case. Testing NiCd and NiMH batteries (1.2 volts) the power dissipation is under 1 watt, so choose a sufficiently large resistor, or several resistors in parallel. With the relatively large current, be sure to use thick wire for the discharge path.

I considered allowing testing of type 14500 Li-Ion batteries since they are AA size too, but the load resistor would need to be changed to a larger value to accommodate the higher voltage. When the battery is inserted, the program checks the battery voltage, and does not perform the test if detects a Li-Ion battery. If I didn’t do this, the load resistor would draw over 1400 milliamps, which is way over the maximum recommended discharge current of 450 milliamps. The resistor would (in theory) dissipate about 6 watts, and the aroma of smoke would fill the room. This emphasizes the need for your code to test and handle unexpected conditions! I could have designed a circuit to allow testing of Li-Ion batteries by adding an additional FET and load resistor, but I didn’t need this feature.

Power MOSFET ( FET)
This component is like a switch. The output from the microcontroller controls the switch. When the output is high to the gate of the FET, it allows current to pass from the positive terminal of the battery, through the resistor, and the FET then completes the path back to the negative terminal. This discharges the battery over a period of time. I used a FET I salvaged from an old PC (partnumber IRL3103S). Any similar device should work as long as the Drain-to-Source On-Resistance is low. The 2M ohm resistor ensures the voltage read from an empty battery holder is zero volts. Without it, the A/D input will produce unpredictable results.

Display
I used a LCD from a old Nokia 5110 cell phone which was a pain to wire up, but the good news is that the display is available in an easy to use board from Sparkfun - along with the other materials. The Arduino is running at 5 volts, but the display and the control lines need no more than 3.3 volts. There are several ways to accomplish this – I chose using resistors to form a voltage divider. The 1800 ohm and 3300 ohm resistors form a pair that divide the 5 volt outputs from the Arduino to the desired 3.3 volts. In the standalone version I kept the design the same. I could have lowered the microcontroller’s voltage - the AVR chip will run at a lower voltage - but that would cause other design changes, so I kept the same design. The display has a back light, so I wired it up through a current limiting resistor. The Nokia display is a bit mapped display, so I took advantage of that and made animated battery icons to show the status of the three cells. The PCD8544 library makes controlling the display a snap http://code.google.com/p/pcd8544/

The above diagram is a simplified schematic showing one of the discharge circuits controlled by the Arduino.

Step 4: Full Schematics

These schematics show the complete design - one design with the Arduino board, and one as a more compact and inexpensive standalone design.


Disclaimers and other notes

♦The accuracy of the tester won't be perfect, but it does give reasonable results that can be used and compared with other batteries so you can determine whether you want to keep a battery or get rid of it. Please dispose batteries properly.
♦The voltage drop across the FET should be negligible.
♦After the battery test is complete, the tester continues to display the voltage of the batteries – since the load is removed, the voltage will return to what will seem to be an acceptable voltage, but it the battery is really discharged.

♦ The pin numbering for the LCD has confused some readers - note that the LCD I used was pulled from an old cell phone, but if you buy an LCD from sparkfun it will have different numbers. Even comments in the PCD8544 library indicate another different numbering scheme - so just match the signal names and ignore the pin numbering.

Step 5: Source Code

I've uploaded the source code (.PDE file) for you to view and use.
(Update - the .PDE extension is what early Arduino development used. You can rename this to .INO for compatibility with the more recent development environment)
I have placed comments in the code for readability.

Step 6: Design of the Case

Case
A case makes the project complete, and you can find many acceptable metal or plastic boxes. I chose to make one out of wood for a unique custom look. See the video at the end of this instructable for more info.


This part of the project took quite a long time, but I like how it turned out.

Step 7: Feature Upgrade - Because a Home Project Is Never Quite Done!

It was only a few days after completing the project that I realized I needed the ability to handle physically larger cells - in particular, the sub-C cells that I used in one of my other instructables. So I added a connector to the bottom of the device that simply gives access to the wires on two of the battery holders. So now I can test batteries that won't fit in the AA battery holder. When not in use, the alligator clips simply pull out from the recessed connector

Step 8: Video

Step 9: Other Sources for Battery Testing

This project was designed for electronics/microcontroller enthusiasts who wanted to make something that is also practical. However, not everyone has the time, interest and/or ability to build something like this, but do want the ability to test batteries.

The good news is that you can buy something similar like this for about $40. I have seen two such devices advertised on Amazon.
They both do battery discharge testing - and also serve as a charger.

AccuPower IQ-328 Battery Charger Analyzer Tester (AA AAA NiMH NiCd)
and
La Crosse Technology BC-700 (NiCd & NiMH AA/AAA)

I have no experience on either of these devices - so I won't personally recommend either them, but the Amazon reviews are generally positive.

5 People Made This Project!

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Paper Contest 2018

    Paper Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

82 Comments

I made this and made a couple of modifications; like others I modified the code to use the calculated VCC voltage as a reference but I used a decent quality regulator that output 4.998V which gives good results. I added some LED's as well to indicate battery & test status at a distance.

It works quite well but the biggest problem with accuracy was the voltage drop on the battery holder contacts and the wiring to the PCB. There was a drop of 300mV in some cases but even with this its enough to determine if a battery is bad or not. Good quality holders and thick wires would help improve it.

Great project!

DSC_0160.JPGDSC_0162.JPG

I fully recreated your project. I have a lot of Ni-Mh rechargeable batteries that I want to test. My next challenge is to create another one for Lithium batteries. I updated the code using VREF Voltage as suggested in comments. I just need to test it properly and verify the accuracy of the tester! Thank you again to share you project.

20180128_130424.jpg20180128_130428.jpg

Thanks guys for the helpful info. I wanted to ask if anyone has tried the project with a different type of LCD and which one they used

I suspect the method is flawed. You're sampling the voltage at each end of the load resistor: FET drain end and also battery end. I think you use the difference to calculate the V drop across the load. I accept that this is correctly going to give you the V drop across the load, but I don't think that's the information you need. I suspect you really need the total V drop across the load and the FET all the way down to ground. The ground is, of course, 0V. So the Vdrop need only be measured at the cell itself. I don't see the need for the voltage measurement at the FET drain. I think we can get better results with only a single ADC per cell.

Ahhh. Unless your FET's not grounding the resistor?

hi, this is great project

does author or anybody have modification this code for 16x2 lcd or 20x4? or can modify it and share? it could be only for one battery for me
i am beginner and try do this but no results

Wondering if anyone could offer me advice - wired as diagram - 2.2ohm load resistor, 1.25V NiMH AAA battery (voltage measured by multimeter), F12N1OL FET.

Arduino reads around 0.9V and calculated current to be around 380mAh - measured current is 125ma with multimeter and battery voltage around 1.25V.

Load resistor confirmed at 2.2Ohm on multimeter.

Total resistance battery --> load resistor -->fet --> ground (when fet held at 5v manually) is 6Ohms

Tried adjusting ardunio programme to 6Ohm load but didnt make any more accurate with voltage.

What am I doing wrong?

many thanks

What is the Battery Tester telling you? Is it reporting "Test complete" too soon? What does it report as mAh capacity.

You mentioned that you were testing AAA battery - that may require a different load resistor.

I couldn't find any specs on the FET you are using - what is the "Drain-to-Source On-Resistance" rating? It should be very low (the part I used has a 16 milli-ohm rating).

I see that the F12N10L spec says 200 milli-ohms and the FQP30N06L says 35 milli-ohms. I would think this is probably OK.

You said "Total resistance battery --> load resistor -->fet --> ground (when fet held at 5v manually) is 6Ohms"

How did you get this number?

Since you are testing lower capacity AAA batteries instead of AA batteries, I would try reducing the load by changing the resistor to 7 ohms (the 2.5 ohms is drawing too much power) This will reduce the drain to about 171 mA which is more appropriate for the smaller cell. Be sure to change the code to match the resistor's actual value (not the sum of resistor plus FET).

This would explain the lower than expected voltage displayed, and why the tester is stopping early (this is protection from over-discharging which is bad for batteries). I would expect about 300mAh for Ni-Cads and 600 to 800 for NiMh AAA calls (depending on manufacturer and age). Also: Be sure to use thick wire for the discharge path.