You are on page 1of 12

Universal Battery Charger

Author: Felixls
Blog: http://sergiols.blogspot.com/
Version: 1.0
Firmware Version: 1.1
Project Contributors
Special thanks to the following forum users Ucontrol (www.ucontrol.com.ar):
Geronimox, The fluf, Islagrande, HJ, Ariel, Gabriel, xesc0, Luis F and many more for your
interest and encouragement to finish.
Features
Supports Pb batteries, SLA, NiCd, NiMH, Li-Ion and LiPo.
Firmware written in C compiler SDCC 2.9.0.
Manager platform written in Java.
Allows charging, discharging and cycling sensors using different cut.
Refined implements algorithms to optimize the life of the batteries.
Highly accurate measurements.
Serial connection.
Optional EEPROM memory.
Menu full operation.
Low cost
Summary
The battery charger described in this document complies with all recommendations current
design of battery chargers. This charger can charge slowly, medium or fast all popular battery
types without hardware modifications or firmware.

Page 2
Introduction
Continuous improvement in battery technology requires increasingly sophisticated algorithms
load to ensure safe and fast charge. Accurate monitoring of the charging process is necessary to
minimize charging time and use the maximum capacity of the battery without harming them.
Basics
Charging a battery is made possible by a reversible chemical reaction that restores energy in a
chemical system. According to the chemical used, the battery will have certain features. When a
charger is designed, it is necessary to have a detailed knowledge of these features to avoid
damage caused by an overload.
Design data
Programming Language
Code size
PWM Frequency
Clock
Current Measurement
Communication with PC
Memory

SDCC C compiler, version 2.9.0


14 kbytes
16khz, 10bits resolution
External crystal 20mhz
Operational Amplifiers
Series
EERPOM 256kbits optional (use not included
in current firmware)

Battery technologies
Modern electronic devices are using mainly four different types of rechargeable batteries:
Lead Acid (Pb / SLA)
Nickel-cadmium (NiCd)
Nickel-metal hydride (NiMH)
Lithium Ion (Li-Ion)
Lithium Polymer (Li-Poly)
It is important to have some background information on these batteries to choose the battery and
correct charging algorithm for use.

Page 3
Lead Acid (Pb / SLA)
The lead acid batteries are used in applications where cost is more important than space and
weight. A typical example is the backup batteries for UPS and alarms. The SLA batteries are
charged using constant voltage, with a limitation of current to prevent overheating in the initial
stage of the charging process. This type of battery can be charged indefinitely, while the cell
voltage never exceeds the manufacturer's specifications (typically 2.2V).
Nickel-cadmium (NiCd)
The nickel-cadmium batteries are relatively inexpensive, can be charged completely about 1000
times. They have a very high rate of self-discharge. The NiCd is damaged by inversion, because
if the first cell is fully discharged, the battery pack is reversed. To avoid damage by discharge,
the battery pack voltage must be monitored constantly and application must be turned off when
the cell voltage drops below 1V. NiCd batteries are charged with constant current.
Nickel-metal hydride (NiMH)
The nickel-metal hydride batteries are widely used in portable applications under weight. They
have a higher energy density than NiCd. The NiMH batteries are damaged from overcharging. It
is important to have accurate readings to finish charging at the right time. Just as NiCd, NiMH is
damaged by inversion. These batteries have a self-discharge rate of about 20% per month. Just
like NiCd batteries, NiMH batteries are charged with constant current.
Lithium ion and lithium polymer (Li-Ion and Li-Poly)
The Li-Ion batteries have a very high energy/weight and energy/space ratio compared with other
types of batteries. The Li-Ion batteries are charged using constant voltage, with current limitation
to prevent overheating in the initial stage of the charging process. Charging is completed when
the current drops below the low limit current set by the manufacturer. These batteries are
damaged from overcharging and may explode when overcharged.
Safe battery charging
Modern fast chargers (e.g. those which charge in less than 3 hours, usually within 1 hour) require
accurate measurement of cell voltage, charge current and temperature to achieve full battery
without overcharging or damaging them.

