Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb)

FeaturedContest Winner
Picture of Arduino True Battery Capacity Tester (Li-Ion/NiMH/NiCD/Pb)
 If anyone saw my last instructable "Simple Li-Ion Battery Power Tester" they can now upgrade to a computerized hi-tech version that is capable of measuring almost any type of rechargeable or none rechargeable batteries (but it will drain one charge from them in the process).
It can even connect to a PC and give you a full "Data-sheet" graph of the discharge and total capacity.
Note that this is my first Arduino project (I am not counting my "blink LED").
Remove these adsRemove these ads by Signing Up

Step 1: This is what you can get at the end...(just to get you interested)

Picture of This is what you can get at the end...(just to get you interested)
This is the graph you can get from the text file sent to the PC during drain cycle.

Step 2: Lets start at the begining - Arduino

Picture of Lets start at the begining - Arduino
I really wanted to get this Diecimila copy Arduino board bit it took me ~2 weeks to get it by mail so I just had to start fast with my own bread-board Arduino so I purchased an ATMEGA168 and thought I could get it running without any more components .. to my suprize it didn't work and I just had to get another shipment with a 16Mhz crystal and two 22pf caps .. then I got the next ...

Step 3: Bread board Arduino

Picture of Bread board Arduino
I basically took junk apart and added the components one by one ...
most of the information can be found in the Arduino web page :
They realy have everything you need .
It took me about a week to get it up and running (bootloader / building an ISP cable and an RS232 cable ...) - you can read all about this in the site above .

Step 4: FET with 2.2Ohm load

Picture of FET with 2.2Ohm load
it was fairly simple to add a FET with "on" resistance of ~8mOHM (no barly any power disipation on it) and a 2.2 10W resistor .
I connected two A/D pins from the Arduino to the resistor poles and subtracted the values to get the exact volatge drop on the resistor .
Now I samples them every second and acumulated the current (I=DeltaV/R).
I also added a buzzer to indicate when charging was over and stoped the discharge .

1-40 of 69Next »
ArsenTiger29 days ago


I'm very very new to Arduino and really wanted to make this particular one. I can't seem to make out the full circuit for step 4 and I noticed someone further down did a PPT of one that used a 10ohm 10w resistor. If the 10ohm 10w was used... would there be any changes in the code you've provided?

And last question... I have a TIP3055... would that work in place of the one in Step 4? I'm really sorry for sounding newbish... but I really want to give this one a try and I realize that this is a very old instructable >.<

bart.szester4 months ago
Hi all, I'm lookig for someone who would build a battery capacity trster for me. I need to test batteries 18650 3.7v, 18350 3.7v and 4.2v. I'm using them for my e-cigs. Can anyone help?

just buy one ,this kind of stuff is quite cheap ,10 dollar a piece

chedger bell an1 month ago

I've seen plenty of capacity "indicators" that give a guesstimate but not much in the way of ones that discharge with a load to determine actual capacity and none that will give you a graph.The ones I found are on ebay for $12.xx and $45.xx respectively and called:

"1.2-12V battery capacity tester external load discharge capacity test 18650"

"Digital led Ni-Cd Li-Ion Pb Ni-Mh Battey Capacity Tester & Discharge Instrument"

The prices are fine but I question the accuracy/quality and if they are actually the best/only available.

moris_zen (author)  bart.szester4 months ago
you use 18650 for e-cigs?!?!
That must be a huge e-cig :-)
If you like you can ship some over and I can test for you .
18650 is the most common size for what are referred to as "mods" which are not the fake cigarette types. Other common sizes are 18350, 18500, and my peraonaly pref the 26650. I saw this build some time ago and recently came over to start compiling parts to build one myself.
JiříM14 months ago

I dont understand why we need to know FetVoltage? It's only a few mV because the voltage drop on resistor is basically same as battery voltage. Am I correct if I think that we wouldn't really need the FetVoltage if we had zero resistance cables?

hi..i am a newbie for arduino,i have a project for discharging multiple batteries automatically..and then i saw your project,can you give me detailed schematic and component in your project?i would appreciate it..thank you
ugur231 year ago

ok. but i have another question. i have 2200 Ohm resistor . where i must change sketch ?

wasteinc1 year ago

@mausi_mick, thanks, when I upgrade my batt tester, it will be your design (evil)

@ugur23 its ok , you dont have to change something, 12mOhm rds(on) is very good.

ugur231 year ago
hello i can found only 12 mΩ mosfet on pc motherboard. what i can modify sketch for 12 mΩ mosfet ?
mausi_mick2 years ago
here is the schematic for the current sink / source (source not realized at this time).
For the discharge current I need A0 of the UNO. The OPamp is TLC2262 (Rail-to-Rail), the N-Fet is a Low-Level with small Ron.
mausi_mick2 years ago
some pictures from the 4 cells:
mausi_mick2 years ago
hi wasteinc,

