Arduino based lithium-ion battery capacity tester

 With the advancement of technology, our electronic devices are getting smaller and smaller with more functional and complex applications. With the increasing complexity, the power requirements of the circuit have also increased, and in our quest to make the device as small and portable as possible, we need a rechargeable battery that can deliver high current for a long period of time and at the same time weigh much less to make the device remained portable.

 

Arduino based lithium-ion battery capacity tester

 

Of the many battery types available, lead acid, nickel cadmium and nickel metal hydride batteries are not suitable because they either weigh more or cannot supply the current required for our application, so we are left with lithium ion batteries that can provide high current. while maintaining light weight and compact size.

 

There are many battery suppliers on the market who sell cheap replica lithium ion batteries with strange specifications at a very low price, which is too good to be true. When you buy these items, they either don't work at all, or, if they do, the charge capacity or current is so low that they can't work at all with a demanding application. So how to check a lithium battery? One method is to measure the no-load voltage of the open circuit, but this is far from reliable.

 

Arduino based lithium-ion battery capacity tester

 

In this regard, we will create an 18650 lithium ion battery capacity tester that will discharge a fully charged 18650 battery through a resistor while measuring the current flowing through the resistor to calculate its capacity. If you do not get the stated battery capacity when the cell voltage is within the specified limits, then the cell is defective and you should not use it as the cell's state of charge will deplete at a very high rate under load, creating a current loop that can result in to heat and possibly fire. The components we need for our battery capacity tester are:

 

Arduino based lithium-ion battery capacity tester

 

The complete circuit diagram of the 18650 battery capacity tester is shown below.

 

Arduino based lithium-ion battery capacity tester

 

This circuit is further divided into two parts, the first is a 5V low voltage circuit for the Arduino Nano and a 16x2 alphanumeric LCD screen, and their connections to display real-time current and voltage measurements. The circuit is powered by a 12V power supply or you can use a 12V battery and the maximum current will be about 60-70mA to power the Arduino and LCD.

 

Arduino based lithium-ion battery capacity tester

 

To bring the voltage down to 5V, we will use a linear voltage regulator that can take up to 35V on the input to provide a regulated 5V supply, and the excess voltage is dissipated as heat, hence if your input is over 12V then consider adding the radiator so that it is not damaged. The LCD is powered by a 5V power supply from the 7805, connected to an Arduino, and operates in 4-bit mode. We've also added a 10k ohm potentiometer to control the LCD contrast.

 

The second part of the circuit is a constant current PWM load circuit that makes the load current flowing through the resistor controlled and constant so that no error occurs due to the change in current over time when the cell voltage drops. It consists of an LM741 op-amp and an IRF540N field-effect transistor, which controls the current flowing through the field device by turning the field device on and off in accordance with the voltage level we set.

 

Arduino based lithium-ion battery capacity tester

 

The op-amp operates in comparator mode, which means that in this mode the op-amp output will be high when the voltage at the non-inverting pin of the op-amp is higher than the inverting pin. Likewise, if the voltage at the inverting terminal of the op-amp is higher than that at the non-inverting terminal, the output of the op-amp will be lowered. In this circuit, the voltage level of the non-inverting pin is controlled by the Arduino NANO's D9 PWM pin, which switches at 500 Hz, which then passes through a 33 kΩ RC low pass filter and a 0.47 μF capacitor to provide a near constant DC signal. current at the non-inverting terminal. The inverting pin is connected to a pull-up resistor that reads the voltage across the resistor and a common GND. The op-amp output pin is connected to the gate terminal of the MOSFET to turn it on or off. The op-amp will try to equalize the voltages at both of its pins by switching the connected field device so that the current flowing through the resistor is proportional to the PWM value you set on pin D9. In this project, the maximum current we have limited for our circuit is 1.3A, which is reasonable since we have a 10A cell as our maximum rated current.

 

