An0259 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Application Note

Low-Cost NiMH Battery Charger


Using the Z8F0830
AN025902-0208

Abstract – Setting maximum charging time between 4


hrs and 4.5 hrs (charging at C/4 of 2000
This application note presents a concept for a simple, mAh)
low-cost nickel-metal hydride (NiMH) battery
– Over-voltage termination
charger using the Zilog’s 20-pin Z8 Encore!® F0830
series microcontroller. • Bad battery detection using battery voltage/
current measurement
The battery charger design uses the 5.5296 MHz • LED indication for battery charging and charge
internal clock. An internal reference voltage of 2 V is completion
applied to the on-chip analog-to-digital converter
(ADC), which is used to monitor battery voltage, cur-
rent, and temperature. Discussion
NiMH batteries are an excellent choice for powering
Note: The source code associated with this high-drain devices such as digital cameras. They last
application note is available under longer than alkaline batteries, and are less expensive.
Z8 Encore! Applications Code
Library in Application Sample
The challenge with recharging NiMH batteries is
Libraries on www.zilog.com.
‘overcharging’. Overcharging an NiMH battery sig-
nificantly reduces its operating life. With traditional
Features overnight chargers, they are left un-plugged. These
low-cost chargers seldom have a ‘charge complete
The key features of the battery charger design
indicator,’ so that they are too easy to neglect.
include:

• Minimal hardware required A slow charge is technically more efficient than a fast
charge. The workaround is, create a low-cost charger
• Constant current charging using the Z8 design that charges batteries with a maximum 4 hrs to
Encore! F0830 pulse-width modulation 4.5 hrs charging cycle.
(PWM)
• Fast charge = 0.25 C (500 mA) for 2000 mAh The circuit is designed to stop the charging cycle
battery when it detects negative dv/dt. The circuit continu-
ously monitors battery voltage and current.
• Ability to charge three serially connected 1.2 V
AAA batteries at up to 500 mA
The advantage of this proposed design is its simplic-
• In-circuit programming simplifies firmware ity—fewer components reduce the cost of the circuit,
upgrades and evaluation and implementation is fast and easy.
• Battery voltage and current monitoring using
Z8 Encore! F0830 10-bit ADC Hardware Architecture
• Three methods for ending the charge cycle are: The hardware circuit is designed using the 20-pin Z8
– Detecting negative dv/dt Encore!® F0830 microcontroller. The design speci-

Copyright ©2008 by Zilog®, Inc. All rights reserved.


www.zilog.com
Low-Cost NiMH Battery Charger Using the Z8F0830

fies generally available components, and is simple to Timer


build and test.
The Z8 Encore!® F0830 MCU provides two timers,
Timer0 and Timer1. Timer0 is initialized to generate
The following Z8 Encore! F0830 microcontroller the PWM output at a frequency of 10 kHz. Timer1
features are used in the design: generates regular 50 µ s interrupts, during which
Flags are set or reset depending on the task to be
• Internal precision oscillator (5.5296 MHz) completed. The initialization routines are available in
used to set the system clock. timer.c file.
• Internal PWM frequency for charging set to 10
kHz. Feedback
The design uses a 7.5 VDC regulated external power The feedback module provides the logic for calculat-
supply to provide 3.3 VDD for the Z8 Encore! F0830 ing average voltage and current from the values cap-
MCU. tured by the ADC. The routines are available in
feedback.c file.
For details on hardware connections, see Appendix
A—Schematics on page 4. Charging
After calculating the average battery voltage and bat-
Software Implementation tery current, the loop parameter is calculated using
the proportional and integral (PI) loop. The routine
The software design consists of the following mod-
returns an error percentage with respect to its previ-
ules:
ous value. The error percentage is used to stabilize
the current flowing into the battery. The Ki and Kp
• ADC variables of the PI loop can be changed if required.
• Timer The routine is available in charger.c file.
• Feedback
Once the charging current is stabilized, the battery is
• Charging in the charging state. The charging routine is
For information on each module, see Appendix B— designed to prevent overcharging and overheating.
Flowchart on page 5. The charge cycle is ended when any one of the fol-
lowing occur:
ADC
• Negative dv/dt is detected.
The Z8 Encore!® F0830 MCU provides eight ADC
channels. Three channels are used to read the battery • Maximum charge time as set in the charging
voltage, current, and temperature using an internal routine elapses.
voltage reference of 2 V. A set of readings is obtained • Maximum battery voltage is detected.
from each of the channels and stored in an array
• A bad battery is detected.
which is later used for calculating the average volt-
age and average current. The ADC values are read The charging current is controlled by increasing or
with respect to timed intervals. The initialization rou- decreasing the PWM duty cycle. This process is
tines are available in adc.c file. adapted with respect to the error percentage returned
by the PI loop, thus stabilizing the charging current.
The routines for the above tasks are available in
charger.c file.

AN025902-0208 Page 2 of 7
Low-Cost NiMH Battery Charger Using the Z8F0830

Overcharging Protection References


