3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

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

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 1This is what you can get at the end...(just to get you interested)

This is what you can get at the end...(just to get you interested)
«
  • NiMH-Bat.jpg
  • Li-Ion.jpg
  • NiMHExcel.jpg
This is the graph you can get from the text file sent to the PC during drain cycle.
« Previous StepDownload PDFView All StepsNext Step »
40 comments
Mar 30, 2012. 5:24 PMloopingz says:
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?
Mar 10, 2011. 1:16 PMpaulryanmini says:
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?
thanks
Aug 2, 2011. 2:43 AMmonbeamdistilleries says:
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.
Mar 9, 2011. 11:31 AMpaulryanmini says:
hi
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
thanks
paul
Jun 30, 2011. 4:18 AMabosebkk says:
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.

Jan 9, 2011. 2:10 PMslvr00gt says:
Here is more detailed diagram of the same thing
Jun 22, 2011. 2:07 AMm_boby_k says:
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?
Mar 2, 2011. 6:47 AMslvr00gt says:
Adding better quality diagram
Mar 2, 2011. 4:35 AMpaulryanmini says:
hi
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
Mar 2, 2011. 6:49 AMslvr00gt says:
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
Mar 20, 2011. 7:42 PMtechwiz says:
Less word more little picture comments!

Isn't that the power of Instructables?
Mar 16, 2011. 10:53 AMblast09 says:
Sorry but I miss something...It seems to me there's a typo in PPT diagram.
Pin "fetVoltage[plus]" on discharge circuit is left floating around. Could you confirm this? Thanks for great work anyway.
Mar 2, 2011. 10:30 AMpaulryanmini says:
thanks very much. im building it as part of a assignment for power electronics.

i will then alter it to work with 36v 14ah lithium polymer batteries somehow :-) if you have any ideas that would be great
Feb 25, 2011. 7:43 AMarnefl says:
Sure I do :-)
Jan 9, 2011. 2:13 PMslvr00gt says:
Here is my change to the code. Change adjusts the voltage when the test stops. It also prints out capacity over time to the serial port. and changes input pin numbers to what I end up using


$ diff my.cpp orig.cpp
7,8c8,9
< int ledPin = 8; // select the pin for the LED
< int SPKPin = 9;
---
> int ledPin = 13; // select the pin for the LED
> int SPKPin = 6;
18c19
< int FetVoltage = 0;
---
> int FetVoltage = 5000;
66,67d66
< Serial.print("\t");
< Serial.print("Capacity[mAH]");
75c74
< if ( (BatVoltage-FetVoltage) > SelectedMinThreshold && !done) {
---
> if (BatVoltage > SelectedMinThreshold && !done) {
86c85
< TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/10/3.6;
---
> TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6;
98,99d96
< Serial.print("\t"); // prints a tab
< Serial.print(TotalCurrent/1000);
Jan 6, 2011. 11:58 PMslvr00gt says:
In the code you have following if-statement, where you check whether or not battery has reached the minimum., but in the check, you don't factor FetVoltage.

Should this statement:
"if (BatVoltage > SelectedMinThreshold && !done) {"
be replaced with this:
"if ( (BatVoltage-FetVoltage) > SelectedMinThreshold && !done) {"

Thanks for the great instructable. I just finished building your design!
Jan 7, 2011. 9:44 AMslvr00gt says:
Yes, the voltage drop over FET is negligible ( roughly 0.03V), but in your design it is measured and used in calculation:
TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6;
Jan 7, 2011. 7:26 AMslvr00gt says:
My second question is how do you get drain data from microcontroller board to PC?
Oct 7, 2010. 9:12 AMTheBlackBird says:
Hello.
I would like very much to build this, but can you please clarify some aspects.
Do you use one or two connections to the arduino, because in the schematic you only draw one (on pin 19), and in the code you mention pin 23
"int sensorPin = 0; // select the input pin for the potentiometer (pin 23)
int sensor2Pin = 2; // select the input pin for the potentiometer (pin 23)"
and what is the potentiometer ?

In short i don't understand what pin of the arduino i connect where.
Thank you.
Oct 14, 2010. 9:31 AMTheBlackBird says:
Moris, it is great that you have made this instructable.
But because you did it in a haste there are things uncleat.
So preety please :) can you post some answers from time to time.
Don't let us hang.
Sep 1, 2010. 3:48 AMEuphorbium says:
BatVoltage = sensorValue*4.887; Where does this 4.887 comes from? Is it some constant?
Aug 20, 2010. 1:31 PMMadrias357 says:
Yes, I read all of the little comments.
Feb 11, 2010. 4:01 AMmathman47 says:
Great job.  Finally something useful for the Arduino.   I can use as a ham radio operator with lots of batteries.  Keep up the good work and post more when you get a new project.  Oh, does the FET have a part number or any markings on it?
Nov 10, 2009. 7:58 PMguyfrom7up says:
very nice and well done!  This is an arduino project I actually like!  It used a real schematic (thankyou! lol) and it was interfaced with a computer, which is one of the main convienient part of the arduino (otherwise i strongly suggest a plain microcontroller).  I'm currently working on a "supermeter" which is pretty much like a multimeter with a whole bunch more functions.  The current model i'm designing has about 40 functions and I'm adding some code (I'll be using an avr, not an arduino, even though they are both avr :P) so that it'll now test battery capacity.  Great instructable, and 5 stars!
Apr 25, 2010. 1:25 AMcipriti says:
I used a BUZ11 fet and it's not working. Any ideeas?
Jun 18, 2010. 5:45 PMmegapix says:
Most likely reason would be connecting it wrong. Another possibility is that the threshold voltage for a BUZ11 (the voltage where it just starts to turn on) can be as high as 4 Volts. So it could be that the 5 Volt drive from the Arduino is not turning it fully on. When they measure the resistance in the data sheet they put 20 Volts on the gate (Vgs).
Nov 17, 2009. 6:28 AMMattSum1 says:
Can you provide some more info on the non processor electronics?  In one step you mention "a FET with "on" resistance of ~8mOHM" in which I'm not sure what the ~ means. Then later you say "This FET was removed from a TV set - it has 4mOhm on-resistance.cool!" which is different.  Any info on what different resistances does in this case would be very helpful.  Also, besides the 2.2 ohm 10w, I see another resistor, a couple led's, a "reset" button, and of course the LCD.  Can you maybe provide some info on the "non arduino" components & possibly a schematic showing the non arduino stuff?
Nov 12, 2009. 4:20 AMamidar says:
Hello,
just a simple question. :-)

What for is division with 3.6 in this formula ?

TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6; 
Nov 12, 2009. 3:29 PMamidar says:
I figured that just about 10ps after i pressed "post comment" button ! :-)
Anyway, here is one very  instructive site releted to battery charging/recharging.
I learned a lot especially from schematic part of the project. :-)

www.avr-asm-tutorial.net/akkuload/en/index.html

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
27
Followers
5
Author:moris_zen