Page 4
Charging Methods
The SLA, Li-Ion and Li-Po batteries are charged by constant voltage (and limited current). NiCd
and NiMH batteries are charged with constant current and have different methods of termination.
Maximum charging current
The maximum charge current depends on battery capacity . The maximum charging current is
normally given in amounts of battery capacity, for example a cell battery with a capacity
750mAh charged with a charging current of 750mA is said to be charged at 1C (once the battery
capacity). If the charging current for float charging is set to C/40, then charging current will be
the cell capacity divided by 40.
Overheating
The transfer of electrical energy into a battery is called charging. The energy is stored through a
chemical process. But not all electrical energy applied to the battery is transformed inside the
battery as chemical energy. Some of the electrical energy ends up as heat thus heating up the
battery. When the battery is fully charged every additional power applied to the battery ends up
as heat. Fast charging will cause rapid heating of the battery and will make damage if charging is
not completed. Monitoring the temperature in order to finish charging is an important factor in
designing a good battery charger.
Termination methods
Datasheets of batteries suggest termination methods to be used. The use and the environment
where the battery is used sets limitations on the choice of termination method. Sometimes it may
be impractical to monitor battery temperature and easier to measure voltage. This design
implements the use of voltage drop (dV/dt) as the primary method of termination, plus
temperature and voltage as a safeguard. Additional termination methods:
t - time
This is one of the simplest methods to measure when charging is completed. Normally used as a
termination slip in fast charging and main method during normal charging. Applies to all types of
batteries.
V - Voltage
Charging is completed when the voltage exceeds a certain limit. It is used in combination with
constant current charging. The maximum current is determined by the battery, usually 1C as was
described above. The current limitation is crucial to avoid heat damage to the battery which
occurs when the current is very high. SLA batteries are normally charged indefinitely by setting a
maximum voltage below the current charging voltage. It is a main method of algorithm and
termination.

Page 5
dV / dt - Voltage Drop
This method uses the negative derivative of the voltage in a time interval. Used usually in
constant current charge. Applies to NiCd and NiMH batteries.
I - Current
Charging is terminated when the charge current drops below the preset value. Used usually in
charge at constant voltage. Applies to SLA batteries, Li-Ion and Li-Po to finish the second phase
of charging, usually after the rapid charging phase.
T - Temperature
The absolute temperature can be used as termination (for NiCd and NiMH), but only as a backup
completion. Charging of all batteries should end if the upper limit of operating temperature
established by the manufacturer is exceeded. It is also used as a backup method to cancel
charging if the voltage drops below the safe temperature. Applies to all batteries.
dT / dt - Peak temperature
The temperature derivative at a time interval can be used as termination method during fast
charging. According to manufacturer's specifications: usually 1 degrees C/min for NiCd).
Applies to NiCd and NiMH.
DT - Temperature above ambient temperature
Charging is cancelled if the difference between the ambient temperature and the battery rises
above a preset value. Applies to NiCd and SLA as primary or backup method.
Hardware Implementation
Feeding step
The input voltage (11 to 24V) is regulated through voltage regulators 7805 and 7812. The 7805
delivers 5V to the microcontroller. The 7812 delivers 12V engine to actively cool the power
section of the charger.
Power amp
Formed by two MOSFET, one for charging and one for discharging. Design allows handling of
currents of up to 5A with a voltage range between 3 to 20v.
Inputs
Four push-buttons are used to handle the unit.

Page 6
Outputs
Buzzer for audible indications of completed operation and while using push-buttons.
LCD with backlight.
Red LED during operation.
Yellow LED to indicate completed operation.
Interface to PC
Connected to the UART interface can be connected to the PC for recording data Battery during
charging. The data are displayed in different graphs and can be exported to spreadsheets for
analysis and / or storage. The software runs on most operating systems.
EEPROM (optional)
It can serve to store the different cycles of charge / discharge of a battery without the use a PC.
Not implemented in firmware.
ISCP
Used to program the microcontroller from a PC via a compatible programmer.
Buck Converter 16khz
The buck converter consists of a P-channel MOSFET transistor driven by the PIC via one NPN
bipolar transistor. The MOSFET is connected to an inductor, a diode and a capacitor (see Figure
1). An additional diode prevents the microcontroller battery voltage when power supply is
disconnected. When the MOSFET is ON (illustrated in Figure the switch closed) current will
flow as shown in Figure 1A. Capacitor input is loaded via the inductor (which is also loaded).
When the switch is open (Figure 1B) the inductor will attempt to maintain its current flow
induction voltage. Current will flow through the diode and the inductor to the capacitor charged.
Then cycle repeats. If the duty cycle is low, briefly ON and OFF much time in the voltage will
decrease. If the duty cycle is increased (long ON and OFF bit) the voltage increase. A buck
converter is more efficient running with a useful cycle of 50%.

