Você está na página 1de 10

Home Sign Up!

Browse Community Submit


All

Art

Craft

Food

Games

Green

Home

Kids

Life

Music

Offbeat

Outdoors

Pets

Photo

Ride

Science

Tech

Rechargeable Battery Capacity Tester


by BrianH on February 8, 2011

Table of Contents
Rechargeable Battery Capacity Tester . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Intro: Rechargeable Battery Capacity Tester . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 1: This is a job for a microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 2: Main Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 3: Circuit design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 4: Full Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 5: Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Downloads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 6: Design of the case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 7: Feature Upgrade - because a home project is never quite done! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Step 8: Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Intro: 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 Im 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 thats not what we need we want to find the overall capacity of the battery. How long
will a battery last from the time its 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. Thats 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 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.

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

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 5510 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 microcontrollers A/D converter is used to monitor the batterys 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 batterys 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, youll 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 were 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 didnt 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 didnt 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 5510 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 microcontrollers 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 following is a simplified schematic showing one of the discharge circuits controlled by the Arduino.

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Image Notes
1. The signal from the Arduino controlls the FET which acts as a switch
2. FET (or MOSFET) acts like a switch that allows cirrent to pass from Drain to Source when the Gate is 'high'
3. The Load resistor 'burns off' the charge from the battery. This circuit could dissipate up to 1 Watt, so be sure to get a resistor that can handle the load.

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.

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Image Notes
1. The 2 mega-ohm resistor was needed to ensure that the analog input would
read zero volts when the battery was removed. In Engineer speak, "the input is
no longer floating".
2. Current limiting resistor for the backlight LEDs
3. Voltage divider resistors ensure that the 5V output from the Arduino is
reduced to 3.3V for the LCD. THe top is 3300 ohms, the bottom one is 1800
ohms

Image Notes
1. Voltage divider resistors ensure that the 5V output from the Arduino is
reduced to 3.3V for the LCD. The top is 3300 ohms, the bottom one is 1800
ohms
2. Voltage divider resistors power the 3.3V LCD. The top is 3300 ohms, the
bottom one is 1800 ohms
3. Voltage Regulator provides clean 5V DC to the Arduino
4. ATMega 168 or ATMega 328p
5. The 2 mega-ohm resistor was needed to ensure that the analog input would
read zero volts when the battery was removed. In Engineer speak, "the input is
no longer floating".

Image Notes
1. The Arduino has a 3.3V supply, so you can use that to supply the LCD
directly. The standalone design does not have a source for the 3.3V, so I used a
voltage divider instead.

Step 5: Source Code


I've uploaded the source code (.PDE file) for you to view and use.
I have placed comments in the code for readability.

File Downloads

Rechargeable_Battery_Capacity_Tester.pde (19 KB)


[NOTE: When saving, if you see .tmp as the file ext, rename it to 'Rechargeable_Battery_Capacity_Tester.pde']

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

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 being laid-off from my job recently means I have time on my hands.
Is there an employer in the South Jersey area looking for a Senior Embedded Software Engineer with a Electrical Engineering background?

Image Notes
1. Back cover - routed out to allow room for components
2. ATMega microcontroller
3. Voltage regulator
4. Three MOSFETs
5. Load resistors several in parallel to make the 2.5 ohm resistance and at least one watt of dissipation.
6. Back side of battery holder. Yes - I know a four cell battery tester would be 'nicer', but I ran out of A/D ports on the ATMega168.
7. Input power connector
8. Hole to mount circuit board to front

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

Image Notes
1. Connector is from a PC power supply. The connector and wire need to be able to handle the current without significant resistive loss.
2. Sub-c battery with solder tabs
3. Leave these two empty while testing external batteries

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Step 8: Video

Rechargeable Battery Capacity Tester

Image Notes
1. No Battery installed in slot #3
2. Battery in slot #2 is being detected.
3. Battery in slot #1 has been detected and is being discharged.

Image Notes
1. When testing is complete this reports the results of the three batteries
2. In this test, the third battery was not installed as indicated by the icon

Related Instructables

Arduino True
Power your
Battery
Arduino/AVR
Capacity Tester with a Hand(LiCranked Battery
Ion/NiMH/NiCD/Pb)by nevdull
by moris_zen

