Professional Documents
Culture Documents
Abstract
This Application Note describes Zilogs
Z8 Encore! XP-based Lithium (Li)-Ion battery
charger. The battery charger application uses the
internal clock of the Z8 Encore! XP MCU as the
system clock. An internal reference voltage of 2 V
is applied to the Analog-to-Digital Converter
(ADC) peripheral of the Z8 Encore! XP MCU.
Note: The source code file associated with
this Application Note (AN0218SC01.zip), is available for
download at www.zilog.com.
Discussion
This section provides a detailed description of the
the Z8 Encore! XP-bas ed b a t t er y c ha rge r
application. For more information on the Li-Ion
and SLA battery technologies, see Appendix D
Battery Technology on page 15.
Theory of Operation
At the core of a battery charger is a step-down DC
DC converter (also known as a buck converter) that
acts as a regulated power source. The charger hardware is capable of regulating the charger output in
a number of modes, such as constant voltage, constant current, or constant voltage with a current
limit. The charger can be viewed as a control system in itself. The type and capacity of the battery
determines the mode of operation of the battery
controllernamely, a constant current source or a
constant voltage source. The voltage (VSET) and
current (ISET) set points are also determined by the
type and capacity of the battery.
u ( t ) = ( k1 e ( t ) + k2 e ( t ) dt )
To be useful for a microcontroller based (discrete)
system, the integral is approximated by a running
sum of the error signal.
AN021802-0708
k1
U [ k ] = C1 e [ k ] + C2 e [ j ]
j=0
k2
U [ k 1 ] = C1 e [ k 1 ] + C2 e [ j ]
j=0
Page 2 of 16
Hardware Architecture
Figure 1 displays a hardware block diagram for the
battery charger application. The Z8 Encore! XPbased Li-Ion battery charger application features
the following hardware blocks:
Z8 Encore! XP MCU
Li-Ion battery
Power Section
Battery
PWM Output
Z8 Encore! XP
Development Board
Z8F042A
ADC ch0
ADC ch1
ADC ch2
ADC ch3
Feedback Section
Output Voltage
Battery Voltage
Battery Current
Battery Temperature
AN021802-0708
The system clock is derived from the Internal Precision Oscillator (IPO) of the Z8 Encore! XP
MCU.
Page 3 of 16
Software Implementation
All Z8 Encore! XP peripherals are initialized from
their power-on state to the required mode of operation. After initialization, the battery parameters are
loaded into the variables. Currently, these battery
parameters are defined in the charger.h header
file.
The safety and termination thresholds are calculated based on the battery parameters. Then, the set
points for the DC-DC step-down (buck) converter
voltage, the current, and the current limit are calculated. After these one-time calculations are complete, the charger software enters into an infinite
loop, which is broken only by a successful charge
completion or a safety error.
AN021802-0708
Page 4 of 16
Testing
This section describes the setup, equipment used,
and the procedure followed to test the Z8 Encore!
XP-based Li-Ion battery charger application.
Setup
Figure 2 displays the test setup for the Z8 Encore!
XP-based Li-Ion battery charger application.
PWM
Battery
Feedback Attenuators
The operational amplifier based feedback attenuator circuits are fed with a 12 V supply. The DCDC
converter works on a 8 V to 12 V DC input for the
batteries tested. The control algorithm provides the
necessary line regulation to sustain the voltage
variation at the input.
Equipment Used
The external DC power supply provides two different voltages to the charger circuitsthe DCDC
step-down converter and the feedback attenuators.
AN021802-0708
Page 5 of 16
Make
Type
Ratings
BPT40
Sony
4 V, 500 mAh
Results
The charging of the battery began in the constant
current mode with the charging current equal to
1 C. At a threshold specified by the manufacturer of
the battery, the charging switched from the
constant current mode to the constant voltage
mode. In the constant voltage mode, the charging
current was found to droop. The charging was
terminated when the current value dropped below
the set threshold.
Summary
This Application Note discusses a Li-Ion battery
charger implementation using the Z8 Encore! XP
MCU. The battery charger software accompanying
this document provides fast charging algorithms.
Fast recharge is possible due to the accurate
monitoring of the charging rendered by the 10-bit
accuracy of the ADC. Monitoring the charging
mechanism facilitates the accurate termination of
charging. Therefore, overcharging is prevented,
resulting in a longer battery life. Additionally, the
Pulse-Width Modulation technique facilitates an
accurate DC-DC step-down converter (buck)
implementation with excellent line/load regulation.
AN021802-0708
Page 6 of 16
References
The documents associated with eZ8 CPU,
Z8 Encore! XP Z8F042A MCU, and ZDS II
available at www.zilog.com are provided below:
ZDS IIIDE Zilog Developer Studio IIZ8 Encore! User Manual (UM0130)
AN021802-0708
Page 7 of 16
Appendix AGlossary
Table 2 lists the definitions for terms and abbreviations used in this Application Note.
Table 2. Glossary
Term/Abbreviation
Definition
ADC
Analog-to-Digital Converter.
1C
ISR
Li-Ion
Lithium Ion.
mAh
PI
PWM
Pulse-Width Modulation.
SLA
AN021802-0708
Page 8 of 16
Appendix BSchematics
Figure 3 displays the schematic diagram of the Z8 Encore! XP MCU pin diagram.
Processor:: Z8 Encore XP
VDD
U5
VDD
VDD
PC0/ANA4/CINP/LED
VSS
PC1/ANA5/CINN/LED
24
PC2/ANA6/LED
25
PC3/COUT/LED
26
PC4/ LED
16
-RESET
21
~RESET / PD0
DBG
22
DBG
PA0/T0IN/~T0OUT/XIN
PA1/T0OUT/XOUT
11
PA2/DE0
12
PA3/ ~CTS0
13
14
PWM
PA6/ ~T1OUT/T1IN
PA7/ T1OUT
D4
LED
D5
LED
17
PC6 / LED
19
PC7/ LED
20
PB0/ANA0/AMPOUT
27
PB0/ANA0
PB1/ANA1/AMPINN
28
PB1/ANA1
PB2/ANA2/AMPINP
PB2/ANA2
PB3/CLKIN/ANA3
PB3/ANA3
PB4/ANA7
PB5/VREF
ADD_VREF_2V5
(PB6) AVDD
AVDD
(PB7) AVSS
10
AVSS
PA5/TXD0
18
R8
560E
PC5/ LED
PA4/RXD0
15
R7
560E
23
R9
560E
R10
560E
D6
LED
D7
LED
Z8F042A
Title
<Title>
Size
A
Date:
5
Document Number
<Doc>
W ednesday, February 02, 2005
Rev
0.0
Sheet
of
Page 9 of 16
Figure 4 displays the schematic diagram of the external circuitry for the battery charger application.
VDD
CONN JACK PWR
3
2
1
F1
U7
V IN
RXE050
+
J8
C15
C16
SENSE
-RESET
VIN
2
4
SENSE
SHDN
OUT
C12
100uF, 10V
LT1129-3.3/DD
0.1uF
C14
0.1uF
100uF, 10V
NOTE:
SENSE should be sensed as close to
the processor as possible.
VDD
VDD
R30
10K
J8
VDD
B
1
3
5
C27
2
4
6
-RESET
DBG
-RESET
DBG
0.1uF
GND
CON6A
Title
<Title>
Size
A
Date:
5
Document Number
<Doc>
Wednesday, February 02, 2005
Rev
<Rev
Sheet
of
Page 10 of 16
Figure 5 displays the schematic diagram of the DC-DC step-down (buck) converter.
VP30V
R3
1K
V_out(+)
R37
18E
V_out(-)
IRF9540
Q1
D2
R1
L1
Q2
2N2222
PWM
3.3K
120uH
MBR360
C1
C2
R4
470E
J1
R2
D3
MBR360
2.2K
100uF
R5
79E
100uF
V_batt(+)
1
2
D1
LED
V_batt(-)
Rsense
R6A
10E
R6B
10E
C3
0.1uF
CON2
I_out(+)
I_out(-)
NOTE:
For Testing the VP30V is obtained from
External Power Source.
Title
Power Section
Size
A
Date:
5
Document Number
<Doc>
Wednesday, February 02, 2005
2
Rev
0.0
Sheet
of
Page 11 of 16
Figure 6 displays the schematic diagram of the feedback circuits for the battery charger application.
Feedback Circuits
0.1uF
VCC
R17
12
10K
V_batt(-)
14
V_batt(+)
3
R16
1K
AVDD12V
0.1uF
0.1uF
C7
C11
100uF
C9
0.1uF
C10
0.1uF
C7
1K
R21
R22
R23
10
10K
Battery Current
V_out(+)
R18
R19
LM324
U1B
B
7
10K
R24
1K
PB2/ANA2
1K
V_out(-)
R34
I_out(+)
11
10K
I_out(-)
LM324
U1C
R20
1K
C8
10uF
1K
1K
AVDD12V
11
AVDD12V
PB3/ANA3
Converter Output Voltage
R25
PB1/ANA1
Battery Voltage
10K
R28
1K
10K
Thermistor
J6
R15
PB0/ANA0
Battery Temperature
R14
LM324
U1A
13
R27
11
11
LM324
U1D
R26
1K
AVDD12V
1
2
1K
AVDD12V
10K
C7
R29
R35
10K
V_batt(-)
0.1uF
C7
NOTE:
For Testing the AVDD12V is obtained from
External Power Source.
Title
Feedback Section
Size
A
Date:
5
Document Number
<Doc>
Wednesday, February 02, 2005
2
Rev
0.0
Sheet
of
Page 12 of 16
Appendix CFlowcharts
This appendix provides flowcharts for the battery charger application.
Figure 7 displays the flowchart for the main routine. The main routine involves calculation of safety limits,
thresholds, duty cycle, reading of feedback values for battery voltage, charging current, and converter
voltage.
Start
Initialize peripherals
No
Yes
No
Yes
Terminate
AN021802-0708
Page 13 of 16
Figure 8 displays the flowchart illustrating the Interrupt Service Routine (ISR) to reload the PWM value
and update the charge termination data.
Start ISR
AN021802-0708
Page 14 of 16
Appendix DBattery
Technology
The four mainstream battery technology discussed
in this Application Note feature different charging
and discharging characteristics. Long-term battery
life and performance depends on how the batteries
are charged. Therefore, it is important to charge the
batteries with a mechanism specific to their
requirements.
It is also important to know when to terminate
charging as overcharging of a battery invariably
results in poor performance and can damage the
battery in extreme cases. The different battery
types function differently near the full charge condition. Therefore, require specific charge termination techniques. During charging, all batteries
exhibit a marked rise in voltage above the rated
battery voltage.
The two major rechargeable battery types include:
AN021802-0708
Page 15 of 16
As used herein
Life support devices or systems are devices which (a) are intended for surgical implant into the body, or (b)
support or sustain life and whose failure to perform when properly used in accordance with instructions for
use provided in the labeling can be reasonably expected to result in a significant injury to the user. A
critical component is any component in a life support device or system whose failure to perform can be
reasonably expected to cause the failure of the life support device or system or to affect its safety or
effectiveness.
Document Disclaimer
2008 by Zilog, Inc. All rights reserved. Information in this publication concerning the devices,
applications, or technology described is intended to suggest possible uses and may be superseded. ZILOG,
INC. DOES NOT ASSUME LIABILITY FOR OR PROVIDE A REPRESENTATION OF ACCURACY
OF THE INFORMATION, DEVICES, OR TECHNOLOGY DESCRIBED IN THIS DOCUMENT.
Z I L O G A L S O D O E S N O T A S S U M E L I A B I L I T Y F O R I N T E L L E C T U A L P R O P E RT Y
INFRINGEMENT RELATED IN ANY MANNER TO USE OF INFORMATION, DEVICES, OR
TECHNOLOGY DESCRIBED HEREIN OR OTHERWISE. The information contained within this
document has been verified according to the general principles of electrical and mechanical engineering.
Z8, Z8 Encore!, and Z8 Encore! XP are registered trademarks of Zilog, Inc. eZ8 is a trademark of Zilog,
Inc. All other product or service names are the property of their respective owners.
AN021802-0708
16
Page 16 of 16