i have changed the device, now it's possible to discharge 1 to 4 batteries and the discharge current is adjustable from 10 mA to about 1A withe a potentiometer .
wasteinc2 years ago
nice work mausi_mick. Can you post the schematics and the arduino pde? Im building a 2 bat discharge circuit and im facing some difficulties :)
mausi_mick2 years ago
here some pictures
mausi_mick2 years ago

I changed the device:

- it's possible to discharge 1 to 4 (5max) batteries parallel
- it's possible to discharge NiMH/NiCd or Lion batteries
- the discharge current is adjustable between about 10mA to about 1A
- it has a 132x164 ? cheap Color GLCD (Siemens S65) to display the discharge voltage over time (max 300min) and in text form the battery voltage and the discharged energy (mWh).
- it used the ATMega328P with Arduino Libs (S65) (runtime board or Arduino UNO / Duemilanove)

mausi_mick2 years ago
Very nice and easy to rebuild.

A0 is going to the + of the Akkumulator/Battery, A2 to the Drain of the N-Fet, different from the schema. Normally Power FET's have Drain on Pin2 (in the mid).

I try to rebuild it with a Color GLCD-Display , perhaps from the Simens S65 Phone.
kcarring2 years ago
Would this be applicable for a large deep cycle battery 12V if the right dummy load was used? This exports data to a computer file, in comma delimited txt? Looks great!
The standard Arduino is only able to measure up to 5V. To use this with a 12V battery, you would need to use a voltage divider and adjust the software to compensate but it should work.


Hello gentlemens!
theme - Super Joule Ringer 2.0 in overdrive!
how to purchase (ICH) OP45224-KIT I understood -
please indicate me - where can I buy two devices to it black and blue color? what kind of devices and their specifications? give me a link ... please!
Batdragon2 years ago
I have a question or two. Say I have none of the components, how much would it cost to get them all to make this tester? And I do mean everything (Also I am in the UK so a cost in GBP would be nice :) )

Would it be possible to alter the load to be a variable resistance that it say also programmable with the kit, if not what is the lowest resistance value that could be used on that particular circuit?

I am asking this as I have a collection of batteries from China that have huge power claims, but in reality they are not anywhere near that claim. the reason being is the way they are tested. If they are tested on a small load (high resistance) then the response curve provides a far better result than if used on a low resistance load.

What I want to do is to make somethig that will give me a good graph of the battery characteristics under real usage loads. I am talking from the 0.8 Ohm to a 3.5Ohm load on them.
You should look into either

1) purchasing an icharger, they're a nice middle ground of graphing and capable chargers, but not being too expensive. You have have them discharge at high loads by discharging into the power source, which you have be a big lead acid battery.

2) Look into "celllog halogen light discharger" or "watt meter halogen discharger." You can make a good dischargre using halogen lights.

3) You can modify this project to open gates to more resistors in parallel. I am not a huge fan of this method. I think the cost will be similar to either of the above, with out benefit.

4) If you bought a bunch of 18650 from ebay, or any shady aliba-style site, you're screwed. Most 18650 sold from cheap sellers is shit, and you still have to be worried about higher priced but inscrupable sellers (like tenergy). If we're talking LiPo, thats a different story, and there are both legit and bad sellers from low-cost chinese suppliers.
moris_zen (author)  Kinnishian2 years ago
Kinnishian ,
A friend is just about to develop a custom battery with Tenergy - they look like a decent company .
Do you have bad experience with them ?
Pls send me any info you have about them .. he is about to send them many K$ very soon.....

Oh, hey, yes. I have had poor experience with Tenergy. Back in the NiMH days they were very notoriously overrating their batteries. Not as bad as the cheapy ebay resellers, but far worse than suitable for a name-brand. I got 1300mAh-1700mAh from my "2600mAh" tenergy cells. They're not the company I'd got for any big purchase. I have seen peers at my university use them for some projects because they're sold at more visible places like allbattery, but it's a terrible idea.

That said, ***I have not had first-hand experience with their lithium batteries***.
However, they're not anything cutting edge in the realm of lithium, which is dominated by really big players, and they seem to have fallen out.

Even though I'm not a battery expert, I have a bit of knowledge, and I could probably make some recommendations for your friend if you give me more details about the application and scale. Not to clutter the thread, or just to keep it public domain, you can either PM me or just reply to this comment.

There are several lithium chemistries, and exactly the choice you'd make depends on several variables. My experience comes from electric bikes, and the folks at, but luckily electric bikes kind of run the gamut of applications, from low power 1C rates to high power 20C rates. A generalalized summary:
LiFePO4, the traditional "safe" chemistry. If you're using a low power system (discharging over 1-2 hours, but not faster), you can buy from a suitable chinese seller, like Ping-batteries. They typically use BMS. The high power brand is "A123" whose batteries have very recently been showing up on the gray market at a low price. I'd choose these guys if you're making a less volume sensitive large pack (LiFePO4 is gravimetrically reasonably dense, but volumetrically noticeably less dense than the other chemistries). They have 20Ah pouchs, better than tiny 2ah cells, a great product, and recently a very sweet pricepoint.

