For battery charging, the highly efficient step-down (buck) configuration is usually the topology of choice. But a different approach is required if special conditions prevail: if the supply voltage is less than the battery voltage, or (worse) if the supply voltage ranges above and below the battery voltage. The charger might need to accommodate one of several voltage sources, depending on to which is active, and it might need to charge batteries with different cell counts. All of these requirements can be met with the Figure 1 circuit, which charges 1 to 15 cells from an input of 4V to 15V.
Figure 1. This versatile battery charger is built around the controller IC, which is forced to produce an average current at an amplitude regulated by the op amp.
The topology shown is the single-ended, primary-inductance converter (SEPIC), which is notable for its step-up/step-down capability. The controller (IC1) usually regulates an output voltage, but in this case the resistive dividers at pin 3 keep the feedback unsatisfied, causing the system to produce current pulses at a level determined by its current-limit circuitry. To regulate charging current, the op amp adjusts Q1's current limit by comparing the R2 voltage (proportional to charging current) with a voltage derived from the reference in IC1. S1 and S2 let you set the charging-current level.
The maximum Q1 current set by R1 (4A) is within the capability of L1, but it allows some saturation and heating. If this peak inductor current is insufficient, IOUT will fall gracefully short of the desired maximum value (1A). If VIN is high and VOUT is low, you can obtain more charging current by changing resistor values at the op amp's inverting input. Otherwise, higher current requires that you set a higher peak current by lowering R1. In that case, L1, L2, C1, and C2 must be larger to withstand the higher currents.
To limit the voltage stresses on Q1, C1, C2, and D1, the resistor values connected at pin 3 of IC1 set a maximum output voltage of 28V across the battery. You can extend this voltage by adjusting the resistors, but note that Q1 and D1 must withstand slightly more than VIN + VOUT, and the coupling capacitor (C1) must withstand VIN. The full charging current flows through C1, so be sure that any substitutes can handle the required voltage and the ripple current. C1 and C2 are nonpolarized ceramic capacitors, but maintain the polarities shown if you substitute polarized capacitors.
As shown, the maximum VIN is about 15V. This value can be higher if you limit the supply voltage applied to IC1 (pin 2). Either add a linear regulator for this purpose, or replace the MAX770 with a MAX773, which takes its power from a built-in shunt regulator. Note that any coupling between L1 and L2 will assume the polarities shown by the dots, but circuit operation does not depend on such coupling.