DIY Arduino Battery Capacity Tester - V1.0

145,643

1,020

134

About: I am an Electrical Engineer. I love to harvest Solar Energy and make things by recycling old stuff. I believe, IF YOU TRY YOU MIGHT, IF YOU DON'T YOU WON'T. www.opengreenenergy.com

[ Play Video ]
I have salvaged so many old lap-top batteries ( 18650 ) to reuse them in my solar projects.It is very difficult to identify the good cells in battery pack.Earlier in one of my Power Bank Instructable I have told, how to identify good cells by measuring their voltages, but this method is not at all reliable.So I really wanted a way to measure each cell exact capacity instead of their voltages.

You can find all of my projects on : https://www.opengreenenergy.com/


Few week ago, I have started the project from the basics.This version is really simple one,which is based on Ohms Law.The accuracy of the tester won’t be 100% perfect, but it does give reasonable results that can be used and compared with other battery, so you can easily identify good cells in a old battery pack.

During my work I realised, their are lot of things which can be improved.In future I will try to implement those things. But for the time being I am happy with it.I hope this little tester will be useful, so I am sharing it with you all.

Note : Please dispose the bad batteries properly.

Disclaimer: Please note that you are working with Li Ion battery which is highly explosive and dangerous . I cannot be held responsible for any loss of property, damage, or loss of life if it comes to that. This tutorial was written for those who have knowledge on rechargeable lithium ion technology.Please do not attempt this if you are novice. Stay Safe.

Step 1: Parts and Tools Required :

Parts Required :

1. Arduino Nano (Gear Best )

2. 0.96" OLED Display ( Amazon )

3. MOSFET - IRLZ44 ( Amazon )

4.Resistors ( 4 x 10K , 1/4W ) ( Amazon )

5. Power Resistor ( 10R, 10W ) ( Amazon )

6. Screw Terminals ( 3 Nos) ( Amazon )

7.Buzzer ( Amazon )

8.Prototype Board ( Amazon )

9. 18650 Battery Holder ( Amazon )

10. 18650 Battery ( GearBest )

11. Spacers ( Amazon )

Tools Required :

1. Wire Cutter / Stripper ( Gear Best )

2.Soldering Iron ( Amazon )

Instrument Used :

IMAX Balance Charger ( Gearbest )

Infrared Thermometer Gun ( Amazon /Gearbest)

Step 2: Schematic and Working

Schematic :

To understand the schematic easily,I have drawn it on a perforated board also.The positions of the components and wiring are similar to my actual board.The only exception are the buzzer and OLED display. In the actual board they are inside but in the schematic they are lying outside.

The design is very simple which is based on Arduino Nano. An OLED display is used to display the battery parameters.3 screw terminals are used for connecting battery and the load resistance.A buzzer is used for giving different alerts.Two voltage dividers circuit are used to monitor the voltages across the load resistance.The function of the MOSFET is to connect or disconnect the load resistance with the battery.

Working :

Arduino check the battery condition, if the battery is good, gives command to switched ON the MOSFET. It allows current to pass from the positive terminal of the battery, through the resistor, and the MOSFET then completes the path back to the negative terminal. This discharges the battery over a period of time.Arduino measures voltage across the load resistor and then divided by the resistance to find out the discharge current. Multiplied this by the time to obtain the milli amp-hour ( capacity ) value.

Step 3: Voltage,Current and Capacity Measurement

Voltage Measurement

We have to find the voltage across the load resistor.The voltages are measured by using two voltage divider circuits.It consists of two resistors with values 10k each. The out put from the divider is connected to Arduino analog pin A0 and A1.

Arduino analog pin can measured voltage up to 5V, in our case the maximum voltage is 4.2V (fully charged) .Then you may ask, why I am using two divider unnecessarily.The reason is that,my future plan is to use the same tester for multi chemistry battery.So this design can be adapted easily to achieve my goal.

Current Measurement :

Current (I) = Voltage ( V ) - Voltage drop across the MOSFET / Resistance (R)

Note : I am assuming the voltage drop across the MOSFET is negligible.

Here , V = Voltage across the load resistor and R = 10 Ohm

The result obtained is in amperes.Multiply 1000 to convert it into milli amperes.

So maximum discharge current = 4.2 / 10 = 0.42A = 420mA

Capacity Measurement :

Stored Charge ( Q ) = Current ( I ) x Time (T ).

We have already calculated the current,the only unknown in the above equation is time.The millis() function in Arduino can be used to measured the elapsed time.

Step 4: Selecting ​Load Resistor

The selection of load resistor is depend on the amount of discharge current we need.Suppose you want to discharge the battery @ 500mA, then the resistor value is

Resistance ( R ) = Max Battery Voltage / Discharge Current = 4.2 /0.5 = 8.4 Ohm

The resistor needs to dissipate a bit of power, so size does matter in this case.

Heat dissipated = I^2 x R = 0.5^2 x 8.4 =2.1 Watt

By keeping some margin you can choose 5W. If you want to more safety use 10W.