Three additional charge termination checks are con- The documents associated with Z8 Encore! F0830
sidered in our design. Therefore, if negative dv/dt is available on www.zilog.com are provided below:
not detected for any reason, then the application ter-
minates charging based on over-voltage or timeout to
• Z8 Encore!® F0830 Series with Extended
prevent overcharging.
Peripherals Product Brief (PB0161).

You can set over-voltage (MAX_BATT_VOLT), cur- • Z8 Encore!® F0830 Series Product Specifica-
rent set limit (CURRENT_MAMP), maximum count tion (PS0251).
of negative slope (MAX_SLOP_COUNT), and max- • Z8 Encore!® F083x Series Programming Spec-
imum charging time (BATTERY_TIMEOUT) to the ification (PRS0010).
desired values in charger.h file and timer.h
• Z8 Encore!® Based AA type NiMH and NiCD
file.
Battery Charger Reference Design (AN0229).
• Z8 Encore!®-Based SLA Battery Charger
Example: Maximum timeout calculation; if battery
Application Note (AN0223).
rating is 400 mAh and charging current is 200 mA.
• Z8 Encore!®-Based NiMH Battery Charger
Maximum Time (Hour) = Rated battery current/ Application Note (AN0222).
charging current = 400/200 = 2 hrs • Z8 Encore!®-Based NiCD Battery Charger
Application Note (AN0221).
Set the macro in timer.h file for 2 hrs: • Z8 Encore! XP®-Based Lithium Ion Battery
Charger (AN0218).
# BATTERY_TIMEOUT 2 /* maximum • Z8 Encore!®-Based Battery Charger (AN0137)
battery charging time */ • eZ8 CPU Core User Manual (UM0128).

Results
The batteries are charged in CONSTANT-CUR-
RENT mode up to 500 mA. Charging is terminated
when negative dv/dt is detected, maximum battery
voltage is detected, or the maximum charge time
elapses.

Summary
This application note describes a low-cost NiMH bat-
tery charger implementation using the Z8 Encore!®
F0830 MCU. The MCU’s internal 10-bit ADC makes
accurate recharging possible, and the overall design
ensure that the NiMH batteries are never over-
charged.

The design also makes use of PWM to provide an


accurate DC-DC converter (buck) implementation,
so that the hardware cost is low.

AN025902-0208 Page 3 of 7
Low-Cost NiMH Battery Charger Using the Z8F0830

Appendix A—Schematics
Appendix A displays the schematics of Low-Cost NiMH Battery Charger (Figure 1).

Figure 1. Low-Cost NiMH Battery Charger Schematic


AN025902-0208 Page 4 of 7
Low-Cost NiMH Battery Charger Using the Z8F0830

Appendix B—Flowchart
This Appendix displays the flowchart for the Low-Cost NiMH Battery Charger (Figure 2).

Start

Initialize peripheral:
• ADC,
• Timer in continuous mode
• Timer in PWM mode

ADC sample Yes


collected?

Calculate PI loop parameter


No

PI loop parameter Yes


calculated??

Check for termination


No

Terminate battery No
charging?

Load new PWM


Yes

Stop charging

End

Figure 2. Flowchart for NiMH Battery Charger

AN025902-0208 Page 5 of 7
Low-Cost NiMH Battery Charger Using the Z8F0830

Appendix C—Battery Technology


The four mainstream battery chemistries (NiCd, Charging a Nickel-Metal Hydride
NiMH, SLA, Li-Ion) have different charging and dis- (NiMH) Battery
charging characteristics. Long-term battery life and
performance is critically dependent on how the bat- NiMH batteries exhibit higher power density com-
tery is charged. It is therefore critical to charge the pared to their NiCd counterparts. The per-cell voltage
respective batteries with the mechanism they require. of the NiMH battery type is 1.2 V, similar to NiCd
batteries.
It is also important to know when to terminate charg-
ing. Battery overcharging causes in poor perfor- NiMH batteries must be charged via the constant cur-
mance and can damage the battery in extreme cases. rent charging method. While charging, as the voltage
Different battery types behave differently in full crosses the full charge point, the voltage drop is not
charge condition and thus require specific charge ter- as low as it is in NiCd batteries. Consequently, nega-
mination techniques. tive dv/dt charge termination is usually not recom-
mended for these batteries.

Instead of the drop in cell voltage, the battery tends to


plateau after a small drop. This flat region is the pre-
ferred indication for full battery charging, rather than
the drop. Consequently, this termination mechanism
is called zero dv/dt termination.

NiMH batteries do not suffer from memory effect as


do NiCd batteries. As a result, they replace NiCd bat-
tery types in applications such as cell phones because
the increase in price is justified by the reduction in
weight and absence of memory effect.

AN025902-0208 Page 6 of 7
Low-Cost NiMH Battery Charger Using the Z8F0830

DO NOT USE IN LIFE SUPPORT


Warning:

LIFE SUPPORT POLICY


ZILOG’S PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE
SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS PRIOR WRITTEN APPROVAL OF
THE PRESIDENT AND GENERAL COUNSEL OF ZILOG CORPORATION.

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. All other product or service
names are the property of their respective owners.

AN025902-0208 Page 7 of 7
7

You might also like