I designed this 3-stage Sealed Lead Acid battery charger to work with my revised servo lock controller project. It's based around an LM2596 switching regulator, and uses an LM324 quad op-amp to switch between Constant Current and Constant Voltage stages, according to the current drawn by the battery while charging. The voltage drop across the 250mΩ current sense resistor (R15) is used by a window comparator to adjust the voltage at the feedback pin of the LM2596, adjusting its output voltage.
This battery charger isn't immediately active when powered, instead it signals to the controller that it has been powered, and is then activated by the controller once it's ready to be shut down.
When 5V appears on the CHARGER_POWERED pin of the SYSTEM connector (J3), the servo controller prepares to shutdown, then sets the CHARGER_ENABLE pin high (5V).
This latches MOSFETs Q3 and Q2, enabling the LM2596, and turning on Q4, pulling the SYSTEM_OFF pin down to ground, and provides a path to ground for the two status LEDs.
The SYSTEM_OFF pin connects to the enable pin of the main voltage regulator PS1 on the servo controller PCB, which is disabled once pulled to ground.
The battery charger will remain active, and the servo controller disabled, until it has been disconnected from its 12V power supply. Once power has been removed Q4 will turn off, the SYSTEM_OFF pin will no longer be connected to ground, enabling voltage regulator PS1 and allowing the servo controller to resume operation.
The potentiometer RV1 sets the output voltage of the LM2596, and is adjusted to 7.3V while there's a 22mA load (in the form of a 330ohm resistor) connected on the battery screw terminal connector J2. This load is required to set the constant voltage charging stage, which is in effect when the battery is drawing more than 22mA.
When the battery draws less than 20mA, a threshold determined by the TFL (threshold float voltage) potentiometer, the output of op-amp U2C - the lower portion of the window comparator - turns on. This decreases the voltage at the feedback pin of the LM2596 through diode D4 and the FLV (float voltage) potentiometer. The FLV potentiometer adjusts the output of the LM2596 to the 6.8V required for float charging. The output of U2C also drives the input of U2D, which swaps the active status LED.
When a discharged battery is connected it will draw a significant current, but this needs to be limited to approximately 250mA. This current limit, or constant-current charging stage, is set by potentiometer TCC (threshold constant-current), which controls the upper portion of the window comparator. The current drawn by the battery is measured as a voltage drop across the current sense resistor R15, and fed into the non-inverting input of U2B.
U2B is a non-inverting amplifier, which scales-up the small current sense voltage so it can be used by U2A to compare against the control voltage set by the potentiometer TCC (threshold constant current). TCC provides the threshold for the constant-current charging stage, and when this threshold is exceeded the output of U2A turns on, increasing the voltage at the feedback pin of the LM2596, and lowering its output voltage until the current across R15 falls below the threshold determined by TCC.
The output state of U2D is used to slightly increase the threshold voltage at the non-inverting input of U2C via the 1Mohm resistor R9. This provides hysteresis, and prevents a return to the constant voltage charging stage once the float charging stage has been triggered. Although it's not strictly necessary, as the decrease to the float charging voltage would also cause a significant drop in current too. So there's no way the current drawn by the battery can increase above the 20mA threshold once the charging voltage has been decreased from 7.3V to 6.8V.
This battery charger design is based around a CV/CC LM2596 power supply module I purchased on eBay. This module was fine for constant current and constant voltage charging, but it made no provision for float charging, which was a feature I really needed for my application.