THE BELL

There are those who read this news before you.
Subscribe to get the latest articles.
Email
Name
Surname
How would you like to read The Bell
No spam

Recently, I began to notice that my smartphone began to discharge faster. The search for a software “devourer” of energy did not bear fruit, so I began to wonder if it was time to replace the battery. But there was no absolute certainty that the cause was in the battery. Therefore, before ordering a new battery, I decided to try to measure the real capacity of the old one. For this, it was decided to assemble a simple battery capacity meter, especially since this idea has been hatched for a long time - there are a lot of batteries and accumulators around us in everyday life, and it would be nice to be able to test them from time to time.

The very idea underlying the operation of the device is extremely simple: there is a charged battery and a load in the form of a resistor, you just need to measure the current, voltage and time during the discharge of the battery, and calculate its capacity using the data obtained. In principle, you can get by with a voltmeter and an ammeter, but sitting at the instruments for several hours is a dubious pleasure, so it is much easier and more accurate to do this using a data logger. I used the Arduino Uno platform as such a registrar.

1. Scheme

There are no problems with measuring voltage and time in Arduino - there is an ADC, but a shunt is needed to measure current. I had the idea to use the load resistor itself as a shunt. That is, knowing the voltage on it and having previously measured the resistance, we can always calculate the current. Therefore, the simplest version of the circuit will consist only of a load and a battery, connected to the Arduino analog input. But it would be nice to provide for the load to be turned off when the threshold voltage on the battery is reached (for Li-Ion this is usually 2.5-3V). Therefore, I provided a relay in the circuit, controlled by digital pin 7 through a transistor. The final version of the circuit in the figure below.

I placed all the elements of the circuit on a piece of breadboard, which is installed directly on the Uno. As a load, I used a spiral of nichrome wire 0.5 mm thick, having a resistance of about 3 ohms. This gives a calculated value of the discharge current of 0.9-1.2A.

2. Current measurement

As mentioned above, the current is calculated based on the voltage on the spiral and its resistance. But it is worth considering that the spiral heats up, and the resistance of nichrome is quite dependent on temperature. To compensate for the error, I simply took the current-voltage characteristic of the coil using a laboratory power supply and letting it warm up before each measurement. Then I derived the trend line equation in Excel (the graph below), which gives a fairly accurate i (u) dependence, taking into account heating. It can be seen that the line is not straight.

3. Voltage measurement

Since the accuracy of this tester directly depends on the accuracy of the voltage measurement, I decided to pay special attention to this. In other articles, we have repeatedly mentioned the method that allows you to most accurately measure the voltage with Atmega controllers. I will repeat only briefly - the essence is to determine the internal reference voltage by means of the controller itself. I have used this article.

4. Program

The code is nothing complicated:

Program text

