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.
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 11/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.
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 operationAN2390
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
SymbolMeaningValueUnit
V
V
V
V
I
FAST
I
FAI L
t
FAI L
t
EXP
MAX
V
F
TRI
FAST
SC
SAT
Maximum charging voltage4.3
Final battery voltage4.2
Trickle charge voltage4.12
Fast charge voltage3.0
Battery failure voltage1.5
Fast charge current1000
Battery saturation current20
mAI
Short circuit current1200
Battery failure time30s
Charge expire time4h
V
6/42
AN2390Theory 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 operationAN2390
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
SymbolMeaningValueUnit
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 Voltage1.7/Cell
Trickle Charge Voltage1.0V/Cell
Battery Failure Voltage0.9/Cell
Constant Charge Current1000
Initial Trickle Charging Current250
Battery Saturation Current65
Short Circuit Current1200
Initial Delay10
Battery Failure Time30
Charge Expire Time4
Fast Charging Time2
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 outputCharging status
OFFNo battery in the slot
Flashing @ 1 HzCharging ongoing
Flashing @ 2 HzProblem in charging
ONBattery Present/ Charging Complete
A reset button is also included on the evaluation board to manually reset the application.
8/42
AN2390Evaluation 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 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
) and current (I
BAT
). Along with this
BAT
P+
P-
d1
PWM1
L
PWM2
d2
C
V
OUT
9/42
Evaluation board implementationAN2390
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:
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
AN2390Evaluation 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 implementationAN2390
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
22+
8
7
6
5
BAT
V
IN
+ RS*
12/42
AN2390Evaluation 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 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
Evaluation board implementationAN2390
Figure 8.NTC resistance value indication for Li-ion
No battery present
R
det
Cold condition
R
cold
Battery under normal temperature conditions
R
heat
Heat condition
Note:1Here R
corresponds to 45°C as the temperature limit for Heat Condition and R
heat
corresponds to 0°C as the temperature limit for Cold condition for safe charging for both Liion and NiMH batteries.
2R
is a dummy condition to detect when no battery is in the slot. This threshold is used to
DET
detect the battery presence for Li-ion battery only. For NiMH we use a different battery
recognition scheme as explained in the following section.
2.2.5 Battery recognition mechanism
In this demo, different techniques are used for Li-ion and NiMH batteries to recognize
whether a battery is present in the evaluation board or not.
Li-ion battery recognition scheme
As explained in the previous section, for Li-Ion batteries, the in-built NTC thermistor is used
to detect battery presence as shown in Figure 8
NiMH battery recognition scheme
In this case, there is no inbuilt NTC in the NiMH as there is in a Li-ion battery. Hence we can
not use the same technique for recognizing a NiMH battery. The NiMH battery recognition
circuit is shown in Figure 9.
cold
14/42
AN2390Evaluation board implementation
Figure 9.NiMH battery recognition circuit
Q5
31
V
IN
V+
R7
1k
To charger
2STR1215
R26
470
2
BT2
Ni-MH BATTERY
R27
470
3
V-
Q6
2
E_FRONT
2STR1215
1
Here the combination of two transistors works as a switch which is controlled by the E_Front
signal coming from the ST7 MCU. The algorithm for NiMH battery recognition is as follows.
15/42
Evaluation board implementationAN2390
Figure 10. NiMH battery recognition algorithm
NiMH BATT
Recog Algo
IF (I
BAT
> I
OPEN
NO
)
Exit
YES
ENABLE THE SWITCH AND
MEASURE THE BATTERY
VOLTAGE
NO
IF (V
BAT
> V
OPEN
)
BATTERY PRESENT
YES
BATTERY NOT PRESENT
END
Here if the battery current is less than a predefined threshold, switch (Q5) as shown in
Figure 9, is enabled and the battery voltage is measured if the battery voltage is lower than
the certain threshold the battery is considered connected otherwise it is considered not to
be connected to the evaluation board.
2.2.6 Power supply restrictions
The battery characteristics have a direct influence on the choice of the DC power supply.
The supply must be able to drive enough current to charge the battery, even in fast charge
mode.
●V
SUPPLY
Also the MCU, Buck-Boost DC-DC converter, LED and OpAmp consumption must be taken
into account as well. R
In this demo, a DC supply providing 5 V and 2 A is chosen which is sufficient to satisfy the
above condition.
16/42
must be larger than (VCE|
is the sense resistor, indicated as R23 in Figure 6.
S
SAT
+ V
diode
+ V
BAT_MAX
+ RS* I
CONST
).
AN2390Evaluation board implementation
2.3 MCU software
2.3.1 Architecture
The software provided in this demo has state machine architecture. To explain more, various
charging states can be defined for each slot. Each slot is driven by its state machine, with
some interactions to implement front slot priority.
In order to measure the charge time, a timekeeper is implemented and counters are
incremented periodically. Most of the time, slot states are unchanged. This implies that the
PWM duty cycle, charge enable signals and LED on/off states are constant. Periodically, the
ST7 microcontroller measures the battery current, battery voltage and thermistor voltage of
both slots. Using the measurements and the timekeeper values, it updates slot states and
the output configuration. If necessary, it resets the timekeeper.
17/42
Evaluation board implementationAN2390
Figure 11. Main software flowchart
RESET
Initialize I/O ports and peripherals
Initialize slot states
Launch timekeeper
Wait for
state update request
from main time base
Perform the measurements
Correct battery voltage measurements
with battery current measurements
Poll Li-ion
battery
Ye s
No
Poll NiMH
battery
Ye s
No
FrontRear
Voltagemean of 16 mean of 16
Currentmean of 16 mean of 16
Thermistormean of 16 mean of 16
Li-ion slot monitor
Updates front slot state depending on:
Previous
slot states
Update output configuration
NiMH slot monitor
Updates front slot state depending on:
Previous
slot states
Measurements
Timekeeper
Measurements
Timekeeper
18/42
Update output configuration
?
Reset timekeeper
AN2390Evaluation board implementation
2.3.2 Use of the ST7 MCU on-chip peripherals
The time base is generated using the Main Clock Controller and the PWM is generated by
the 16-bit timer. In order to minimize supply current, the ST7 core puts itself into WAIT
mode between two state updates which is updated @50 ms for Li-ion and @5 sfor NiMH
but the PWM duty cycle for both is updated @50 ms. The reason for keeping the state
update high for NiMH is to detect the end of charging conditions properly which requires
monitoring the voltage difference (Zero Delta Voltage Condition) for a long period of time,
keeping a low value might result in wrong detection. The selection of state update request
for NiMH depends on the user application.
In this demo, the same interrupt condition (Timer reaching zero) also increments the
timekeeper counters. This means the timekeeper is synchronized with the state updates.
The timekeeper divides the standard timer frequency. To do this, it has three counters: tick,
timeKeeper_Low and timeKeeper_Hi.
Table 4.Charge timekeeper counters
ticktimeKeeper_LowtimeKeeper_hi
Increment ConditionTimer Zero ITtick = 0timeKeeper_Low = 0
Period
GeneralT
Evaluation
board
TMZ
2 ms250 ms1 min
125 * T
TMZ
60,000 * T
TMZ
The analog to digital converter (ADC) is used intensively before each slot state update. In
most cases, the PWM output cannot be disabled, so due to switching noise, the ADC
accuracy is not optimal. To reduce errors, the ADC measures battery voltage, battery
current and battery temperature 16 times in a row and takes the average as the final value.
The software is able to remove any spurious errors due to noise to avoid any wrong
interpretations. The slot state monitoring software works with the mean values.
As explained earlier, battery voltage measurements must be corrected with battery current
measurements. These corrections require some computing, performed on the 16-bit words.
19/42
Evaluation board implementationAN2390
2.3.3 State diagrams
A slot can be in one of the nine states as described in following table. These states are
updated periodically as described earlier in Section 2.3.1
Table 5.Slot state definitions
Output configuration
NameMeaning
Slot outputsPWM duty cycle
IDLESlot empty
TRI_11st Trickle charge state
CIConstant current charge
CV
Constant voltage charge,
duty cycle down
TRI_22nd Trickle charge state
SATBattery saturated
EXPCharge time expired
FAILBattery failure
Charge disabled,
LEDs off
Charge enabled,
LED blinking @ 1Hz
Charge disabled,
LED ON
Unchanged
Updated periodically to
bat
= I
tri_1
have I
Updated periodically to
have I
bat
= I
const
Updated periodically to
bat
= V
F
have V
Updated periodically to
bat
= I
tri_2
have I
Unchanged
Charge disabled,
HEAT
Charge suspended
by overheat
LED blinking @ 2Hz
It is important to understand that this choice of states is only one solution and that there are
many possible ways to manage the behavior of the charger.
The state transition diagram is too complex to be shown in a single figure, it has been
divided into six parts shown in Figure 12 through Figure 17. In the diagrams, 't' stands for
the timekeeper value. The rectangles represent actions performed once during a state
transition.
20/42
AN2390Evaluation board implementation
Figure 12. General charging flow – Li-ion charging state diagram (1/3)
Li-ion charging
algorithm
EXP
If V
BAT
< V
TRI_2
SAT
IDLE
If V
> V
If (I
TRI_1
BAT
> I
If V
) OR if (V
FAIL
BAT
FAIL
> V
BAT
FAST
CC mode
< V
AND t > t
SC
FAI L
SAT
)
CV mode
If I
BAT
BAT
> I
F
SAT
Trickle charging
to maintain
current = 0.2C
CI_D
CI_U
Heat
If V
> V
BAT
F
Suspend PWM until
it gets to normal
condition
CV_D
CV_U
21/42
Evaluation board implementationAN2390
Figure 13. Time expiry condition – Li-ion charging state diagram (2/3)
The following jumpers must be correctly configured for proper operation of the evaluation
board.
J1: This is a 3-pin connector for selecting between ICC clock and resonator clock.
Figure 18. ICC connector
EXT
123
OSC1 ICC_OSC
J1
ICC clock is used only when we need to re-program the ST7 microcontroller. For normal
operation please short pin 1 and pin 2.
J2, J3: These jumpers are used to connect charger slots for different batteries as shown in
Figure 19.
Figure 19. J2 and J3 connections
UNIVERSAL BATTERY
RT1: NTC
CONNECTOR
CHARGER
J2 CONNECTOR FOR NiMH
V+
V-
J3 CONNECTOR FOR Li-ION
V+
TV-
Put NTC
close to slot
2-CELL NiMH
BATTERY CHARGER SLOT
27/42
1-CELL Li-ION
BATTERY CHARGER SLOT
How to use the evaluation boardAN2390
The role of each jumper is as follows:
J2: Used to connect NiMH Battery Charger Slot
J3: Used to connect NiMH Battery Charger Slot
RT1: RT1 is used to connect external NTC. This NTC is put close to the NiMH charger slot
to correctly monitor the NiMH battery temperature.
3.1.2 Powering and running the evaluation board
After all the jumpers are connected as described in Section 3.1.1, you can connect the
power supply. To connect the power supply there is a power jack X1 (5V, Gnd) available on
the evaluation board. You need to connect a DC power supply of (5V, 2A) to this connector.
After connecting the power supply, you need to press the Reset button on the evaluation
board for correct operation.
Now the evaluation board is in running mode and you can monitor the charging status
through LED D5 status as mentioned in Tab le 3 .
Note:It is necessary to press the Reset button once after connecting the power supply as the LVD
feature is not used in this evaluation board. However the LVD can be implemented in a real
application
3.2 Warnings/ Limitations
The user should be aware of the following warnings/limitations when using this evaluation
board.
1.Only one type of battery can be charged at a time and there is no protection to prevent
shorting the batteries if they are connected simultaneously in both slots. So the user
has to make sure to connect only one battery at a time.
2. There is no protection for reverse battery polarity connection but it can be provided on
customer request.
3. To minimize noise spikes at the input power supply, please connect a capacitor of 100 220 uF between the input power supply and Gnd.
3.3 Example test results with evaluation board
3.3.1 Test environment
In this implementation of the buck-boost converter, the following values are taken into
account.
Transistor drop |V
V
= 0.5V, F
sense
timer is updated at 500 Hz.
| (SAT) = 0.2V, Diode drop |Vd| = 0.55 V, L = 75 mH, C = 470 uF, Max
CE
= 8 MHz, F
cpu
= 16 kHz and Ambient Temperature = 24 deg C. Also the
pwm
28/42
AN2390How to use the evaluation board
3.3.2 Li-ion battery charger
The following parameter values are used in the Li-ion charger:
Table 6.Li-ion battery charger parameters
SL NoParameter nameValue
Input Parameter
1Input Supply Voltage5 V
2Max Input Supply Current2A
Output Parameter
3Max Battery Output Voltage4.2V
4Max Output Current1000 mA
The following values are programmed for the different phases:
1) Precharge Phase:
Here Vbat <= 3.0 V and charging current: 200 mA
2) Constant Current Phase:
Here 3.0 < Vbat < 4.2 V and charging current: 500 mA
3) Constant Voltage Phase:
Here 4.15< Vbat < 4.2 V
Ta bl e 9 shows the results of an experiment with the evaluation board charging a single Li-ion
battery.
29/42
How to use the evaluation boardAN2390
Table 7.Li-ion test results
SL NoTime (minutes)
Input voltage
(V)
Input current
(mA)
Output voltage
(V)
Output current
10512303.91050
235123041050
38512804.051050
413513504.11050
518513604.141050
623513804.181050
728513904.21050
830514704.21080
931513004.21045
1032512704.2975
1134512604.2968
1236511504.2906
1338510704.2867
144059704.2799
154258504.2712
164457204.2616
(mA)
174656504.2555
185853304.2280
196053104.2260
206252704.2224
216552404.2205
226852004.2160
237052004.2160
247351634.2129
257551504.2123
267851244.294
278051204.290
288351104.281
29855924.264
30885904.261
31935744.245
32995544.227
30/42
AN2390How to use the evaluation board
The total time was around 99 minutes in which the constant current phase remained for
around 30 minutes. Figure 20 shows the graph of the output current versus time.
Figure 20. Output Current vs. Time
Output Current (mA) Vs Ti m e (Minutes)
1200
1000
800
600
400
Current (mA)
200
0
0
13
28
32
38
44
60
68
75
83
93
Time (Minutes)
The variation in the output current was around +/- 10mA and the variation in output voltage
was +/- 20 mV.
3.3.3 NiMH battery charger
The following parameter values are used for the NiMH charger.
Table 8.Table 8: NiMH battery charger parameters
SL NoParameter nameValue
1Input Supply Voltage5 V
2Max Input Supply Current2 A
3Max Battery Output Voltage1.7 V / cell
4Output Current1000 mA
The following values are programmed for the different phases:
1) Pre-charging Phase:
Here Vbat <= 1.0 V and charging current: 0.1 C = 200 mA
Charging time taken by the battery: 10 minutes (approximately)
Input Parameter
Output Parameter
2) Constant Current Phase:
Charging Current = 1 A and Programmed charging time = 2 Hr
31/42
How to use the evaluation boardAN2390
3) Saturation Phase:
Charging Current = 0.03 C = 60 mA, and Expiry Time = 4 Hr.
In this case the C rate is 1000 mA. After the expiry time is over, charging is stopped till a new
battery is inserted.
Ta bl e 9 shows the results of an experiment for constant current charging phase for a 2 Cell
NiMH battery charger.
32/42
AN2390How to use the evaluation board
Table 9.NiMH test results
SL NoTime (minutes)
Input voltage
(V)
Input current
(A)
Output voltage
(V)
Output current
1051.013.161015
2551.013.1651015
31051.013.1681015
41551.013.1721015
52051.013.1681015
62551.013.161015
73051.013.1681015
83551.033.1721015
94051.033.1751015
104551.033.1861015
115051.033.21015
125551.033.2061015
136051.033.2141015
146551.033.2231015
157051.033.2311015
167551.033.2451015
(mA)
178051.053.2521015
188551.053.2641015
199051.053.2821015
209551.053.31015
2110051.083.351020
2210551.083.41020
2311051.083.381020
2411551.083.371020
2512051.083.371020
2612551.083.371020
2713051.083.361020
The variation in the output current was around +/- 10 mA and the variation in output voltage
was +/- 20 mV. Figure 21 shows the graph of the output current versus time.
33/42
How to use the evaluation boardAN2390
Figure 21. Output voltage vs. time (in minutes)
Output Volta ge Vs Time
3.45
3.4
3.35
3.3
3.25
3.2
3.15
3.1
Output Voltage (in V)
3.05
3
0
10
20
30
0
40
60
5
Time (In Minutes)
70
80
90
100
110
120
13
0
Figure 21 shows the variation in output voltage versus time for the constant current charging
phase. Here the programmed time for constant current is increased by 10 minutes just to
show the behavior of the charger.
34/42
AN2390Conclusion: a low-cost flexible solution
4 Conclusion: a low-cost flexible solution
Everything on the evaluation board has been designed to make it easy to adapt in any way
(to other types of battery, new behavior specifications, additional design constraints, etc.).
●The demo is developed with an ST72324L microcontroller device but you can choose
another MCU device if you so desire.
●Because of the flexibility of the MCU, you can modify the firmware for wide variety of
applications and this is well supported by the flexible non inverting buck boost converter
which can adapt to different supply voltages. For example, you could easily make a
USB charger to charge a 4.2 V Li-ion battery.
●The firmware is developed in ‘C’ language. So it is easily upgradeable.
●The number of components needed for each slot (charging and feedback) is minimal,
so replacing them is inexpensive.
●The code size is approximately 3 Kbytes. The current firmware supports Li-ion and
NiMh battery chemistry but it can be easily converted to charge other battery
chemistries, for example to charge SLA batteries.
●ST’s low cost PNP and NPN transistors and diodes are used to implement this
converter which makes it even more cost-effective.
The code is written in ‘C’ language. The Code Size is approximately 3 Kbytes. The source
code consists of 3 source files and 3 header files as listed below:
●main.c: it consists of the main subroutine.
●BC_func.c: These files contain the definitions of all the functions used in the main
subroutine.
●Interrupt_vector.c: it consists of the interrupt vector mapping files.
●BC_func.h: it consists of the declarations of all the global variables and the functions
used in the main.
●ST7lib_config.h: It is the configuration file and also consists of the #define statements
for assembly language instructions like ‘NOP’ etc.
●st7lites2_5_reg.h: It contains the declarations of the hardware registers.
This modular organization makes it easier to perform minor modifications to the software.
Table 10.Examples of minor software modifications
If you want to change……only modify…
Voltage thresholds
PWM frequency
State update frequency
Timing thresholds
I/O ConfigurationBC_InititalizePeripheral() in BC_Func.c
State diagram
State definitions
BC_SlotMonitor() function in BC_Func.c
Transition conditions
Transition priority
BC_Func.h
37/42
A.2 Schematic
D
8
Li-ION BATTERY
123
J2
V+
AIN8
100 (1%)
D3
Vsupply
F1
12
TL1431AIZ
R16
4.7k (0.1%)
IN4148
FUSE2
U1
V-
D4
8
Vin
Vout1GND2GND3NC
VDD
7654321
VAREF
R3
Vin
Universal Battery Charger
Ni-MH BATTERY
1
2
J3
V+
V-
Vin
7
8
O2
VCC
O111-21+3GND
U3
AIN1
R24
13.32k (0.5%)
R22
3.3k (0.5%)
AIN8
BT1
Li-ION BATTERY
th
C2
100nF(Not To Be Mounted)
3
R17
7
5
GND6GND
INHIBIT
4
Q3
R1
330
V+
R19
15k (0.1%)
R15
10k
KF33BDTR
6
4
E
C5C
C1C2B
3
5k (0.5%)
C1
470uF/16V
D2
1N5821
R4
L1
STT818B
100
75uH/1000mA
Vsupply
D1
1N5821
R2
100
31
6
5
2-
2+
LM258AD
4
R23
0.5,1W(0.5%)
Vin
13
Q5
V-
R7
R20
5k (0.5%)
AIN0
Q4
23
31
2
Q1
AN2390
C
LEDD6LEDD7LEDD8LED
D5
470
470
470
R9
R10
R11
R12
LED1
LED2
LED3
LED4
E_FRONT
2
2STR1215
Q6
31
R26
470
R27
470
2
2STR2215
1k
BT2
Ni-MH BATTER Y
2STF1360
1
Q2
R5
2STR1215
R13
68
2STR1215
R6
1k
2
PWM-1
470
AIN14
t
RT1
4.7k/NTC
V-
PWM-2
B
R25
10k
ICCSEL
ICCDATA
ICCCLK
RESET
470
33pFC433pF
Y1
C3
OSC_EXT
R8
1k
E_FRONT
12
34
56
78
9 10
CON1
U2
J1
PE0
PE1
GND
VDD
3
2
1
OSC_EXT
VDD
R21
4.7k
GND
OSC1
OSC2
22
23
VDD
OSC124OSC2
PB0
PB3
(HS)/PB4
PDO
PD1
VAREF1VSS2AIN8/PF03PF14AIN10/PF45PF6
AIN8
GND
VAREF
10k (1%)
R14
VDD
VSS
C5
RESET
21
HEADER 5X2
10nF
ICCSEL
20
RESET
S1
LED4
ICCSEL
6
PWM-1
OSC1
PA719PA618PA4
LED3
ST72F324LK2T6
7
C6
LED2
17
PA3
PC7
PC6
PC5
PC4
PC3
PC2
PC1
PF7
PC0
8
ICC
16MHz
OSC2
25
VDD
26
27
28
29
30
31
AIN0
32
AIN1
A
1of1
STMicroelectronicsPvt Ltd
Plot no. 1 , Knowledge P ark III,
Greater Noida -201308, UP
INDIA
UNIVERSAL_ BATT_CHARGER
2.2 uF/16V
100nF
100nF
C7
C8
C9
VDD
AIN0
AIN1
16
LED1
15
14
ICCCLK
13
AIN14
12
ICCDATA
11
10
9
PWM-2
ScaleSheet
Size FCSMNo.DWG No.Rev
A31
100nF
100nF
C10
AIN8
AIN14
R18
4.7k (1%)
VDD
1
2
X1
D
C
38/42
12345678
B
A
AN2390
A.3 BOM
Table 11.Bill of material
IndexQtyReference
11C1470uF/16VRB-.2/.4Any
26
31C62.2 uF/ 16V805Any
41C510nF805Any
51CON1HEADER 5X2IDC-10BAny
62D1, D21N5821
C3, C4, C7,
C8, C9, C10
Value / Generic
Part Number
Package
100nF805Any
DO-
201AD
Manufacturer’s
Manufact
urer
ordering code /
Recordable Part
ST1N5821
Number
71D3IN4148
DO-35-
TH
Any
82D4TL1431TO-92STTL1431AIZ
94
D5, D6, D7,
D8
LEDLEDAny
101F1FUSE2FUSEAny
111J1CON3SIP-3Any
121J2CON3SIP-3Any
131J3CON2SIP-2Any
14 1L1 75uH/1000mAIND Any
153Q1, Q2, Q62STR1215SOT-23ST2STR1215
161Q3STT818B
SOT23-
6L
STSTT818B
171Q42STF1360SOT-89ST2STF1360
181Q52STR2215SOT-23ST2STR2215
191R1330805Any
R5, R9, R10,
207
R11, R12,
470805Any
R26, R27
211R1368805Any
222R14, R1510k (1%)805Any
231R164.7k (0.1%)805Any
241R1715k (0.1%)805Any
251R184.7k (1%)805ST
262R19, R205k (0.5%)805Any
271R2, R7100805Any
39/42
Table 11.Bill of material
Manufacturer’s
IndexQtyReference
281R214.7k805Any
291R223.3k (0.5%)805Any
301R230.5, 1W (0.5%) RES AxailAny
311R2413.32k (0.5%)805Any
321R2510k805Any
331R3100 (1%)805Any
341R4100805Any
353R6, R81k805Any
361RT14.7k/NTCRAD-0.1Any
371S1SW-PBPUSHAny
381U1KF33SO-8STKF33BDTR
391U2ST72F324LTQFP-32STST72F324LK2T6
Value / Generic
Part Number
Package
Manufact
urer
ordering code /
Recordable Part
Number
AN2390
401U3LM258ADSO-8STLM258AD
411X1
421Y116MHzXTAL-1Any
Power
Connector
Euro 2 pinAny
40/42
AN2390Revision history
Revision history
Table 12.Document revision history
DateRevisionChanges
21-Aug-20071Initial release.
41/42
AN2390
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING
APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY,
DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE
GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.