LiPo: LiPo (Lithum Polymer) is a variant method of constructing LiCo (lithium cobalt). They're designed for extremely high rate discharge, often used in the RC toy world. Not a great cycle life, but if treated right, a good price point for a very lightweight semi-short range Ebike. You have to know how to use them though, because their danger is substantially higher than other chemistry.

LiCo, 18650. These are designed for the Laptop world. Low Power, but very dense energy. Leave them in the Laptop world. They're poorly suited for other applications, unless you really are scavenging and know what you're doing and make a massive pack.

LiMn: These are slightly older, well known as being sourced from Konion LiMn tool packs, but also available elsewhere. They for a long time were a nice middle ground between LiFePO4 and LiCo in terms of performance and density and safety. With the likes of A123 high power LiFePO4 and advancements in LiPo and NMC, they've largely fallen out of favor. It might also do with the fact I don't think there have been manufacturers producing this chemistry on a large scale recently. A nice plus is they effectively self-balance, no BMS needed.

LiNMC: This is the newest chemistry, at least in quality form now. There are sellers of crappy version of this chemistry (like Allcell), but thats because they're repacking the ones in 18650 format designed for laptops (the largest lithium market). For most non-laptop applications you want to be looking at the beautiful cells from EIG, Dow Kokam, or Lg Chem. They're pretty hard to find though, because they don't really sell to hobbyists. You can buy the Dow Kokam guys (sweet cells, but EIG and Lg Chem are a bit better) from FFRTrikes, a random bike company (they made a bulk order and resell batteries since they also do electric bikes.) These are about twice to thrice the cost of A123 on the graymarket, though, in part because they're newer and in part because A123 has very recently plummeted in cost on the gray market.

Hey! I apologize! I just went off on a semi-useless battery rant. But as this might be useful fodder, I'll leave it up.
To clarify why I went off talking about lithium:

I cannot name any use these days for NiMh, unless you're recovering from an old Prius pack or otherwise have a unique source for it (or you're dealing with an old system and MUST use NiMh). Basically there's a lithium chemistry for any application of NiMh, and the costs are comparable or lower, because Lithium dominates the economy of scale.
pro2xy2 years ago
hey how do you get the graphs?? I can send data to the serial port, but what is the format for it? How do you make these graphs?
moris_zen (author)  pro2xy2 years ago
I just placed the info in microsoft excel .....
pro2xy2 years ago
hey how do you get the graphs?? I can send data to the serial port, but what is the format for it? How do you make these graphs?
loopingz3 years ago
It sounds interesting as this the kind of thing I was thinking building.
But I would gain hours to get these curves for four batteries at the same time. Do you think it is possible to modify it this way?
hi all
fixed the code after a long night. i can get the setup to start up and the lcd turns on. it will then pick up what type of battery is connected and will measure the voltage and current of the battery, but the led wont illuminate which leads me to believe the mosfet is not switching on. im using a irf540a with a rds on of .052 ohms. any ideas?

Ive been using a 1.3v 1200mah AA rechargeable battery nimh.

any ideas?
Im having the same problem with the same part. Also trying to reduce the required display size from a 24x2 to a 16x2. Great circuit as I have tons of recycled/scavanged Li-ion cells to test before I use them making a new E-Bike battery pack.
i copied the code above directly into ardunio 0022 program. i have the duemilanove clone.

it comes up with the following errors:

dunkbat.cpp:3:10: error: #include expects "FILENAME" or
dunkbat:3: error: 'LiquidCrystal' does not name a type
dunkbat.cpp: In function 'void CL2()':
dunkbat:23: error: 'lcd' was not declared in this scope
dunkbat.cpp: In function 'void setup()':
dunkbat:31: error: 'lcd' was not declared in this scope
dunkbat.cpp: In function 'void loop()':
dunkbat:76: error: 'lcd' was not declared in this scope
dunkbat:99: error: 'lcd' was not declared in this scope

any ideas im a complete noob
Dear paul

This is because the include file is not mentioned at the start. if you do: Sketch> Import Library>liquidcrystal , it will add the necessary header file to the sketch and compile correctly.

slvr00gt4 years ago
Here is more detailed diagram of the same thing
Hi slvr00gt, I' have seen your diagram but that's something I don't understand.
The FET voltage terminal is seems don't have connection to the drain circuit, how it's can give analog input (FET voltage) to arduino?
its a fantastic circuit and ive started to build it. have you by any chance got a higher resolution of the diagram above i cant zoom in enough? thanks
moris_zen (author)  paulryanmini4 years ago
I see some one made a diagram - great work
Just added powerpoint file above.... My diagram jpeg was originally high quality, but this forum compressed it into nothing. So I added original ppt file
Adding better quality diagram
1-40 of 69Next »