#define A_PIN 1 #define NUM_READS 100 #define pinRelay 7 const float typVbg = 1.095; // 1.0 -- 1.2 float Voff = 2.5; // turn off voltage float I; float cap = 0; floatV; floatVcc; float Wh = 0; unsigned long prevMillis; unsigned long testStart; void setup() ( Serial.begin(9600); pinMode(pinRelay, OUTPUT); Serial.println("Press any key to start the test..."); while (Serial.available() == 0) ( ) Serial.println("Test is launched..."); Serial.print("s"); Serial.print(" "); Serial.print("V"); Serial.print(" "); Serial. print("mA"); Serial.print(" "); Serial.print("mAh"); Serial.print(" "); Serial.print("Wh"); Serial.print(" "); Serial .println("Vcc"); digitalWrite(pinRelay, HIGH); testStart = millis(); prevMillis = millis(); ) void loop() ( Vcc = readVcc(); //read reference voltage V = (readAnalog(A_PIN ) * Vcc) / 1023.000; //reading the battery voltage if (V > 0.01) I = -13.1 * V * V + 344.3 * V + 23.2; //calculation of the current according to the I–V characteristic of the spiral else I=0; cap += (I * (millis() - prevMillis) / 3600000); // calculation of battery capacity in mAh Wh += I * V * (millis() - prevMillis) / 3600000000; // calculation of battery capacity in Wh prevMillis = millis(); sendData (); // send data to the serial port if (V< Voff) { //выключение нагрузки при достижении порогового напряжения digitalWrite(pinRelay, LOW); Serial.println("Test is done"); while (2 >1) ( ) ) ) void sendData() ( Serial.print((millis() - testStart) / 1000); Serial.print(" "); Serial.print(V, 3); Serial.print(" ") ; Serial.print(I, 1); Serial.print(" "); Serial.print(cap, 0); Serial.print(" "); Serial.print(Wh, 2); Serial.print(" " ); Serial.println(Vcc, 3); ) float readAnalog(int pin) ( // read multiple values ​​and sort them to take the mode int sortedValues; for (int i = 0; i< NUM_READS; i++) { delay(25); int value = analogRead(pin); int j; if (value < sortedValues || i == 0) { j = 0; //insert at first position } else { for (j = 1; j < i; j++) { if (sortedValues <= value && sortedValues[j] >= value) ( ​​// j is insert position break; ) ) ) for (int k = i; k >< (NUM_READS / 2 + 5); i++) { returnval += sortedValues[i]; } return returnval / 10; } float readVcc() { // read multiple values and sort them to take the mode float sortedValues; for (int i = 0; i < NUM_READS; i++) { float tmp = 0.0; ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); ADCSRA |= _BV(ADSC); // Start conversion delay(25); while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both tmp = (high << 8) | low; float value = (typVbg * 1023.0) / tmp; int j; if (value < sortedValues || i == 0) { j = 0; //insert at first position } else { for (j = 1; j < i; j++) { if (sortedValues <= value && sortedValues[j] >= value) ( ​​// j is insert position break; ) ) ) for (int k = i; k > j; k--) ( // move all values ​​higher than current reading up one position sortedValues[k] = sortedValues; ) sortedValues[j] = value; //insert current reading ) //return scaled mode of 10 values ​​float returnval = 0; for (int i = NUM_READS / 2 - 5; i< (NUM_READS / 2 + 5); i++) { returnval += sortedValues[i]; } return returnval / 10; }

Every 5 seconds, data on time, battery voltage, discharge current, current capacity in mAh and Wh, and supply voltage are transmitted to the serial port. The current is calculated according to the function obtained in paragraph 2. When the threshold voltage Voff is reached, the test is terminated.
The only, in my opinion, interesting point in the code, I would highlight the use of a digital filter. The fact is that when reading the voltage, the values ​​\u200b\u200bare inevitably “dancing” up and down. At first I tried to reduce this effect by simply taking 100 measurements in 5 seconds and taking the average. But the result still did not satisfy me. During the search, I came across such a software filter. It works in a similar way, but instead of averaging, it sorts all 100 dimension values ​​in ascending order, selects the center 10, and averages them. The result impressed me - the measurement fluctuations completely stopped. I decided to use it to measure the internal reference voltage as well (the readVcc function in the code).

5. Results

Data from the serial port monitor is imported into Excel in a few clicks and looks like this:

In the case of my Nexus 5, the declared battery capacity of the BL-T9 is 2300 mAh. Measured by me - 2040 mAh at a discharge of up to 2.5 V. In reality, the controller hardly allows the battery to sit down to such a low voltage, most likely the threshold value is 3V. The capacity in this case is 1960 mAh. A year and a half of the phone's service led to a capacity drawdown of about 15%. With the purchase of a new battery, it was decided to wait.
With the help of this tester, several other Li-Ion batteries have already been discharged. The results look very realistic. The measured capacity of new batteries coincides with the declared one with a deviation of less than 2%.
This tester is also suitable for metal-hydride finger-type batteries. The discharge current in this case will be about 400 mA.

