Ceska verze

Rechargeable battery capacity meter (analyzer) 2

     Introduction:
This device is s slightly improved version of the previous battery analyzer. It can measure the capacity of a (rechargeable) battery (measured in mAh / Ah) and discharge energy (in Wh). It is suitable for NiCd and NiMH cells and accu-packs (1-12 cells), lead acid (flooded, VRLA, SLA) batteries up to 12V, Li-Ion and Li-Pol (1-4 cells), but also for other types such as LiFePO4, NiZn, alkaline, zinc-carbon etc., with a total voltage of up to 20V. The discharge current can be set from 0.01 to 2.56 A, there's also a 0.02 to 5.12 A version. This will allow you for example to check the health (degradation) of a battery, the efficiency of the charging method or to detect counterfeit batteries (the market is flooded with those in recent years). It also allows the maintenance of the battery by discharging it down to the required voltage prior to charging or to discharge the battery to a suitable voltage to prepare it for a long storage. You can even measure the capacity of a single use (disposable) batteries, but those obviously become useless after the measurement.
     Description:
The hearth of this battery analyzer (capacity meter) is microcontroller IO1 - Atmel AVR ATmega8A, ATmega8 or ATmega8L. Program to download and configuration bits setting is below. The working principle is simple: Connect the fully charged battery to the capacity meter. The battery is discharged via the meter and it measures its capacity and energy. The discharge current can be digitally selected in the range of 0.01 to 2.56 A in steps of 0.01 A. A double current version is also possible - for this, connect the pin 14 (PB0) to 0V and use 0.1ohm or 0.11ohm (two paralel 0.22ohm) for the current sensing resistor R16. Discharge is terminated when reaching the end voltage (cut-off voltage), which is also digitally selectable. IO1 is clocked by an internal 8 MHz RC oscillator. Because the accuracy of the measurement depends on the time measurement, 32 768 Hz timing crystal is used. Battery voltage (20V maximum value) is sensed by a divider with R9, R11, P1. Adjust the trimpot P1 so that the value on the display (in actual voltage display mode) equals the real voltage. The battery is discharged through the transistor T1 (PSMN2R0-30PL or AOT240L). The discharge current is sensed by shunt resistor R16 (0.22 ohm). The discharge current is stabilized by an operational amplifier (OpAmp) IO2. The reference voltage is obtained by pulse width modulation (PWM) from the terminal OC1A (PB1 - pin 15) of integrated circuit IO1. The PWM signal passes through the resistive divider and the low pass filter R10, R12, P2 and C7 and this produces a DC voltage proportional to the desired discharging current. The voltage on the gate of T1 is then controlled by IO2 OpAmp so that the voltage at the current sensing shunt R16 corresponds to this reference voltage. Current callibration process: Set P3 to the center position. Connect a battery capable of at least 2.56 A discharge current and a current meter in series with it. The battery can be replaced by a power supply for calibration. Set the discharge current to 2.56 A (or 5.12A in the x2 version), start the discharge (long press of TL1 button), then set P2 so that the actual discharge current equals to the chosen value 2.56A (5.12A). Then set the discharge current to 0.01 A (0.02A). Then correct the offset of inputs of the OpAmp IO2 using P3 - set P3 so that the actual current is 0.01A (0.02A). You might need to reiterate the adjustment one or few more times - go back to the maximum current and readjust P2, go back to the minimum current and readjust P3, and so on. Transistor T1 has to be placed on a heat sink corresponding to the maximum necessary power dissipation during discharge (P = U . I). T1 is a logic-MOSFET, which can operate with only few volts on its gate. If a standard type of MOSFET used, it is theoretically possible to power the IO2 OpAmp from a higher voltage (it may be the voltage at the input of 7805), but I recommend a logic-MOSFET. IO3 (7805) doesn't need to have a heatsink, if the supply voltage is not very high (less than cca 18V). LED1 indicates that the discharge and measurement process is running. Diode D1 and resistor R17 ensure that the T1 transistor is fully off when the discharging process is not active (it lifts the non-inverting input of the OpAmp above the inverting input voltage, making the output go low). The buttons TL1, TL2 and TL3 are used to control the device. As a display device, 4-digit LED display with common anode is used. The cathodes of the display are connected to port D, the anodes to bits 2-5 of port B. Four-digit display can be set up as two double digit LD-D036UPG-C, LD-D028UR-C, LD-D036UR-C or LD-D056UR-C, or a single 4-digit KW4-361AVA (types with very high brightness). Superbright display allows you to omit the usual transistors to amplify the anode current. The display is controlled in multiplex. Multiplex frequency is about 100 Hz. R1...R8 determine the display current and thus its brightness. They are chosen so that the current does not exceed the maximum output current of the AVR pin (40 mA). They can be about 680R to 2k2. This battery capacity meter is powered from a supply of about 8 - 30V. Current requirment is about 15-45 mA, depending on the number of lit segments and values ​​of R1... R8 (most current is consumed by the LED display). Capacitors C5, C6, C9 and C10 should be as close as possible to the integrated circuit IO1. In series with the tested battery, connect appropriate fuse, otherwise failure of the capacity meter (for example failure of current control or T1 failing short circuit) or reverse polarity of battery can cause fire! It is also recommended to use a fuse at the + power input.
     Control:
The battery meter is controlled with 3 buttons: "Mode", "+" and "-". Mode button switches six display states:
• 1) Display the actual voltage (0.00 V - 20.4 V).
• 2) Measured energy in Wh (Watt hours). Displays "En" symbol and then the value. During the discharging process it increments. After the discharge is finished, it shows the result.
• 3) Measured capacity in Ah (Ampere hours). Displays the "Ah" symbol and then the value. During the discharging process it increments. After the discharge is finished, it shows the result.
• 4) Elapsed discharge time in hours (0.00h - 999h).
• 5) Desired discharge current. Use the + and - to select from 0.01 A to 2.56 A (or 0.02 A to 5.12 A in the double current version).
• 6) The selected end voltage. Use the + and - to select the voltage at which the discharge process is terminated (range from 0.75 V to 20.0 V).
Pressing "-" in steps 2, 3 and 4 you can reset the energy, capacity and time values (it only works if the discharge process is not active). Long press of the Mode button starts or stops the discharging process. When discharging process is active, LED1 is on. After the LED1 turns off, you can read the measured data (energy, capacity, time). Before a new measurement you need to reset the data. (The data are not automatically reset at the beginning of the discharge and measurement process. This allows you to resume an interrupted measurement.) The end voltage is usually chosen around 0.8 - 1 V for NiCd and NiMH, 2.5 - 3 V for Li-Ion and Li-Pol, 2.5V for LiFePO, 8 - 10 V for lead-acid batteries and 0.75 - 0.9V for alkaline cells.

The program for download:
source code in Assembler (ASM)
compiled in HEX file (2358 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


The schematic of the Rechargeable battery capacity meter (analyzer) with AVR.


Configuration bits setting (in PonyProg).
In hexadecimal - Low Fuse: 24, High Fuse: C9.


The finished rechargeable battery capacity meter (analyzer).


Completed DIY battery analyzer - I added a 2nd fuse in series with the power supply.


My battery capacity meter - the fuse holders double as feet :) to make some space for the air to get to the heatsink from below. For higher dissipated powers, I operate it in a vertical position, making the heatsink more efficient.


The Rechargeable battery capacity meter (analyzer) in a box - almost finished


The Rechargeable battery capacity meter - putting the power transistor on the heatsink


The battery analyzer board during tests


Video - building the Battery analyzer 2.



Added: 9. IV. 2024
home