Page 7
Figure 1: Operating principle of a buck converter

Battery temperature
Temperature is measured by a negative coefficient resistance (NTC). You have approximately
10k resistance value at 25C. The NTC is part of a splitter voltage which is fed the reference
voltage (5V).

The resolution of the measured voltage across the NTC is:


5V / 1024 steps = 4.88mV / step.
The NTC used at 25 degrees measured 10k, replacing this value Rarriba:
Vout = (480 / (480 + 10000)) * 5000mV = 229.008mV
In ADC steps:
N = Vout / (mV / step) = 229,008 / 4.88 = 46.9
Then, 25 degrees / N steps = 0.533, use this value to determine the temperature is

Page 8
a very basic method as the NTC resistance does not follow a linear curve but for the purposes
applies practical.
Design theory
The following describes the specific design theory of the battery charger.

Calculating the inductor exits the following formula:


L = (Vinmax - Vout) * (Vout / Vinmax) * (1 / fsw) * (1 / (LIR * Ioutmax))
The LIR for a ripple of 70th p-p with a current of 1A is equal to
LIR = 0.07 / 1 = 0.07
Then L is:
L = (24 - 1.5) * (1.5 / 24) * (1/16000) * (1 / (0.07 * 5)) = 468.75 uH
To calculate the capacitor should take into account the voltage drops and ripple present in the
converter output. Big and tall riples Falls are the cause of low output capacitance. 1000uF
capacitor delivers performance compromise between size and efficiency in assembling.
Cout = 1000uF.
Cin is stable 470uF.
D the SB5100 or similar model that supports 5A current is chosen.
As P-channel MOSFET IRF9530 is used; bearing currents up to 12A constant.

Page 9
Measuring circuits
Battery voltage
The charge voltage is monitored using a voltage divider to measure the voltage difference
between the positive and negative pole of the battery. For a measurement chord in the range
Charger (3v to 20v charging voltage), the appropriate values of the resistors are chosen. When
the voltage exceeds the reference voltage (5V), the voltage is divided with two resistors to locate
the reading range (0-5v).
R1 = 18k
R2 = 56k
Vp = R1 / (R1 + R2)
Vp = 0.2432
5V / 1024 steps = 4.88mV / step.
N = 4.88 / 0.2432 = 20.07 mV / step.
This value of N gives the upper limit reading charger:
V maxbat = 20.07 * 1024 steps = 20555.56 mv = 20.5v.Charging current
The charging current is measured by sensing the voltage on a 0.1 resistor shunt. This voltage is
amplified using an operational amplifier - configured as non-inverting and inverter for charging
for measuring the discharge - to improve the accuracy of the measurement before feeding the A /
D microcontroller.
This voltage is amplified by the factor:
R1 = 3.3k
R2 = 19k
Amplification factor
Af = 1 + (R2 / R1) = 6.76
The amplifier output voltage is:
V ibat = (1 + (R2 / R1)) * I shunt = 6.76 I shunt
The maximum current that can be measured is:
I bat = 4.88 / 6.76 I shunt = 7.2257 A
This gives a resolution of:
7226 mA / 1024 steps = 7.06 mA / step