I used 10 Ohm ,10W resistor instead of 8.4 Ohm because , it was in my stock that time.

Step 5: Selecting the MOSFET

Here MOSFET is act like a switch.The digital output from the Arduino pin D2 controls the switch. When 5V (HIGH) signal is fed to the gate of the MOSFET, it allows current to pass from the positive terminal of the battery, through the resistor, and the MOSFET then completes the path back to the negative terminal. This discharges the battery over a period of time.So the MOSFET should be chosen in such a way that it can handle maximum discharge current without overheating.

I used a n-channel logic level power MOSFET-IRLZ44. The L shows that is a logic level MOSFET. A logic level MOSFET means that it is designed to turn on fully from the logic level of a microcontroller. The standard MOSFET (IRF series etc) is designed to run from 10V.

If you use an IRF series MOSFET,then it will not fully turned ON by applying 5V from arduino. I mean the MOSFET will not carry the rated current.To tuned ON these MOSFETs you need an additional circuit to boost the gate voltage.

So I will recommend to use a logic level MOSFET, not necessarily IRLZ44.You can use any other MOSFET also.

Step 6: OLED Display

To display the Battery Voltage,discharge current and capacity, I used a 0.96" OLED display.It has 128x64 resolution and uses I2C bus to communicate with the Arduino. Two pins SCL (A5), SDA (A4) in Arduino Uno are used for communication.

I am using U8glib library to display the parameters.First you have to download the U8glib library .Then installed it.

If you want to get started in to OLED display and Arduino , click here

The connections should be as follows

Arduino --> OLED

5V --->Vcc

GND -->GND

A4----> SDA

A5----> SCL

Step 7: Buzzer for Warning

To provide different warning or alert, a piezo buzzer is used.The different alerts are

1. Battery Low Voltage

2.Battery High Voltage

3. No Battery

The buzzer have two terminals, the longer one is positive and the shorter leg is negative.The sticker on the new buzzer have also " + " marked to to indicate the positive terminal.

The connections should be as follows

Arduino --> Buzzer

D9--> Positive terminal

GND--> Negative terminal

In the Arduino Sketch, I have used a separate function beep() which sends the PWM signal to the buzzer, waits for a small delay, then turns it off, then has another small delay. Thus, it beeps once.

Step 8: Making the Circuit

In the previous steps, I have explained the function of each of the components in the circuit. Before jump to make the final board, test the circuit on a bread board first.If the circuit works perfectly on the bread board,then move to solder the components on the protype board.

I used 7cm X 5cm prototype board.

Mounting the Nano : First cut two rows of female header pin with 15 pins in each.I used a diagonal nipper to cut the headers.Then solder the header pins.Be sure the distance between the two rails fits the arduino nano.

Mounting OLED Display : Cut a female header with 4pins. Then solder it as shown in picture.

Mounting the terminals and components : Solder the remaining components as shown in pictures

Wiring : Make the wiring as per schematic.I used colored wires to make the wiring, so that I can identify them easily.

Step 9: Mounting the Standoffs

After soldering and wiring,mount the standoffs at 4 corners.It will provide sufficient clearance to the soldering joints and wires from the ground.

Step 10: Software

The software doing the following tasks

1. Measure voltages

Taking 100 ADC samples , adding them and averaging the result.This is done to reduce the noise.

2. Check the battery condition to give alert or start the discharge cycle

Alerts

i) Low-V! : If the battery voltage is below the lowest discharge level ( 2.9V for Li Ion )

ii) High-V! : If the battery voltage is above the fully charged condition

iii) No Battery! : If the battery holder is empty

Discharge Cycle

If the battery voltage is within the low voltage ( 2.9V )and high voltag (4.3V),discharge cycle start.Calculate the current and capacity as explained earlier.

3. Display the parameters on the OLED

4. Data logging on serial monitor

Download the Arduino Code attached below.

Step 11: Exporting Serial Data and Plotting on Excel Sheet

To test the circuit, first I charged a good Samsung 18650-26F battery using my IMAX Charger.Then put the battery in to my new tester.To analyse the entire discharge process,I export the serial data to a spread sheet.Then I plotted the discharge curve.The result is really awesome.I used a software named PLX-DAQ to do it. You can download it here.

You can go through this tutorial to learn how to use PLX-DAQ. It is very simple.

Note : It works only in Windows.

Step 12: Conclusion

After few testing I conclude that the tester result is quite reasonable.The result is 50 to 70mAh away from a branded battery capacity tester result.By using a IR temperature Gun, I measured the temperature rise in the load resistor also,the maximum value is 51 deg C.

In this design the discharge current is not constant, it depends on battery voltage.So the discharge curve plotted is not similar to the discharge curve given in the battery manufacture data sheet.It only support a single Li Ion Battery.

So in my future version I will try solve the above short comings in the V1.0.

Credit : I would like to give credit to Adam Welch, whose project on YouTube was inspired me to start this project.You can watch his YouTube video.

Please suggest any improvements.Raise a comments if any mistakes or errors.

Hope my tutorial is helpful.If you like it,don't forget to share :)