Recently, I began to notice that my smartphone began to discharge faster. The search for a software “devourer” of energy did not bear fruit, so I began to wonder if it was time to replace the battery. But there was no absolute certainty that the cause was in the battery. Therefore, before ordering a new battery, I decided to try to measure the real capacity of the old one. For this, it was decided to assemble a simple battery capacity meter, especially since this idea has been hatched for a long time - there are a lot of batteries and accumulators around us in everyday life, and it would be nice to be able to test them from time to time.

The very idea underlying the operation of the device is extremely simple: there is a charged battery and a load in the form of a resistor, you just need to measure the current, voltage and time during the discharge of the battery, and calculate its capacity using the data obtained. In principle, you can get by with a voltmeter and an ammeter, but sitting at the instruments for several hours is a dubious pleasure, so it is much easier and more accurate to do this using a data logger. I used the Arduino Uno platform as such a registrar.

1. Scheme

There are no problems with measuring voltage and time in Arduino - there is an ADC, but a shunt is needed to measure current. I had the idea to use the load resistor itself as a shunt. That is, knowing the voltage on it and having previously measured the resistance, we can always calculate the current. Therefore, the simplest version of the circuit will consist only of a load and a battery, connected to the Arduino analog input. But it would be nice to provide for the load to be turned off when the threshold voltage on the battery is reached (for Li-Ion this is usually 2.5-3V). Therefore, I provided a relay in the circuit, controlled by digital pin 7 through a transistor. The final version of the circuit in the figure below.

I placed all the elements of the circuit on a piece of breadboard, which is installed directly on the Uno. As a load, I used a spiral of nichrome wire 0.5 mm thick, having a resistance of about 3 ohms. This gives a calculated value of the discharge current of 0.9-1.2A.

2. Current measurement

As mentioned above, the current is calculated based on the voltage on the spiral and its resistance. But it is worth considering that the spiral heats up, and the resistance of nichrome is quite dependent on temperature. To compensate for the error, I simply took the current-voltage characteristic of the coil using a laboratory power supply and letting it warm up before each measurement. Then I derived the trend line equation in Excel (the graph below), which gives a fairly accurate i (u) dependence, taking into account heating. It can be seen that the line is not straight.

3. Voltage measurement

Since the accuracy of this tester directly depends on the accuracy of the voltage measurement, I decided to pay special attention to this. In other articles, we have repeatedly mentioned the method that allows you to most accurately measure the voltage with Atmega controllers. I will repeat only briefly - the essence is to determine the internal reference voltage by means of the controller itself. I have used this article.

4. Program

The code is nothing complicated:

Program text

