Multi-Chemistry Battery Charger
By Don Carveth, Botgoodies, Feb. 2005 firstname.lastname@example.org www.botgoodies.com
Rev. 0 Mar. 2005 – Initial release
My latest project has been the development of a multi-chemistry battery charger. The charger, in its current incarnation, can charge Nicad, NiMH, LiIon (or LiPoly), sealed lead acid and rechargeable alkaline batteries. The charger has two channels and can charge two different types of batteries at a time at up to 2 amps each. Channel A can alternatively be used as a discharger. A 2 x16 LCD display with a 5 key keypad allows one to set all necessary parameters and displays charging/discharging values including mAH when complete. As a bonus, a fixed voltage, current limited output, a fixed current, voltage limited output and a variable PWM output are provided. An ATMEGA32 microcontroller running at 16 MHz provides the brains.
I have developed the charger as a commercial product so I am unable to release the code here, but I can discuss many of the design principles and my experiences with various battery types. If you are interested in custom charger design please contact me at email@example.com.
The charger began life as my Lithium Battery Charger as described in my previous article, which in turn began life as an Atmel application note. Features were slowly added until it now incorporates all of the items described above. I have also completed several hundred charge/discharge cycles to test all of the different battery chemistries which has given me a new appreciation of some of the complexities involved. The ATMEGA8 grew to a 16 and finally to a 32. I run it at 16MHz which allows me to generate two 10 bit 16 kHz PWM signals that are heart of the charging system.
The charging circuit is shown above. This is essentially the same as my original LiIon charging circuit with a few refinements. I have tested it up to 2 amps but it could likely do more. The heat sinks never get hot but help the MOSFETs survive short circuit conditions. The inductor / capacitor pair are optimized for a 16 kHz pulse width modulated (PWM) signal and provide a smooth DC output. The voltage input needs to be accurate, at least 1%. The raw signal is compensated in software for the drop across the current measurement resistor and lead wires. The PWM signal uses the Fast 10 bit PWM mode. I found that at low duty cycle signals the current bounce was too great using 8 or 9 bit modes. The thermistor is linearized in software to provide a degrees F output. Separate power and analog grounds are essential and keep the current and voltage sensing devices as far from the charging MOSFETs as possible. Shielding of the current circuit may be required. Reversing the battery creates effectively a short circuit that returns through D11.The dual channel charger has 2 of these circuits.
Here is the discharger circuit. This circuit allows a specific discharge rate, as a function of C, to be set using the keyboard. The battery discharges until a predetermined low voltage is reached. It then shuts off and reports mAH and minutes.
I tried to utilize the existing charger circuit which uses most of the same components but settled for a completely separate circuit. I have figured out now how to do this with a single battery jack and common bidirectional current sensor and voltage sensor but haven't implemented the change yet. The PWM-A signal is the same signal that feeds charger channel A. The microcontroller automatically detects if a battery is connected to the discharger and, if so, goes into discharger mode. Since a battery is only ever connected to either the charger or the discharger circuit it is OK for the unused side to be fed the PWM signal. With the single jack method this is not the case and a digital switch is required to direct the PWM signal. The MAX4173 high side current sensor can measure at voltage levels down to 0 volts so the charger can be used with single cell batteries, however the maximum discharge rates at low voltage drops due to the 5 ohm load resistance. The MOSFET runs cool even at max discharge rates and does not need a heat sink.
The heart of the charger is the Atmel ATMEGA32 microcontroller. The microcontroller controls the LCD readout, the keypad, reads all analog values and provides the PWM signals. It executes all of the various charge algorithms. It also provides a serial output that is useful for troubleshooting and monitoring battery characteristics and has a status LED for each channel.
A 4.096 volt analog reference is provided to ensure the required voltage measurement accuracy, required primarily by LiIon batteries. A 16 MHz external crystal is used. My original version used the built in 8 MHz oscillator but I decided I needed the finer control of a 10 bit PWM mode which could only be achieved by increasing the speed. The 2 line x 16 character LCD display is a standard interface operated in 4 bit mode. An LCD backlight is powered via the 1 ohm resistor. The 5 key keypad, with x1 step and x10 step shift keys (normal is x100), is used to enter configuration parameters. The 5 keys are arranged in a diamond shape with the "Charge" key in the center.
The charger auto detects batteries on any channel and charges the detected battery based on the parameters entered via the LCD / keyboard. Entered parameters are saved in EEPROM. It also autodetects the presence of a thermistor.
A 1/2 amp 5V regulator such as a 7805M is required to power the microcontroller section.
The software was written using WinAVR GCC 3.3.
Each type of battery has its own unique characteristics. I have gone through numerous charge discharge cycles testing with many types of batteries and tweaked the charger as I went. An excellent overview of rechargeable batteries is at http://www.buchmann.ca/default.asp.
Nickel Metal Halide - NiMH
NiMH batteries have become the new workhorse of the rechargeable battery stable. The capacity has been increasing steadily - 2500 mAH AA batteries are now available. They survive many charge discharge cycles (500 is often quoted) and the price is becoming reasonable. They can be charged in a hour and some new chargers are claiming 15 minute charge times.
These were perhaps the most challenging batteries to charge. Each different battery size, manufacturer and state of charge would alter the charge termination requirement. Termination detection became a trade-off between surety of charger shutdown and nuisance trips. The batteries heat up quickly once they have reached the voltage peak full charge point and additional high rate charging in this condition can damage the battery, and, in my experience, reduces the charge available, requiring a reconditioning run (see below). At high charge rates the voltage tends to bounce around a bit, sometimes causing nuisance trips. The charger now utilizes several different methods of termination detection, all active:
dTdt - rate of temperature rise exceeding 3 deg. F per minute. This the most reliable method. I recommend using a 10K nominal thermistor strapped to the battery pack.
dVdt - negative slope over 6 minute period
Hockey stick - looks for a rapid voltage rise followed by a negative slope. This can detect the peak sooner than the dVdt calculation, but sometimes misses.
High voltage - set at 1.68 volts per cell
Timeout - 65 minutes at 1C, 130 minutes at 0.5C, etc.
The batteries are charged at constant current until a termination condition is encountered. They can be charged at between 0.3 and 1 C. Poorly performing batteries can be reconditioned by going through a couple slow charge (0.3C) / slow discharge (0.3C) cycles. Charging slightly depleted batteries is challenging and should be avoided as the risk of overcharge is higher unless temperature detection is used.
The most I have every been able to get out of a 2300 mAH battery is about 1850 mAH. This is pretty typical for all batteries which typically provide between 60 and 85 of rated capacity. Note that much of the capacity exists between 1.0 and 0.9 volts. I would consider these to be 0.9 volt batteries if you hope to get most of the available charge, although other NiMH batteries I tested had little capacity below 1.0 volts.
The curves below were generated using the serial output from the charger which outputs a line of information every minute.
Nickel Cadmium (Nicad)
Nicad batteries are the previous workhorse. Although being superseded by NiMH chemistry, Nicads still have their place. Their primary advantages are low internal resistance, resulting in higher instantaneous capacity, and price. They are still the battery of choice for power tools and other applications that draw heavily for short bursts.
Nicads are charged using the same principals as NiMH but are more tolerant. They can handle charging well beyond the voltage peak without damage and the charge curves are more predictable. Charging is based on constant current up to 1C and uses the same termination methods as NiMH, except for the hockey stick method, with slightly different parameters .
Lithium Ion (LiIon) or Lithium Polymer (LiPo)
From a charging perspective these two battery types are equivalent. LiPo are a new variant and provide the advantage of higher energy densities, and, more important for robotics, much higher continuous discharge rates. I'll refer to both types as LiIon from this point forward. LiIon batteries have the most capacity by volume and weight of all the rechargeable battery types. For this reason they have taken over the portable equipment market. They also have the advantage of having a minimum of 3.0 volts per cell compared to 1.0 volts for NiMH. LiPo batteries are taking over in the RC car and airplane segments. If discharged below 2.5 volts per cell irreversible damage can occur so most devices using these batteries have monitoring for low voltage, and excess current built in. Battery packs are often equipped with a thermistor for high temperature detection, another protective mechanism. Laptop batteries typically have sophisticated on board intelligence that includes battery pack protection and communication with the host, telling the battery characteristics to the host. The can ignite and even explode if overcharged - that is why the protection is necessary.
LiIon is charged in several stages:
1. Constant current up to 1C until voltage reaches 4.2 volts per cell (some older cells were 4.1)
2. Constant voltage at 4.2 volts per cell until current drops off to capacity /15
3. Trickle charge at capacity / 30 for 30 minutes
LiIon cells are very predictable and all cells follow these rules. Voltage accuracy of at least 1% is required. The raw voltage measurement is adjusted to account for the loss in the current sensing resistor and the battery lead wires. My previous article discusses many of the properties of LiIon batteries.
Sealed Lead Acid (SLA)
SLA batteries are a slight variant of the age old lead acid automobile battery. Their niche these days is in applications that require more power than can be provided cost effectively by other chemistries like electric wheelchairs, scooters and combat robots. Batteries larger than about 6 AH @ 12 volts are only generally available in SLA. They can supply high instantaneous currents and are ideal for motor drive apps. They have the lowest energy density of the rechargeable chemistries resulting in larger, heavier batteries for the same capacity and require a periodic maintenance charge or irreversible damage results.
Charging SLA batteries, like LiIon, proceeds through several stages:
1. Pretest to see if battery will take a charge
2. If OK, charge at constant current at capacity / 10
3. When volts/cell = 2.55V switches to constant voltage charging at 2.45V * number of cells
4. If current drops below capacity/20 then charging switch to trickle
5. Trickle charge at 2.25V per cell indefinitely
Rechargeable Alkaline (RA)
RA batteries are another niche product. They are intended to be direct replacements for single use alkaline cells but can be recharged, typically up to 100 times. They work well when lightly loaded and the number of cycles is very much a function of this load. AA cells are nominally about 2000 mAH (tests - about 1250 mAH) when new but this drops with use. They are cost effective when compared to single use cells and come ready to use out of the package. Here are a couple websites with useful information on RA batteries: http://www.pureenergybattery.com/press/xloemguide.pdf and http://rexlabs.dnsalias.net/chemproject/Alkalinemanganese.htm
RA batteries require a pulse charging method that is quite different from the other methods. A 50% duty cycle 20 ms pulse at 0.3C is applied. When the battery reaches 1.65 volts per cell as measured with no current pulses are disabled. This results in a slowly decreasing pulse frequency which can be applied indefinitely. An option for charging PureEnergy XL type batteries with a 1.75 volt per cell limit is also included.
The PureEnergy documents discuss issues with charging more than 2 batteries in series. They recommend installing reverse polarity diodes and an equalizing circuit. This will make the circuitry for charging series cells more challenging. The discharge profile starts at about 1.6 volts and useful capacity ends at about 0.9 volts. To get maximum battery capacity I would call these 0.9 volts batteries. I discharged a new AA cell at 450 mA and it provided about 600 mAH. After recharging using my charger, I discharged at 10 mA - this resulted in 1150 mAH. The literature indicates that the batteries have much more capacity at lower loads. I have found that a new AA battery at 150 mA will provide about 1200 mAH, then reduce to 600 mAH after a few charges.
If you have any questions about the article, please contact the author at firstname.lastname@example.org.