Fast Battery Charger using a Buck-Boost half H-Bridge Circuit

The Buck-Boost half H-Bridge circuit described elsewhere can be adapted to provide a battery charger for a number of different battery types, simply by adding an SLA battery charging algorithm to the SMPS algorithm. The half H-Bridge buck-boost converter has a blocking diode provided for free as part of the boost part of the circuit, which can prevent the battery from discharging back through the inductor to the source (although for this circuit the high-side MOSFET would prevent that from occurring if the source were to be turned off). The Schottky diode in this location may have excessive reverse leakage current, in which case a fast recovery diode can be used instead. Note however that the voltage drop and hence the power dissipation can be quite substantial across this diode at the higher output currents. A synchronous architecture is a better choice.

The Circuit

The circuit was tested with a 4AH, 6V, SLA battery, using a programmed current limit of 1.6A, a voltage limit of 7.5V and a float mode trigger current of 0.2A. This trigger current is a bit higher than recommended, however it is limited by the 8-bit resolution of the ATMega48 A/D converter and the gain of the circuit. A faster, higher resolution A/D converter and programmable gain capability would allow this to be lowered. There was a significant amount of noise on the current feedback signal, so a 47nF capacitor was placed across the 20K gain resistor R19 to reduce the noise (at the expense of delay).

Tests on the battery showed that the current limited at about the right value. The voltage limited at 7.48V. The float mode was triggered when the current dropped to 0.133A and the voltage then stabilised at 6.88V, which are all close to the values programmed.

The circuit was completed with a switch to select one of four battery capacity values 1AH, 4AH, 6AH and 9AH, although these can be changed in the firmware. Note that a battery can be safely charged if its capacity is greater than that set in the program. A push button switch was added to cause the program to start charging. Six LEDs provide state indication - "Charging Stage", "6V battery", "12V battery", "Bulk mode", "Absorption Mode", "Float Mode": the latter indicating the end of fast charging.

The circuit was designed for a 12V input supply, but could be made to work at higher or lower voltages. A lower limit of about 7V would allow the 5V digital supply to be maintained. The voltage divider ratio would need to be changed for the output voltage feedback to avoid overloading the operational amplifier.

The Firmware

The program begins in the standby stage (0) by flashing the charging stage LED and attempting to determine the nominal terminal voltage of the battery. For SLA cells this will be 6V or 12V. If no battery is detected the voltage indicator LEDs are flashed and the program will not proceed any further. When the battery is detected and the pushbutton is pressed, the program moves to the charging stage. In this stage the current and voltage are limited in the bulk and absorption mode values until the current is detected to have fallen to the trigger value, at which the voltage limit is reduced to the float value. The float LED is turned on. The nature of the variations in the voltage and current during charging means that the program is unable to determine whether the charge mode is bulk or absorption, and so the LEDs allocated to indicating this are not particularly useful. In practice the bulk mode LED will flicker in the early stages of bulk mode charging, while the absorption mode LED will flicker increasingly as charging progresses.

During operation the program can detect the disconnection of a battery by monitoring the output voltage and current. The SMPS algorithm is modified to ensure that the boost part of the circuit is not turned off completely. In this way when the battery is disconnected, the output voltage will rise to a value much higher than the highest voltage that would occur if a battery were connected. This allows the program to detect when the battery is removed. If the current also drops to zero the charger will turn off the supply and revert to the standby stage.

The firmware was compiled using the old cdk4avr package, which still exists on SourceForge and produces reasonably compact code (although not needed in this case). It can also be compiled with recent gcc-avr, binutils-avr and avr-libc from various popular distributions.

Protection Circuit

If the battery polarity is reversed, the half H-Bridge circuit as given will discharge it at very high current through the two forward biassed diodes and the current sense resistor. This is a major disadvantage for this circuit. A fuse must be provided at the output of the circuit. Note that using a synchronous circuit will not necessarily solve the problem as the MOSFETs replacing the diodes have an internal parasitic body diode which will conduct in the presence of a reverse polarity battery. It is possible to use a logic level MOSFET operating in reverse mode, so that the body diode will block current from a reverse polarity battery. The MOSFET can be kept switched off until the microcontroller determines that the battery is correctly inserted (seethis thread). The MOSFET gate should be pulled down to ground through a resistor to ensure that the MOSFET is off when the microcontroller is in a reset state. The following circuit shows modifications to the SMPS circuit to achieve this:

The MOSFET gate is pulled down with a 10K resistor as suggested above to ensure it is turned off during reset of the microcontroller. A diode is added across R10 in the voltage divider to force the voltage feedback to zero if the battery is reversed. A 100Ω resistor is placed across the MOSFET to allow the output voltage to settle rapidly when the battery is disconnected. This will cause current to flow if the battery is reversed, and can be increased at the expense of settling time for the circuit, if this current causes a problem.

Control Algorithms

The control of the circuit used for charging batteries presents some challenges. Once the output exceeds the battery terminal voltage the current increases strongly due to the very low internal impedence of the battery. Thus the current must be controlled tightly and rapidly to avoid possible damage to the battery, particularly on startup. The battery also presents dynamic behaviour with characteristic frequencies in the region of a few hundred Hz. As data is not available from manufacturers, each battery will need to be measured for small signal behaviour in order to enable the design to be carried out accurately.

The fact that there are two independent PWM controls in action complicates the control problem. It is simpler if we can fix the PWM setting on one of them and control the other independently. We have discussed already the different regions in which the controls are active, notably the region where the input is well above the desired output (needing only the buck part), well below it (needing only the boost part), or in the intermediate region.

In this architecture the boost converter has direct access to the output voltage. In addition the configuration of components in the boost converter means that measurement of inductor current, necessary for rapid control of current limiting, is easily obtained from a sense resistor and amplifier. If we choose not to control the buck converter, then the whole problem is simplified. Using the measured input and output voltages, the buck converter can be set with a fixed duty cycle to bring the input voltage down to a value just below the output voltage, so that the boost converter can lift it slightly to the desired value. This can be found using the ideal relationship between duty cycle and input and output voltages for the buck converter. Non-idealities (losses) in the circuit will result in a slightly lower output voltage which can be dealt with by the boost converter

In the region where only buck conversion is needed, this approach will introduce some additional losses since the boost converter will be active. This is the price paid for a simpler circuit. The boost converter will be required to handle transient changes in the buck converter operation, such as in the startup phase, so this needs to be investigated.

To Be Done


  1. "An MCU-Based Low Cost Non-Inverting Buck-Boost Converter for Battery Chargers" STMicroelectronics AN2389 August 2007.

First created 3 October 2010

Last Modified 16 October 2015
Ken Sarkies 2010