#define A_PIN 1 #define NUM_READS 100 #define pinRelay 7 const float typVbg = 1.095; // 1.0 -- 1.2 float Voff = 2.5; // turn off voltage float I; float cap = 0; floatV; floatVcc; float Wh = 0; unsigned long prevMillis; unsigned long testStart; void setup() ( Serial.begin(9600); pinMode(pinRelay, OUTPUT); Serial.println("Press any key to start the test..."); while (Serial.available() == 0) ( ) Serial.println("Test is launched..."); Serial.print("s"); Serial.print(" "); Serial.print("V"); Serial.print(" "); Serial. print("mA"); Serial.print(" "); Serial.print("mAh"); Serial.print(" "); Serial.print("Wh"); Serial.print(" "); Serial .println("Vcc"); digitalWrite(pinRelay, HIGH); testStart = millis(); prevMillis = millis(); ) void loop() ( Vcc = readVcc(); //read reference voltage V = (readAnalog(A_PIN ) * Vcc) / 1023.000; //reading the battery voltage if (V > 0.01) I = -13.1 * V * V + 344.3 * V + 23.2; //calculation of the current according to the I–V characteristic of the spiral else I=0; cap += (I * (millis() - prevMillis) / 3600000); // calculation of battery capacity in mAh Wh += I * V * (millis() - prevMillis) / 3600000000; // calculation of battery capacity in Wh prevMillis = millis(); sendData (); // send data to the serial port if (V< Voff) { //выключение нагрузки при достижении порогового напряжения digitalWrite(pinRelay, LOW); Serial.println("Test is done"); while (2 >1) ( ) ) ) void sendData() ( Serial.print((millis() - testStart) / 1000); Serial.print(" "); Serial.print(V, 3); Serial.print(" ") ; Serial.print(I, 1); Serial.print(" "); Serial.print(cap, 0); Serial.print(" "); Serial.print(Wh, 2); Serial.print(" " ); Serial.println(Vcc, 3); ) float readAnalog(int pin) ( // read multiple values ​​and sort them to take the mode int sortedValues; for (int i = 0; i< NUM_READS; i++) { delay(25); int value = analogRead(pin); int j; if (value < sortedValues || i == 0) { j = 0; //insert at first position } else { for (j = 1; j < i; j++) { if (sortedValues <= value && sortedValues[j] >= value) ( ​​// j is insert position break; ) ) ) for (int k = i; k >< (NUM_READS / 2 + 5); i++) { returnval += sortedValues[i]; } return returnval / 10; } float readVcc() { // read multiple values and sort them to take the mode float sortedValues; for (int i = 0; i < NUM_READS; i++) { float tmp = 0.0; ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); ADCSRA |= _BV(ADSC); // Start conversion delay(25); while (bit_is_set(ADCSRA, ADSC)); // measuring uint8_t low = ADCL; // must read ADCL first - it then locks ADCH uint8_t high = ADCH; // unlocks both tmp = (high << 8) | low; float value = (typVbg * 1023.0) / tmp; int j; if (value < sortedValues || i == 0) { j = 0; //insert at first position } else { for (j = 1; j < i; j++) { if (sortedValues <= value && sortedValues[j] >= value) ( ​​// j is insert position break; ) ) ) for (int k = i; k > j; k--) ( // move all values ​​higher than current reading up one position sortedValues[k] = sortedValues; ) sortedValues[j] = value; //insert current reading ) //return scaled mode of 10 values ​​float returnval = 0; for (int i = NUM_READS / 2 - 5; i< (NUM_READS / 2 + 5); i++) { returnval += sortedValues[i]; } return returnval / 10; }

Every 5 seconds, data on time, battery voltage, discharge current, current capacity in mAh and Wh, and supply voltage are transmitted to the serial port. The current is calculated according to the function obtained in paragraph 2. When the threshold voltage Voff is reached, the test is terminated.
The only, in my opinion, interesting point in the code, I would highlight the use of a digital filter. The fact is that when reading the voltage, the values ​​\u200b\u200bare inevitably “dancing” up and down. At first I tried to reduce this effect by simply taking 100 measurements in 5 seconds and taking the average. But the result still did not satisfy me. During the search, I came across such a software filter. It works in a similar way, but instead of averaging, it sorts all 100 dimension values ​​in ascending order, selects the center 10, and averages them. The result impressed me - the measurement fluctuations completely stopped. I decided to use it to measure the internal reference voltage as well (the readVcc function in the code).

5. Results

Data from the serial port monitor is imported into Excel in a few clicks and looks like this:

In the case of my Nexus 5, the declared battery capacity of the BL-T9 is 2300 mAh. Measured by me - 2040 mAh at a discharge of up to 2.5 V. In reality, the controller hardly allows the battery to sit down to such a low voltage, most likely the threshold value is 3V. The capacity in this case is 1960 mAh. A year and a half of the phone's service led to a capacity drawdown of about 15%. With the purchase of a new battery, it was decided to wait.
With the help of this tester, several other Li-Ion batteries have already been discharged. The results look very realistic. The measured capacity of new batteries coincides with the declared one with a deviation of less than 2%.
This tester is also suitable for metal-hydride finger-type batteries. The discharge current in this case will be about 400 mA.

A device with which you can check the capacity of lithium-ion AA batteries. Quite often, laptop batteries become unusable due to the fact that one or more batteries lose their capacity. As a result, you have to buy a new battery when you can get by with a little bloodshed and replace these worthless batteries.