The maximum voltage of a standard fully charged lithium-ion cell is between 4.1V and 4.3V, which is less than the 5V limit of the analog input pins of the Arduino Nano, which has an internal resistance greater than 10kΩ, so that we can directly connect to any of analog input pins without worrying about current flowing through them. So, in this project, we need to measure the cell voltage so that we can determine if the cell is in the correct operating voltage range and if it is completely discharged.

 

We also need to measure the current flowing through the resistor, for this we cannot use a current shunt, since the complexity of the circuit will increase, and an increase in resistance along the load path will reduce the discharge rate of the element. Using smaller shunt resistors will require additional amplifier circuitry to read the voltage from it to the Arduino. So we directly read the voltage across the pull-up resistor and then use Ohm's Law to divide that voltage by the pull-up resistor value to get the current flowing through it. The negative terminal of the resistor is connected directly to GND, so we can safely assume that the voltage we read across the resistor is the voltage drop across the resistor.

 

Arduino based lithium-ion battery capacity tester

 

The complete program code of the battery capacity tester is shown below.

 


#include <LiquidCrystal.h>
const int rs = 3, en = 4, d4 = 5, d5 = 6, d6 = 7, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
const float BAT_LOW = 3.0;
const float BAT_HIGH = 4.5;
const int MOSFET_Pin=9;
const int PWM_VALUE=50;
unsigned long previousMillis = 0;
unsigned long millisPassed = 0;
float Capacity=0;
float Resistor=2.2;
float mA;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Battery Capacity");
lcd.setCursor(0,1);
lcd.print("Tester Circuit");
delay(3000);
lcd.clear();
}
void loop() {
analogWrite(MOSFET_Pin, PWM_VALUE);
int sensorValue_voltage_Cell = analogRead(A0);
float voltage = sensorValue_voltage_Cell * (5.12 / 1023.0)*1.2;
Serial.print("VOLTAGE: ");
Serial.println(voltage);
lcd.setCursor(0, 0);
lcd.print("Voltage: ");
lcd.print(voltage);
delay(100);
int sensorValue_Shunt_Resistor= analogRead(A1);
float voltage1= sensorValue_Shunt_Resistor *(5.00 / 1023.0);
float current= voltage1/Resistor;
Serial.print("Current: ");
Serial.println(current);
lcd.setCursor(0, 1);
lcd.print("Current: ");
lcd.print(current);
if ( voltage > BAT_HIGH)
{
digitalWrite(MOSFET_Pin, LOW);
Serial.println( "Warning High-V! ");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("HIGH VOLTAGE!!");
delay(2000);
lcd.clear();
}
else if(voltage < BAT_LOW)
{
digitalWrite(MOSFET_Pin, LOW);
Serial.println( "Warning Low-V! ");
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Low Voltage!!!");
delay(2000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("CAPACITY:");
lcd.setCursor(0,1);
lcd.print(Capacity);
delay(10000);
}
else if(voltage > BAT_LOW && voltage < BAT_HIGH )
{
millisPassed = millis() - previousMillis;
mA = current * 1000.0 ;
Capacity = Capacity + (mA * (millisPassed / 3600000.0));
previousMillis = millis();
//Serial.print("DATA,TIME,"); Serial.print(voltage); Serial.print(","); Serial.println(Capacity);
delay(1000);
lcd.clear();
}
}

 

Now that we have designed and tested different parts of our circuit on a breadboard and made sure they all work as expected, we use a perforated board to solder all the components together as this is a much more professional and reliable method of checking a circuit. ... Optionally, you can design your own PCB in AutoCAD Eagle, EasyEDA or Proteus ARES, or any other software you like.

 

Arduino based lithium-ion battery capacity tester

 

Now turn on the circuit and adjust the potentiometer to set the LCD contrast level. At this point, you should see a welcome message on the LCD screen, and then if the battery voltage level is within the operating range, then the parameters will be displayed on the display.

 

Arduino based lithium-ion battery capacity tester

 

This is a very simple test for calculating the capacity of a cell in use and can be improved by taking the data and saving it in an Excel file for further processing and visualization of the data graphically.

Previous Post Next Post

Contact Form