Diy Arduino lithium battery capacity meter

 Today we are going to show you how to make a lithium-ion battery capacity tester using Arduino. A battery capacity tester discharges a fully charged lithium-ion cell through a resistor while simultaneously measuring the current flowing through the resistor to calculate its capacity.


Diy Arduino lithium battery capacity meter

This device is very simple and consists of only a few components: an Arduino Nano microcontroller, an LCD display, a small 5V relay, a 5W resistor, two small resistors, and a button.


When we press the start button, the test battery is connected in parallel with the 4 ohm resistor and discharged through it. The voltage is read by the microcontroller every half second, so 7200 measurements are obtained in one hour. Using Ohm's Law, you can find out the current supplied to the load. Then we simply multiply 1 in 7200 hours by the current value and add the resulting numbers until the battery is discharged below 3 V, and then the display will show the measurement result in mA per hour.


First, we need to connect a fully charged battery. The display shows the current battery voltage. As soon as we press the start button, battery testing begins. The following information will be displayed on the screen: the number of measurements taken, the battery voltage, and the power by time in milliamperes per hour. The test ends when the voltage reaches 3 volts and the battery is considered discharged. This may take some time depending on the capacity of the battery.


When the battery voltage drops to 3 volts, the measurement ends and the display shows the actual battery capacity as well as the number of measurements taken. The wiring diagram of the components of the battery capacity meter is shown in the following image.


Diy Arduino lithium battery capacity meter

The program code for this battery tester is as follows:



#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buttonPin = 9; 
int sensorPin = A0; 
int sensorValue = 0;  
const int relay= 10;
int buttonState = 0;
float mah = 0.0;
long timestart  ;

void setup() {
  lcd.begin(16, 2);
  lcd.print("Batt life tester");
  pinMode(relay, OUTPUT);
pinMode(buttonPin, INPUT);
}

void loop() {
  digitalWrite(relay, 0 );
 
  while (buttonState == LOW ) {
  sensorValue = analogRead(sensorPin);
  
  buttonState = digitalRead(buttonPin);

  lcd.setCursor(0, 1);
  lcd.print((sensorValue*4.98)/1023);
  lcd.print(" Volts");
  delay(500);
  } 
  digitalWrite(relay, 1 );
  lcd.setCursor(0, 0);
  lcd.print("Testing              ");
  lcd.setCursor(0, 1);
  lcd.print("                         ");
  mah = 0.0;
  timestart = millis( );
  while ( ((sensorValue*4.98)/1023) > 3.00 ) {
     lcd.setCursor(0, 1);    
     lcd.print((sensorValue*4.98)/1023);
     lcd.print(" V ");
     sensorValue = analogRead(sensorPin);
     mah = mah + (((sensorValue*4.98)/1023)/4 )/7.2;
     lcd.print(mah);
     lcd.print(" mAh ");
     delay ( 500 ) ;
     lcd.setCursor(8,0);
     lcd.print((millis( )- timestart)/1000); 
  } 
    digitalWrite(relay, 0 );
 
   lcd.setCursor(0, 0);
   lcd.print(mah);
   lcd.print(" mAH ");
   lcd.print((millis( )- timestart)/1000);
   lcd.print(" S ");
   buttonState = digitalRead(buttonPin);
  
}
Previous Post Next Post

Contact Form