What you need for the device:
Arduino Uno or any other compatible one.
16x2 LCD display using Hitachi HD44780 driver
Solid State Relay OPTO 22
Resistor 10 MΩ at 0.25 W
18650 battery holder
Resistor 4 ohm 6W
One button and power supply from 6 to 10V at 600 mA


Theory and operation

The voltage on a fully charged Li-Ion battery at no load is 4.2V. When a load is connected, the voltage rapidly drops to 3.9V, and then slowly decreases as the battery works. A cell is considered discharged when the voltage across it drops below 3V.

In this device, the battery is connected to one of the analog outputs of the Arduino. The voltage on the battery without load is measured and the controller waits for the “Start” button to be pressed. If the battery voltage is above 3V. , pressing the button will start the test. To do this, a 4 ohm resistor is connected to the battery through a solid state relay, which will act as a load. The voltage is read by the controller every half a second. Using Ohm's law, you can find out the current given to the load. I=U/R, U is read by the analog input of the controller, R=4 Ohm. Since measurements are taken every half second, 7200 measurements are obtained in each hour. The author simply multiplies 1/7200 of an hour by the current value, and adds the resulting numbers until the battery is discharged below 3V. At this moment, the relay switches and the display shows the measurement result in mAh

LCD pinout

PIN Purpose
1 GND
2 +5V
3 GND
4 Digital PIN 2
5 Digital PIN 3
6,7,8,9,10 No connected
11 Digital PIN 5
12 Digital PIN 6
13 Digital PIN 7
14 Digital PIN 8
15 +5V
16 GND



The author did not use a potentiometer to adjust the brightness of the display, instead he connected pin 3 to ground. The battery holder is connected negatively to ground and positively connected to analog input 0. A 10 MΩ resistor is connected between the plus of the holder and the analog input, which acts as a pull-up resistor. The solid state relay is turned on with a minus to the ground, and a plus to digital output 1. One of the relay's contact outputs is connected to the positive of the holder, a 4 ohm resistor is placed between the second output and the ground, which acts as a load when the battery is discharged. Keep in mind that it will get pretty hot. The button and switch are connected according to the diagram in the photo.

Since PIN 0 and PIN 1 are used in the scheme, they must be disabled before downloading the program to the controller.
After you connect everything, fill in the firmware attached below, you can try to test the battery.



The photo shows the voltage value that the controller considered.
The voltage on it must be higher than 3V.

The site is in test mode. We apologize for errors and inaccuracies.
We ask you to write to us about inaccuracies and problems through the feedback form.

Battery capacity meter on a microcontroller.

The device developed by the author is designed to automatically measure the capacity of most types of batteries - from small-sized to car batteries. The principle of measurement is based on discharging the battery with a stable current with automatic calculation of the discharge time and further multiplication of these values, the result is obtained in the usual dimension - ampere-hours. The basis of the device is the microcontroller (MK) Atmega8, which works according to the program, the codes of which are given in the article. In addition to the MK, the meter contains three microcircuits (K155ID3, KR142EN5V, LM358N) and an IRL2505 transistor. To indicate the results, two LED digital indicators are used: a three-digit TOT3361 (it shows the value of the discharge current in the X.XX format) and a nine-digit E90361-L-F (shows the value of the capacity in ampere-hours in the XX.XXX format and the voltage to which the battery can be discharged, ranging from 1 to 25.5 V). The current voltage of the battery is monitored. The codes of the MK program and the drawing of the printed circuit board are given. The MK program will also be hosted on our FTP server at< ftp:// ftp . radio . ru / pub /2009/03/ izm . zip >.

Each car owner is wondering what kind of device is needed to measure battery capacity. This value is often measured during scheduled maintenance, but it will be useful to learn how to determine it yourself.

Battery capacity measuring device

Battery capacity is a parameter that determines the amount of energy given off by the battery at a certain voltage in one hour. It is measured in A / h (Ampere per hour), and depends on which is determined by a special device - a hydrometer. When buying a new battery, the manufacturer indicates all the technical parameters on the case. But this value can be determined by yourself. For this, there are special devices and methods.

