ST AN2390 APPLICATION NOTE

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.
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 Theory of operation

1.1 Li-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
V
F
Battery current
I
CONST
I
SAT
Stage 1
Stage 2
During Stage 1 (constant current charge), the charging current is kept at a constant value (I
) until the battery voltage reaches the final cell voltage (VF). In Stage 2 (constant
const
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 (I
). This current indicates that the battery is saturated.
SAT
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 (t voltage remains particularly low (under V
). In this case, charging is stopped and the
SC
) of fast charging, the battery
FAI L
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 I
FAIL
(equals to the maximum supply current).
If the charging time exceeds a certain expiration value (t battery is not yet saturated. As the t
value is greater than the t
EXP
), charging is stopped even if the
EXP
indicates that the battery is in good condition and fully charged.
5/42
value, the charger
FAI L
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 V
, charging restarts until VF is
SAT
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
V
V
V
V
I
FAST
I
FAI L
t
FAI L
t
EXP
MAX
V
F
TRI
FAST
SC
SAT
Maximum charging voltage 4.3
Final battery voltage 4.2
Trickle charge voltage 4.12
Fast charge voltage 3.0
Battery failure voltage 1.5
Fast charge current 1000
Battery saturation current 20
mAI
Short circuit current 1200
Battery failure time 30 s
Charge expire time 4 h
V
6/42
AN2390 Theory of operation

1.2 NiMH battery charging

The NiMH batteries uses a constant current algorithm as shown in Figure 3.
Figure 3. Variation of NiMH battery voltage
−∆V
(V)
cell
NiMH cell voltage: V
Charging time (t)
-10 mV/cell
The NiMH batteries use constant current charging. The end of charging can be detected by using the following methods.

1.2.1 Negative delta V method

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.

1.2.2 Zero delta voltage method

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.

1.2.3 Max. temperature detection method

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 V
, charging restarts until VF is
TRI
reached again. Charge time is reset when trickle charging starts.
Table 2. NiMH Charge parameters used in the evaluation board
Symbol Meaning Value Unit
V
MAX
TRI
V
FAI L
I
CONST
I
TRICKLE_1
I
SAT
I
FAI L
t
INITIAL
t
FAI L
t
EXP
t
FAST
Max Battery Voltage 1.7/Cell
Trickle Charge Voltage 1.0V/Cell
Battery Failure Voltage 0.9/Cell
Constant Charge Current 1000
Initial Trickle Charging Current 250
Battery Saturation Current 65
Short Circuit Current 1200
Initial Delay 10
Battery Failure Time 30
Charge Expire Time 4
Fast Charging Time 2

1.3 Slot management

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.
VV
mA
minutes
h

1.4 Man-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

2 Evaluation board implementation

2.1 Charging circuitry

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 (V feedback, it provides the regulated output power to the battery under charge using a non­inverting 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
) and current (I
BAT
). Along with this
BAT
P+
P-
d1
PWM1
L
PWM2
d2
C
V
OUT
9/42
Evaluation board implementation AN2390

2.1.1 DC (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.
Inductor selection
The minimum value of the inductor can be selected by choosing the maximum of the values given by the following two formulae:
Lmin =
T * [ ( Vin - Vsat1) * D1 - Vsat2 * D2 - Vout * (D1 - D2))]
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.
Capacitor selection
The minimum capacitor value can be selected using the following formula to keep the variation in Vout with in 1%:
Cmin =
In practice we take inductor and capacitor values that are 25% more than the values calculated using the above formulae.
100 * Iout * (1 - D1) * T
Vout

2.1.2 Battery discharge protection

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

2.2 Analog measurement circuitry

2.2.1 Voltage reference generation

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
V
IN
R3
100 (1%)
R16
4.7k (0.1%)
R17
15k (0.1%)
1
TL1431AIZ
2
VAREF
D4
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

2.2.2 Current measurement

The current measurement circuit is given in Figure 6.
Figure 6. Voltage and current measurement circuit
V+
BTI LI-ION BATTERY
AIN0
R19 5k (0.5%)
V
V
BAT
B
th
AIN8
V-
AIN1
R20
5k (0.5%)
As shown in the above diagram, a shunt (R 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 V
.
DD

2.2.3 Voltage measurement

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 V not possible to read the battery voltage directly, but this voltage is attenuated by using a resistor bridge (R whole ADC input range (0 to V
Note: The ST7 MCU does not measure V
I
). Some calculation must be performed on the conversion results to get the actual
BAT
battery voltage.
= 5 V, the microcontroller is supplied with VDD = 3.3 V. Therefore, it is
supply
, R20). However, this attenuation must still allow us to make full use of the
19
DD
R22
3.3k (0.5%)
0.5,1W (0.5%)
) is connected in series to the battery in order
23
R24
13.32k (0.5%)
R23
).
, it measures VB, which is proportional to (V
BAT
U3
1
O1
2
1-
3
1+
4
GND
LM258AD
VCC
O2
2­2+
8 7
6 5
BAT
V
IN
+ RS*
12/42
AN2390 Evaluation board implementation

2.2.4 Temperature sensing

The circuit for the temperature measurement is given in Figure 7.
Figure 7. Temperature measurement circuit
V
ST7 analog input (AIN8 or AIN14)
DD
R
S
Battery
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 look­up 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
Loading...
+ 29 hidden pages