AN2390
Application note
A flexible universal battery charger
Introduction
In everyday life, more and more portable electronic appliances, such as mobile phones, are powered by re-chargeable batteries so the demand for battery chargers for charging these batteries is increasing all the time.
This Application Note describes a cost-effective way to implement an intelligent battery charger for charging Li-ion and NiMH batteries as shown in Figure 1.
Figure 1. Universal battery charger evaluation board (STEVAL-ISB002V1)
It is based on a evaluation board built around the ST72324L microcontroller with a demo application code.
While the evaluation board described in this Application note is intended to be used for single cell Li-ion battery or 2 cell NiMH batteries you can customize this charger for a wide range of batteries because of the flexibility of the MCU and of the buck boost converter. The ST72324L MCU was selected for its main features, an embedded 10-bit A/D converter (to efficiently measure voltage, current and temperature), 16-bit timer (to generate PWM signals), main clock controller (to generate a time base signal) and 8 Kbytes of program memory which is more than enough to hold the algorithm for various battery chemistries. You can choose any other MCU that has similar capability. An LED is also used to indicate the charge status.
August 2007 |
Rev 1 |
1/42 |
www.st.com
AN2390
The evaluation board is powered from a 5 V supply. This supply is purposely chosen to show the application of the modified buck-boost converter. This is because, while a buck converter can be used to charge 2 cell NiMH battery from a 5 V supply, it is not generally suitable for charging a 4.2 V Li-ion battery due to the presence of protection diodes and other components which induce a voltage drop of around 1 V so you can not use a buck converter in this case.
The modified non-inverting buck-boost converter circuit used in this application note needs only one inductor and requires only an extra PWM signal compared to the kind of buck converter that is normally used. By using the switches in different forms, this converter can be used either as a buck converter or as a boost converter. Using the flexibility of the MCU, this converter is capable of charging a wide variety of batteries as can be seen from the evaluation board, where this converter has been used in buck converter mode to charge NiMH batteries, while a combination of buck-boost converter and boost converter modes are used to charge Li-ion batteries. For more details on the buck-boost converter, please refer to AN2389.
2/42
AN2390 |
Contents |
|
|
Contents
1 |
Theory of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
5 |
|
|
1.1 |
Li-ion battery charging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
5 |
|
1.2 |
NiMH battery charging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
7 |
1.2.1 Negative delta V method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.2 Zero delta voltage method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.2.3 Max temperature detection method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3 Slot management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.4 Man-machine interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 |
Evaluation board implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
9 |
|
|
2.1 |
Charging circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
9 |
2.1.1 DC (Buck-Boost) converter component selection . . . . . . . . . . . . . . . . . 10
Inductor selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
Capacitor selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
2.1.2 Battery discharge protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Analog measurement circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.2.1 Voltage reference generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2.2 Current measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.3 Voltage measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.4 Temperature sensing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.5 Battery recognition mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Li-ion battery recognition scheme. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
NiMH battery recognition scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
2.2.6 Power supply restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.3 MCU software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.1 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2.3.2 Use of the ST7 MCU on-chip peripherals . . . . . . . . . . . . . . . . . . . . . . . 19 2.3.3 State diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 |
How to use the evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
27 |
|
|
3.1 |
Connecting the evaluation board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
27 |
3.1.1 Jumper Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 3.1.2 Powering and running the evaluation board . . . . . . . . . . . . . . . . . . . . . . 28
3.2 Warnings/ Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3/42
Contents |
AN2390 |
|
|
3.3 Example test results with evaluation board . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.1 Test environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 3.3.2 Li-ion battery charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 3.3.3 NiMH battery charger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4 |
Conclusion: a low-cost flexible solution . . . . . . . . . . . . . . . . . . . . . . . . |
35 |
|
5 |
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
36 |
|
Appendix A . . |
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
37 |
|
|
A.1 |
Source file organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
37 |
|
A.2 |
Schematic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
38 |
|
A.3 |
BOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
39 |
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4/42
AN2390 |
Theory of operation |
|
|
1.1Li-ion battery charging
Li-ion batteries have a constant current/constant voltage charging algorithm as shown in
Figure 2.
Figure 2. Li-ion battery charging
Battery
voltage
VF
Battery current
ICONST
ISAT
Stage 1 |
Stage 2 |
During Stage 1 (constant current charge), the charging current is kept at a constant value
(Iconst) until the battery voltage reaches the final cell voltage (VF). In Stage 2 (constant voltage charge), the voltage is kept constant within this limit by slowly decreasing the
current. Charging is stopped when the current drops below the threshold value fixed by the manufacturer (ISAT). This current indicates that the battery is saturated.
In some cases before stage 1, pre-charging can also be done if the battery is fully discharged.
A failure condition occurs if even after a certain time (tFAIL) of fast charging, the battery voltage remains particularly low (under VSC). In this case, charging is stopped and the battery is isolated from the charger. The charger also indicates a battery failure without waiting (protection against short-circuit) if battery current is higher than the threshold IFAIL (equals to the maximum supply current).
If the charging time exceeds a certain expiration value (tEXP), charging is stopped even if the
battery is not yet saturated. As the tEXP value is greater than the tFAIL value, the charger indicates that the battery is in good condition and fully charged.
5/42
Theory of operation |
AN2390 |
|
|
The battery temperature is also monitored. If the battery overheats, charging is suspended until the battery cools down.
Once the battery is saturated, its voltage is still monitored to prevent the battery from discharging completely. If the battery voltage drops below VSAT, charging restarts until VF is reached again. Charge time is reset when trickle charging starts.
Table 1. |
Li-ion charge parameters used in the evaluation board |
|
||
Symbol |
|
Meaning |
Value |
Unit |
|
|
|
|
|
VMAX |
|
Maximum charging voltage |
4.3 |
|
VF |
|
Final battery voltage |
4.2 |
|
VTRI |
|
Trickle charge voltage |
4.12 |
V |
VFAST |
|
Fast charge voltage |
3.0 |
|
VSC |
|
Battery failure voltage |
1.5 |
|
IFAST |
|
Fast charge current |
1000 |
|
ISAT |
|
Battery saturation current |
20 |
mA |
IFAIL |
|
Short circuit current |
1200 |
|
tFAIL |
|
Battery failure time |
30 |
s |
tEXP |
|
Charge expire time |
4 |
h |
6/42
AN2390 |
Theory of operation |
|
|
The NiMH batteries uses a constant current algorithm as shown in Figure 3.
Figure 3. Variation of NiMH battery voltage
−∆V
(V)
NiMH cell voltage: Vcell
-10 mV/cell
Charging time (t)
The NiMH batteries use constant current charging. The end of charging can be detected by using the following methods.
As shown in Figure 3, the voltage of the NiMH batteries drops a little at the end of charging. So at the time, when the voltage slope versus time becomes negative, charging is stopped and trickle charging is started.
This method is a variant of the Negative delta V method. Actually in case of NiMH, there is a very slight drop in voltage (5-10 mV/ Cell) at the end of charging which is very difficult to detect using a 10-bit ADC. Also there is a chance of detecting the wrong end of charging due to noise. So instead of the negative delta voltage, we use a dV = 0 condition for a certain time duration. This gives very good approximations for detecting the end of charging. For this reason, this method is used in the evaluation board example instead of the negative delta method described in Section 1.2.1.
In this case if temperature rises above a threshold, charging is stopped and trickle charging is started.
In this demo the Zero Delta Voltage method is used as the primary technique for terminating the charging. Time Out, Max Voltage and Max Temperature are used as the secondary or back up methods for ending the charging.
7/42
Theory of operation |
AN2390 |
|
|
Once the battery is saturated, its voltage is still monitored to prevent the battery from discharging completely. If the battery voltage drops below VTRI, charging restarts until VF is reached again. Charge time is reset when trickle charging starts.
Table 2. |
NiMH Charge parameters used in the evaluation board |
|
||
Symbol |
|
Meaning |
Value |
Unit |
|
|
|
|
|
VMAX |
|
Max Battery Voltage |
1.7/Cell |
|
VTRI |
|
Trickle Charge Voltage |
1.0V/Cell |
V |
VFAIL |
|
Battery Failure Voltage |
0.9/Cell |
|
ICONST |
|
Constant Charge Current |
1000 |
|
ITRICKLE_1 |
|
Initial Trickle Charging Current |
250 |
mA |
ISAT |
|
Battery Saturation Current |
65 |
|
|
|
|||
IFAIL |
|
Short Circuit Current |
1200 |
|
tINITIAL |
|
Initial Delay |
10 |
minutes |
tFAIL |
|
Battery Failure Time |
30 |
|
|
|
|||
tEXP |
|
Charge Expire Time |
4 |
h |
tFAST |
|
Fast Charging Time |
2 |
|
|
|
In the demo, there are two different kinds of slots for charging Li-ion and NiMH battery chemistries to show that it can support wide range of batteries. But the positive terminal of one slot is shorted to the positive slot of another battery and similarly for the negative terminals. So the system can support charging of only one battery at a time. Hence you must take care to connect only one battery at a time to the charger. Otherwise the batteries will be shorted together.
1.4Man-machine interface
The charger periodically checks for battery presence so no button is needed to start or stop charging. An LED is used to indicate the charge status as listed in Table 3..
Table 3. |
LED slot status color code |
|
|
LED output |
Charging status |
|
|
|
|
OFF |
No battery in the slot |
|
|
|
Flashing @ 1 Hz |
Charging ongoing |
|
|
|
|
Flashing @ 2 Hz |
Problem in charging |
|
|
|
|
|
ON |
Battery Present/ Charging Complete |
|
|
|
A reset button is also included on the evaluation board to manually reset the application.
8/42
AN2390 |
Evaluation board implementation |
|
|
The evaluation board implements a solution with an external low-voltage DC supply.
To obtain a constant voltage or constant current during various stages, the ST7 microcontroller measures the battery voltage (VBAT) and current (IBAT). Along with this feedback, it provides the regulated output power to the battery under charge using a noninverting buck-boost converter circuit.
The buck boost converter is controlled by 2 PWM signals coming from the microcontroller as shown in basic circuit diagram (Figure 4). For more details on the buck/boost converter, please refer to AN2389.
Figure 4. Basic circuit diagram of MCU-based non-inverting buck-boost converter
PWM1 |
L |
d2 |
|
||
|
|
|
P+ |
|
|
d1 |
PWM2 |
C |
|
||
|
|
VOUT |
P- |
|
|
9/42
Evaluation board implementation |
AN2390 |
|
|
2.1.1DC (Buck-Boost) converter component selection
The value of inductor L and capacitor C are selected by the following section. For more detail please refer to AN2389.
The minimum value of the inductor can be selected by choosing the maximum of the values given by the following two formulae:
T * [ ( Vin - Vsat1) * D1 - Vsat2 * D2 - Vout * (D1 - D2))]
Lmin =
2 * Iout
T * [ Vd1 + Vout] * ( 1 - D1)
Lmin =
2 * Iout
Here Vsat1 and Vsat2 are the saturation voltages of the two switches Sw1 and Sw2.
Iout and Vout are the maximum output current and voltage respectively.
Vd1 and Vd2 is the voltage drop across diodes d1 and d2.
The duty cycle of the PWM signals driving switch Sw1 (PWM1) and Sw2 (PWM2) are D1 and D2 respectively.
The minimum capacitor value can be selected using the following formula to keep the variation in Vout with in 1%:
100 * Iout * (1 - D1) * T
Cmin =
Vout
In practice we take inductor and capacitor values that are 25% more than the values calculated using the above formulae.
If the charger is not powered on or if the battery is already fully charged, the PNP transistor is kept permanently off which isolates the battery from the charger. Because of series diode available in the buck-boost circuitry there is no reverse current flowing into the charger.
Therefore, the battery discharges into the output capacitor and resistive bridge. This allows battery voltage measurement while consuming very little current. Also some leakage current flows through the output capacitor.
10/42
AN2390 |
Evaluation board implementation |
|
|
In the evaluation board, TL1431 is used to provide the reference voltage for the ADC measurement as shown in Figure 5.
Figure 5. Voltage reference generation circuit
VIN |
R3 |
VAREF |
|
||
|
100 (1%) |
|
|
R16 |
1 |
|
|
|
|
4.7k (0.1%) |
|
|
|
TL1431AIZ |
|
|
D4 |
|
R17 |
2 |
|
15k (0.1%) |
|
|
|
This device provides a reference voltage to the ADC and provides a reference of precision better than the 0.5% needed for the battery charger application.
By choosing the appropriate value of R16 and R17 with the proper accuracy, we can provide the required reference voltage to the VAREF pin of the ST7 MCU using the following formula:
VAREF_VALUE = 2.5 V * (1 + R16 / R17)
11/42
Evaluation board implementation |
AN2390 |
|
|
The current measurement circuit is given in Figure 6.
Figure 6. Voltage and current measurement circuit
|
|
V+ |
|
|
|
|
|
|
|
|
|
BTI |
|
|
|
|
|
|
|
|
LI-ION BATTERY |
|
|
|
|
|
|
R19 |
VBAT |
|
|
|
|
|
|
|
5k (0.5%) |
AIN8 |
|
|
|
|
|
|
|
|
th |
|
|
|
|
|
|
AIN0 |
VB |
|
|
|
|
AIN1 |
|
|
V- |
|
|
|
|
|
|
||
|
R20 |
|
|
|
|
|
|
VIN |
|
5k (0.5%) |
|
|
|
|
|
|
|
|
|
|
R22 |
R24 |
|
U3 |
|
|
|
|
|
3.3k (0.5%) |
13.32k (0.5%) |
1 |
O1 |
VCC 8 |
|
|
|
|
|
|
||||
|
|
|
|
|
2 |
1- |
O2 |
7 |
|
|
|
|
|
3 |
1+ |
2- |
6 |
|
|
|
R23 |
|
4 |
GND |
2+ |
5 |
|
|
|
|
|
|
LM258AD |
|
|
|
|
|
0.5,1W (0.5%) |
|
|
|
|
As shown in the above diagram, a shunt (R23) is connected in series to the battery in order to measure the charging current. The drop across this sense resistor is further amplified by using the OP-AMP (Operational Amplifier) LM258A for better resolution and this amplified voltage is measured by the ST7 microcontroller using ADC channel AIN1. The amplification factor is chosen such that the OP-AMP output has a voltage range between ground and VDD.
The voltage measurement circuit is also given in Figure 6 above, where the ST7 ADC channel, AIN0 is used for voltage measurement. In the evaluation board, while the input
supply voltage Vsupply = 5 V, the microcontroller is supplied with VDD = 3.3 V. Therefore, it is not possible to read the battery voltage directly, but this voltage is attenuated by using a
resistor bridge (R19, R20). However, this attenuation must still allow us to make full use of the whole ADC input range (0 to VDD).
Note: |
The ST7 MCU does not measure VBAT, it measures VB, which is proportional to (VBAT + RS* |
|
IBAT). Some calculation must be performed on the conversion results to get the actual |
|
battery voltage. |
12/42
AN2390 |
Evaluation board implementation |
|
|
The circuit for the temperature measurement is given in Figure 7.
Figure 7. Temperature measurement circuit
VDD
Battery
ST7 analog input (AIN8 or AIN14)
RS
For Li-ion, there is an inbuilt NTC so there is no need for an external thermistor but for NiMH, an external NTC is connected to the negative terminal of the battery.
The same measurement technique is used for both cases. Here the ST7 ADC channel AIN8 is used for the Li-ion temperature measurement and ST7 ADC channel AIN14 is used for NiMH.
For this demo application, we do not need to monitor the temperature very extensively. We only need to detect extreme hot or cold conditions. For this reason, rather than using a lookup table to calculate the temperature, certain predefined parameters are used and these parameters are compared with the temperature reading in terms of NTC resistance which simplifies the calculation.
13/42