The easiest way is to take a special tester, for example "Pendant". This is a modern device for measuring the capacity of a car battery, as well as its voltage. In this case, you will spend the minimum amount of time and get a reliable result. To check, you need to connect the device to the battery terminals and within a few seconds it will determine not only the capacity, but also the battery voltage and the condition of the plates. However, there are other battery capacities.

First method (classic)

For example, a multimeter can be used as a device for measuring the capacity of a car battery, but you will not get accurate readings with it. A prerequisite for this method (called the test discharge method) is that the battery is fully charged. First you need to connect a powerful consumer to the battery (a regular 60W light bulb is quite suitable).


After that, you need to assemble the circuit, which consists of a multimeter, battery, consumer, and apply the load. If the light bulb does not change its brightness within 2 minutes (otherwise the battery cannot be restored), we take the readings of the device at certain time intervals. As soon as the indicator falls below the standard battery voltage (under load it is 12V), its discharge will begin. Now, knowing the period of time it took for the complete depletion of the energy reserve and the load current of the consumer, it is necessary to multiply these values. The product of these values ​​is the actual capacity of the battery. If the obtained values ​​differ from the passport data downwards, the battery needs to be replaced. This method makes it possible to determine the capacity of any battery. The disadvantage of this method is that it takes a lot of time.

Second method

You can also use the method in which the battery is discharged through a resistor using a special circuit. Using a stopwatch, we determine the time spent on the discharge. Since energy will be lost at a voltage within 1 Volt, we can easily determine using the formula I \u003d UR, where I is the current, U is the voltage, R is the resistance. In this case, it is necessary to avoid the complete discharge of the battery, using, for example, a special relay.

How to make a device yourself

If it is not possible to purchase a ready-made device, you can always assemble a device for measuring battery capacity with your own hands.

To determine the degree of charge and capacity of the battery, you can use There are many models of ready-made plugs for sale, but you can assemble it yourself. The following is one of the options.

This model uses an extended scale, which achieves high measurement accuracy. There is a built-in load resistor. The scale is divided into two ranges (0-10 V and 10-15 V), which further reduces the measurement error. The device also has a 3 volt scale and a different measuring device lead, making it possible to test individual battery cells. The 15V scale is achieved by reducing the voltage on the diode and zener diode. The current value of the device increases if the voltage value exceeds the opening level of the zener diode. When a voltage of the wrong polarity is applied, the protective function is performed by the diode.

In the diagram: R1- transmits the required current to the zener diode; R2 and R3 - resistors selected for the M3240 microammeter; R4 - determines the width of the narrow range of the scale; R5 - load resistance, switched on by the SB1 toggle switch.

The load current strength is determined by Ohm's law. Load resistance is taken into account.

AA battery capacity measuring device

The capacity of AA batteries is measured in mAh (milliamps per hour). To measure such batteries, you can use special chargers that determine the current, voltage and capacity of the battery. An example of such a device is the AccuPower IQ3 battery capacity meter, which has a power supply with a voltage range of 100 to 240 volts. To measure, you will need to insert batteries into the device, and all the necessary parameters will appear on the display.

Determination of capacity using a charger

Also, the capacity can be determined using a conventional charger. Having determined the magnitude of the charge current (it is indicated in the characteristics of the device), it is necessary to fully charge the battery and record the time spent on this. After multiplying these two values, we get the approximate capacity.

More accurate readings can be obtained using another method, for which you will need a fully charged battery, a stopwatch, a multimeter and a consumer (you can use, for example, a flashlight). We connect the consumer to the battery, and using a multimeter we determine the current consumption (the smaller it is, the more reliable the results). We note the time during which the flashlight shone, and multiply the result by the current consumption.

THE BELL

There are those who read this news before you.
Subscribe to get the latest articles.
Email
Name
Surname
How would you like to read The Bell
No spam