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

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").

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 .

Step 5: The SW

Picture of The SW

So I also connected and LCD (which I took apart from some other junk) and found the data-sheet on the net + a cool driver from the Arduino web page and started coding .
Auto detecting battery type by the voltage .

Step 6: Auto Detect Battery Tyoe

Picture of Auto Detect Battery Tyoe

It will detect if it is NiMH/NiCD or Li-ION by the voltage range .
And then start the discharge cycle.

Step 7: Discharging...

Picture of Discharging...

The discharge can take anywhere from 30-120 minuets depending on batery capacity but at the end you get a true indication of battery capacity / quality .
Do you want to use that battery for your air-plain receiver or not ?
This is the diagram of the discharge circuit...

Step 8: Discharge Circuit

Picture of Discharge Circuit

very simple with the 2 A/D connected on the two sides of the resistor /

Step 9: My SW (free for Anyone to Use)

// include the library code:

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins
int sensorPin = 0;    // select the input pin for the potentiometer (pin 23)
int sensor2Pin = 2;    // select the input pin for the potentiometer (pin 23)
int SPKPin = 6;
int sensor2Value = 0;  // variable to store the value coming from the sensor
float LiMinThreshold = 2700; // Lithium Minimal Voltage for load removal
float LiMaxThreshold = 4200; // Lithium Max Voltage for load removal
float NmhMinThreshold = 950; // NMH Minimal Voltage for load removal
float NmhMaxThreshold = 1600; // NMH Max Voltage for load removal
float SelectedMinThreshold = 5000;
int i;
int BatVoltage = 5000;
int FetVoltage = 5000;
long TotalCurrent = 0;
boolean done = false;
unsigned long PrevMillis ;
unsigned long MillisPassed ;