Simple LED AA
Battery Tester
by
misteravocado5

Self Sufficient
Arduino Board
by p2man

Playmobil 3V
LED Tester by
Brennn10

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Easily recharge
alkaline
batteries! by
CalcProgrammer1

Comments
20 comments Add Comment

paulryanmini says:

Mar 10, 2011. 6:29 AM REPLY

hi trying to build your circuit it is great. i have the following lcd:


http://www.dfrobot.com/index.php?route=product/product&keyword=I2C+LCD+Shield&category_id=53&description=1&model=1&product_id=135
how would i change the code for it to work with it\/ or would i be better buying a 5110 screen?
thanks

newrev426 says:

Mar 2, 2011. 6:33 PM REPLY


Can you suggest a specific mosfet? Would a TIP31A transistor work as well instead? Can handle 3A and they seem to be a lot cheaper what is your
professional opinion?

BrianH says:

Mar 7, 2011. 2:52 PM REPLY


What we need for the circuit is a device that will switch on the resistive load with as little additional resistance as possible. That means the voltage
between the Collector / Emitter should be as close to zero as possible.
I looked at the spec sheet, and the TIP31A says the Vce when fully saturated is 1.2 volts. That's WAY to high for this circuit. The transistor may be able
to handle the current, but the effective resistance will be too high (at 1 amp it would be about 1.2 ohms). The 3103 MOSFET spec sheet specifies the
Resistance to be about .012 ohms (12 milli-ohms). (Don't confuse little 'm' milli with big 'M' Mega Ohms)
I find that Transistors spec sheets talk about the voltage drop across the Collector and Emitter, while MOSFETS typically give ratings of the resistance
across the Drain and Source.
That said, you can probably find an inexpensive substitute with similar characteristics, but it looks like MOSFETS are the way to go. I chose the one I did
because it was available (on an old PC motherboard). I then Googled the partnumber looked for the RDS and I was in business.
I see that RadioShlock also sells the IRF510 MOSFET, but the spec sheet says it has a Drain to Source Resistance of 0.54 ohms which is a bit high
too. Mouser.com, Alliedelec.com and Jameco.com carry a large number of MOSFETS - under a dollar each. Check the spec sheets and look for low
Drain to Source Resistance (RDS)
Here's a link I found that discusses Vce (for transistors):
http://www.electronics-tutorials.ws/transistor/tran_4.html

newrev426 says:

Mar 8, 2011. 8:49 PM REPLY


Wow I was expecting a yes or a no but man I love the response! I appreciate the time you spent and you explained it very well. Trying to go to school
for this stuff and I can always use more info. Thanks!

duncan_a says:

Feb 13, 2011. 10:45 AM REPLY

Brilliant - just what we need in our house...


Only problem is, I can't locate Nokia 5510 LCD screens on eBay on either side of the Atlantic (I'm in the UK) - are there other screens that would work?

arnefl says:

Feb 23, 2011. 2:23 AM REPLY

eBay item 200399485981 from seller szdigitalsquare $8.00 and free shipping. It also has an adapter PCB

BrianH says:

Feb 14, 2011. 7:09 PM REPLY

Sparkfun.com sells them for $9.95 and ships internationally. They also have other related goodies.
http://www.sparkfun.com/products/10168
Their display is a lot easier to work with. I had to carefully cut the circuit board that was in the phone and solder small wires to make the display usable.
But since I had it on hand I made use of it.

augur45 says:

Feb 13, 2011. 1:08 PM REPLY


I didn't immediately get that the part specified is the LCD FOR the Nokia 5510 cell phone. I googled "nokia 5510 lcd" and found that the LCD for the
Nokia 5510 is widely available as a repair/replacement part online in the price range 4.00 to 9.00 GBP (plus tax and shipping). You can probably get one
locally from a cell phone store that does repairs.
Here are a few links I found:
http://www.wholesalemobilephoneaccessories.co.uk/nokia-5510-lcd-new.html
http://gsmserver.com/shop/spares/lcd/nokia/lcd_for_nokia_5510_with_keyboard.php
http://www.mytrendyphone.co.uk/shop/original-nokia-5510-1269p.html
http://www.blueunplugged.com/Nokia-LCD-Lens.aspx

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

KT Gadget says:

Feb 19, 2011. 11:37 AM REPLY


This is a great instructable and I've been trying to find something that would test a lot of the rechargeable batteries I have at home. Gonna try and make this
when I get the time.
One question though, does it matter what the wattage has to be for the load resistor or does it?

BrianH says:

Feb 20, 2011. 4:49 AM REPLY

Yes - it will need to be 1 Watt or larger (See step 3).

ironsmiter says:

Feb 8, 2011. 9:41 PM REPLY

ok, so Quick note for some of us... .PDE files open well in "wordpad" on windows systems.
Was just trying to look at the code, to determine what, if anything, would need to be changed besides the FET and load, to change it into a 18650 capacity
tester.
AA batteries are nice, but nothing says power to weight like good, used laptop battery cells.
As a note, contrary to the code notes... a fully charged Li-Ion will read 4.2V NOT 3.6.
I'll have to dissect the code when I'm not so tired, unless you already have it sitting around? ;-)
I have a feeling there's going to be more to it than swapping 2 components, and a few variables. I think it best to simplify, and use a separate tester, instead
of trying to cram all the functions into one little PIC. But I could be wrong. I don't have much experience with micros, other than burn-and-play with other
peoples code.

BrianH says:

Feb 12, 2011. 11:42 AM REPLY


I double checked my research, and you are correct - - it appears that the peak is 4.2, while the nominal charged cell voltage is 3.6 or 3.7 volts.
Thanks for the correction.
My tester will perform correctly since I disallow testing of anything over 1.7 volts.

ironsmiter says:

Feb 9, 2011. 7:07 AM REPLY

ok, just thought I should re-comment....


This is GREAT looking project.
really well executed.
and useful to boot.
And the commenting in your code is VERY helpful to those of us just starting in the micro-controller arena. Bravo and 2 thumbs up!
And freehand routing the enclosure with a drill press? Impressive!
Thanks for your contribution to our collective knowledge.
My previous comment was driven more though despair at my lack of knowledge in this area, than from anything lacking in your 'Ible.
If you find the time or energy, it's be great if you could show the modifications needed for different battery types. A 'universal' modification list, to handle
things like li-ion, li-po, 6/12V SLAs...
From the hardware standpoint, It still looks like it would only require recalculating the load resistor, making sure the mosfet can handle the current, and
using different battery terminals. but the software code... I think that's a little beyond me at the moment :-(

jimk3038 says:

Feb 10, 2011. 7:57 AM REPLY


Without digging into your code, I'm wondering, what voltage do you consider the battery to be drained. In other words, when do you stop draining the battery
and consider it dead?
By the way, nice write up. Thanks.

cachehiker says:

Feb 10, 2011. 3:03 PM REPLY

0.95 Volts.
It's a constant defined in the first page of code.

Spokehedz says:

Feb 10, 2011. 11:46 AM REPLY


You are my PERSONAL hero! I have piles of the 168's laying around from upgrading all my 'duinos to the 328... So this is going to be a nice use for them
and all my piles of rechargeable batteries.

jrossetti says:

Feb 8, 2011. 10:08 PM REPLY


I know this may be a really dumb question, but would we need the arduino bootloader on the chip, or would a plain-jane atmega328 work?

roycepipkins says:

Feb 10, 2011. 7:15 AM REPLY


Arduino sketches work fine on "plain jane" atmega328/168/88/48s. (If they fit on the chip) The bootloader contains no runtime code. But, you have to
have the ISP programmer and you need to set the clock speed flags.
With out the bootloader, there is no software inside the AVR that is listening to the AVR's serial port or waiting for the Arduino IDE commands. With out
that software, you must use the AVR's built-in hardware mechanism to program the AVR. That built-in hardware works over the SPI port, not the serial
port, and uses a different protocol.

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

JoshuaZimmerman says:

Feb 8, 2011. 6:20 PM REPLY

That is awesome! Kudos to you good sir.


When I finally start learning how to do Microcontroller stuff, this will be on my list of projects. (Though I doubt it'll look as nice.)

SinAmos says:
Oh, I like this and need this or do I?

http://www.instructables.com/id/Rechargeable-Battery-Capacity-Tester/

Feb 8, 2011. 4:40 PM REPLY

Você também pode gostar