Page 10
Description of charging methods
1. Fast current charging: 1CmA (fast charging temperature: 0 C to 40 C). To achieve control and
stop the fast charge, it is recommended to charge more than 0.5CmA but less than 1CmA.
Charging with more than 1CmA can increase the internal pressure of the batteries, activate safety
ventilation and causing electrolyte leakage. When the battery temperature is detected by a
thermistor or other sensor and temperature is below 0 degrees C or above 40 degrees C, then at
the beginning of the charge process you must perform a floating charge rather than a fast charge.
Fast charging should stop when either values described below reaches the prescribed level:
Control the upper voltage limit: Approx. 1.8V / cell. This charging method is changed to
float charge if the battery voltage reaches about 1.8V / cell due to problems or malfunctions of
any nature.
Value of dV / dt (or cutting peak delta): 5 - 10 mV / cell. When the battery voltage falls
from its peak to 5 - 10 mV / cell, fast charge has to be stopped and charging method should be
changed to float charge.
Value of dT / dt (or cutting temperature): 1 to 2 C degrees / min. When an increase in
battery temperature per unit time is detected by the thermistor or other temperature sensor
during fast charge and the temperature rise is detected by the sensor, fast charging should stop
and charging method changed to floating.
Time limit: 90 minutes.
2. To charge excessively discharged batteries, first floating charge is applied to start current flow,
and then proceed with fast charging once the battery voltage rose. Initial voltage for fast
charging: approx. 0.8V / cell with a current of 0.2 0.3 CmA.
Requirements:
Initial Wait 10 minutes. This prevents detection circuits dV / dt is activated by the time
specified at the beginning of the fast charge. However, detection dT / dt can be active in this
period. This is necessary to batteries were dropped charge for a long time or were excessively
discharged, etc. The initial expectation is necessary to prevent the load stops (to prevent
malfunctions) because pseudo dV / dt.
Floating or maintenance current: 0.033 to 0.05 CmA. When the current flow is high, the
battery temperature increases, causing the characteristics of the battery deterioration.
Fast-charge time: 60 minutes.
Total time: 10-20 hours. Overcharge of a NiXX battery pack, even by float or maintenance
charge, causes deterioration in battery characteristics. To prevent overcharging by floating
charge or any other method, you must provide a timer to regulate the total charging time.

Page 11
Analysis of SLA (Sealed Lead-Acid) and Lead-Acid battery charge / discharge
Unlike Nixx batteries, such batteries are charged at fixed voltages rather than fixed current.
Charging method:
1. Check whether the battery will accept a charge.
2. If OK, start charging at constant current capacity / 10.
3. When the voltage reaches 2.55V / cell switch to constant voltage charge 2.45V / cell.
4. If the current falls below capacity / 20 then switch to float charge.
5. Float charge at 2.25V / cell indefinitely (recommended maximum 20 hours).
Requirements:
An SLA battery should not be discharged below 1.5V / cell.
Maximum SLA battery Voltage is 3V / cell.
Analysis of LiPo (lithium polymer) and LiIon batteries (lithium ion) charge / discharge
Charging method:
1. Constant current at 1C until the Voltage reaches 4.2V / cell.
2. Constant current at 4.2V / cell until the current drops to the capacity / 15.
3. Float charge at the rate of capacity / 30 for 30 minutes.
Requirements:
A LiPo battery should not be discharged below 2.5V / cell.
Maximum voltage for LiPo batteries (lithium polymer) is 4.5V / cell.

Page 12
Specifications
Maximum charging current: 0 to 5A
Maximum discharge current: 1A (I = V / R -> R = 12/10 -> I = 1.2A)
Modes: 0: NiCd, 1: NiMH, 2: SLA, 3: LiPo, 4: LiIo
Battery capacity: 3000mAh
Number of cells: (1 to 19) 6
Charge: (1 to 10) (10) -> 3000 * 1.0 = 3A
Discharge: 0 to 1A
Wait delta peak: 10 minutes
Minimum temperature at high currents (> 0.5C): 10 degrees
Low voltage cut-off (per cell):
NiCd (0-2550):
800mV
NiMH (0-2550):
1000mV
LiPo (2500-3500): 3000mV
SLA (1500-2500) : 2000mV
Delta peak (0 to 255):
NiCd:
40mV
NiMH:
20mV
Maximum voltage per cell:
NiCd:
1680mV
NiMH:
1680mV
LiPo (3500-4500):
4200mV
SLA (2000-3000):
2500mV (2.5V x 6 cells = 15V - v maximum for SLA. 12V)
Normal charging voltage per cell:
LiPo (3500-4500):
4200mV
SLA (2000-3000):
2450mV (2.45V x 6 cells = 14.7V)
Final current (% of initial charge current):
LiPo:
(3%) -> 3000 * 3/100 = 90mA
SLA:
(5%) -> 3000 * 5/100 = 150mA
Timeout
NiCd and NiMH
LiPo
SLA

65 min at 1C, 130 min at 0.5C


30 min floating
25 hours

You might also like