Subscribe for more DIY projects. Thank You.

18 People Made This Project!

Recommendations

  • Big and Small Contest

    Big and Small Contest
  • Make it Glow Contest 2018

    Make it Glow Contest 2018
  • PCB Contest

    PCB Contest

134 Discussions

0
None
FasihZ1AlejandroA165

Reply 26 days ago

Can you please post the wiring diagram for 16"2 display.

0
None
FasihZ1FasihZ1

Reply 25 days ago

Can you please post the wiring diagram with complete code.
unable to figure it out how to do that with 16*2 display.
i tried my self like more than 12 times. still no success.

IMG_20181119_194819.jpgIMG_20181119_194829.jpg
0
None
FasihZ1

Question 25 days ago

Can Some one please help me out how to do that with 16*2 display.
Tried my self more than 12 times..... But unable to figure it out how to do that.
and somehow the current reading goes negative value.

IMG_20181119_194829.jpgIMG_20181119_194819.jpg
1 answer
0
None
eureka_89

Question 1 day ago

Hi everyone.
I am a neophyte of Arduino and electronics. I would like to ask you if I can use the same project to control NiMh batteries. I would change the maximum voltage to 1.6V and the minimum voltage to 0.95.
Thank you so much for the wonderful and useful guide!
Stefano

1 answer
0
None
AlejandroA165eureka_89

Answer 2 hours ago

Control? I suppose that you mean to measure them, well yes, I'm pretty sure that you can.

0
None
Affe2205

5 days ago

Hello! I Made your project and works very good for me....Thank you very much! I changed some variables such as the resistors 10 Kohm to 9.98 Kohm and the voltage from arduino nano 4.64.... mine output 4.78v in source code for more accuracy....I do correct or wath?
I want to export the data from arduino in to MS_Excel as you made and I downloaded the software from your link....but I have problen in Exel about the macro.... Can you explain to me more carefull pleas how did you do it?
Many Tanks in advance! :-)

\\Alfred.

1 reply
0
None
Affe2205Affe2205

Reply 5 days ago

Hi again I solved the problem, I downloded the latest PLX-DAQ v2.11 it works with latest Exel like mine 2010
Best Regards \\ Alfred.

0
None
AhmetY37

19 days ago

I didn't used the IRLZ44N mos but I found IRFZ44N (I tried using it without the wielding, I calculated and the jumper wires had 1 ohm so when I tried to do it without wielding wire I had many more resistance so I calculated the resistance again changed the values lying inside the code. After that I figured that if the buzzer warns me then I can pair the 18650 battery). I didnt had any LCD screens but I used Arduino Serial Monitor screen. Made all the

I found a way to calculate estimate value of a battery. (Va-Vb) = 4 - 3.2 = 0.80 voltages this is the layers of the mAh lets say (Like we have 0.01V ~ 80 layers), At the start we had 4/10 = 400mA current and at the end we had 3.2/10 = 320mA current , lets say its linear decreasing function and calculate the average value of; (400+340)/2 = 360mAh average current. Then I watched the voltage drop like 0.10 volts and the capacity value. I made a counter inside the program when I compile it started. Then I watched the values like 10min passed 0.10 voltage drop and the capacity difference; 70mAh. I started from 4 volts to 3.80 so the current is not average and its 390mAh but my calculation finishes when it reaches to 3.2 voltages so I made a general Formula. I attach it with photo.
fr_6922.jpgfr_6923.jpg
0
None
ThibautH4

4 weeks ago

Hi,

I managed to set my project to be able to read voltage from bigger batteries, as in 12v battery.

However I am wondering about the capacity reader which gives the mAh, it seems to act more like a consumption reader as it reads the mA going through the circuit and sum it up in the capacity reader value.


Is the circuit suppose to do that or i got something wrong ?

My battery is a 7Ah/20hr; I left arduino running overnight and I have now 4379.4 Ah in my battery. with a consumption of 474 mA

0
None
shijilt

8 weeks ago

Is it possible to use this tester as a voltage level display? without using the 10W resister ? To display the battery level of a DIY bluetotoh speaker.

1 reply
0
None
AlejandroA165shijilt

Reply 6 weeks ago

The 10W resistor acts as the load, so if you want to measure the voltage of the battery, you need to measure the voltage before and after the load, then the difference between both voltages is the voltage in your cell

0
None
FasihZ1

Question 7 weeks ago

I am unable to get the exact MOSFET (IRLZ44).
Can you plz suggest some equivalent MOSFET which one works.

2 answers
0
None
AlejandroA165FasihZ1

Answer 6 weeks ago

Almost any mosfet should work. I'm using a irf511 and it works pretty well, 360 mA at 3,8 V

0
None
ThibautH4FasihZ1

Answer 6 weeks ago

Hi,

Same here, I am from Australia and all I can find is IRFZ44

0
None
Hessam ghanizadeh

4 months ago

hi tanks for this great project i have a problem im use IRZF44N and my curr not more than 400mAh im use 10w 10 Ohm but i have problem ho fix this plz help.