void CL2(){
  lcd.setCursor(0, 1);// Second line first char
  lcd.print("                        ");

void setup() {
  Serial.begin(9600);// start serial port to send data during run to the PC
  pinMode(ledPin, OUTPUT);//activation led and enable for FET
  pinMode(SPKPin, OUTPUT);//activation led and enable for FET
  lcd.begin(24, 2);// set up the LCD's number of rows and columns:
  lcd.print("Bat PWR Tester[Active]");  // Print a message to the LCD.
  lcd.print("Detecting Bat Type..."); // print voltage value
  lcd.print("                        ");
  // Detecting battery type
  BatVoltage = sensorValue*4.887;
  if (BatVoltage > 4500){
    lcd.print("Warning high-V! ");
    done = true;}
  else if (BatVoltage > LiMinThreshold){
    lcd.print("Type:Li-Ion Bat ");
    SelectedMinThreshold = LiMinThreshold;}
  else if (BatVoltage > NmhMinThreshold){
    lcd.print("Type:NiMH/Cd Bat ");
    SelectedMinThreshold = NmhMinThreshold;}
    lcd.print("Unknown Bat V<1 ");
    done = true;}
  lcd.print(sensorValue*4.887); // print voltage value
  PrevMillis = millis();

void loop() {
    if (BatVoltage > SelectedMinThreshold && !done) {
      sensor2Value = analogRead(sensor2Pin);   // read the value from the FET:
      FetVoltage = (sensor2Value*4.887);
      BatVoltage = (sensorValue*4.887);
      lcd.print(BatVoltage); // print voltage value
      //lcd.print(FetVoltage); // print voltage value
      lcd.print(" I=");
      lcd.print("mAH         ");
      MillisPassed = millis()- PrevMillis;
      PrevMillis = millis();
      Serial.println("");    // prints a tab
      digitalWrite(ledPin, LOW);   // set the LED off - stop loading
      lcd.setCursor(0, 0);// First line first char
      lcd.print("Bat Power Tester [DONE] ");  // Print a message to the LCD.
      CL2();//clear line 2
      BatVoltage = (sensorValue*4.887);
      lcd.print(BatVoltage); // print voltage value
      lcd.print("mV I=");
      lcd.print("mAH            ");
          digitalWrite(SPKPin, HIGH);
          digitalWrite(SPKPin, LOW);

Step 10: The Schematics ...

All the schematics for arduino can be found on the Arduino web page (step 2).
you can Also find how to connect standard LCDs on the same site so no need to copy it all here.

Step 11: Please Support My Work by Voting for Me !

Picture of Please Support My Work by Voting for Me !

All and all prototype Breadboard and then moving it to a box and soldering it all together took me two weeks (night work 3-4 hours a day)

Thanks you for reading and feel free contacting me with any questions / remarks .

I am now an Arduino expert (naa I am not - 2 weeks XP )
But I have many new project I would like to do .


KDMcMullan (author)2017-10-23

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. You say 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 needs only to be measured at the cell itself. I don't see the need for the voltage measurement at the FET drain at all.

PeterK63 (author)2016-11-21


And what those potentiometers do, connected to the same pin 23 ? Precisions, precisons...

picposter (author)2016-07-01

Your Code is not Working properly and there are no shematics. Could be a bit more precise.

oldskoolhead (author)2016-04-06

some battery chargers have a test function

nohopehere (author)2016-03-18

The "vote for me" LED did not seem to work. :-/

bart.szester (author)2014-11-25

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?

bell an (author)bart.szester2015-01-04

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

chedger (author)bell an2015-02-19

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)chedger2016-03-11

I now purchased the : BT-C3100.

I am very happy with it . It can check any 4 batteries together ..


AlexYan (author)bell an2015-07-31

bell an, could you give any specific brand name or link plz,

Thank you

moris_zen (author)bart.szester2015-08-02

u can buy a b6 on ebay cheap ...20$ or so ...

moris_zen (author)bart.szester2014-11-25

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.

GaryH34 (author)2015-10-23

Any idea how much the project would cost if you had to buy all of the components?

Also, do you have a picture showing batteries hooked up to your board (just wondering how you physically connect many cells.

How many parrallel cells does it handle?

moris_zen (author)GaryH342016-03-11

Sorry I dont .

Only one every time .. or you can connect in parallel if they have same voltage but then you dont know capacity of each ...

Menneset (author)2016-03-11

The contest is over, but I would have voted for you just because of the LED comment. :)

CarlosV46 (author)2015-10-01

Hi. what kind of resistor is used (2.2 ohms) Watts, tolerance %, (maybe a shunt resistor)?

Thanks in advance.

moris_zen (author)2015-08-05

It looks nice .. but a bit expensive .. to get something to test 12 i parallel is ~150$ :-(

AlexYan (author)2015-07-31

Hi, can your capacity-meter test multiple cells simultaneously? I mean I max b6 allows to measure capacity and it is just ~30 $. The downside is that it tests one cell at a time. I have a few hundred cells to test so looking for a way (multy-cell testing device) to speed up the process. Can you give any suggestions?

moris_zen (author)AlexYan2015-08-02

Well , this instructable was done long ago . I too have the b6 (two) .
I have a similar problem .. many cells to check which I would like to do in parallel .
Is this for personal use or business? is this something you would like me to develop / join develop?

AlexYan (author)moris_zen2015-08-03

Personal use. At the moment I ordered two Opus BT C3100 v2.2 it will allow me testing 8 cells in parallel.

WhiteD1 (author)2015-07-09

Hi, i would like to make this. any update? also, is it possible to use IRFZ44N mosfet in this circuit? (VDSS = 55V
RDS(on) = 17.5mΩ
ID = 49A)

and someone please give a clear schematic of this... though i saw a ppt schematic, but not clear about the discharger part of that.

RobA2 (author)2015-05-26

i don't have the skills to make something like this but is there a product I can buy like it to properly test batteries? of all the ones I've found on ebay they just seem to tes voltage and not really test capacity properly.

mjanich (author)2015-05-21

This is a good project. Could you add charging now? I propose a LM150/350 for a constant voltage (digitally selectable) for charging LiIon type batteries. Remember they have to be charged with constant voltage (4.2V)/Constant current methodology and switch off at 3% (of what? forgotten), no leak charge. Details on how you charge are here:

I would have said that the other way around.

They need to be charged at a constant current then held at a constant voltage until the current drops to 3% of the initial charging current.

ArsenTiger (author)2015-02-28


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 >.<

JiříM1 (author)2014-11-24

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?

Bang.Dzoelkifli (author)2014-10-18

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

ugur23 (author)2014-01-25

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

wasteoinc (author)2014-01-22

@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.

ugur23 (author)2013-12-28

hello i can found only 12 mΩ mosfet on pc motherboard. what i can modify sketch for 12 mΩ mosfet ?

mausi_mick (author)2013-03-09

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_mick (author)2013-03-07

some pictures from the 4 cells:

mausi_mick (author)2013-03-07

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 .

wasteoinc (author)2013-03-04

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_mick (author)2013-02-10

here some pictures

mausi_mick (author)2013-02-10


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_mick (author)2013-02-02

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.

kcarring (author)2012-11-22

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!

msuzuki777 (author)kcarring2012-12-09

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.


vadim.vadimuh (author)2012-10-23

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!

Batdragon (author)2012-06-24

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.

Kinnishian (author)Batdragon2012-07-16

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)Kinnishian2012-07-17

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.....

Kinnishian (author)moris_zen2012-07-17

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.

Kinnishian (author)Kinnishian2012-07-17

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.

pro2xy (author)2012-06-02

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)pro2xy2012-06-03

I just placed the info in microsoft excel .....

pro2xy (author)2012-06-02


loopingz (author)2012-03-30

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?

About This Instructable




More by moris_zen:Humane Multi-Mouse trap Zapper - No pain instant deathPC-TV Hidden Computer in a Drawer for your TelevisionCool external USB drive
Add instructable to: