For proper charging of lead-acid batteries a good technique is to start with a constant-current until the battery reaches a specific voltage, indicating it is near a full charge (≈90%), and then revert to a constant-voltage trickle charge mode at a lower voltage to avoid over-charge while topping off and then maintaining the battery charge.
Below is a variation on the familiar LM317 charger circuit to do that for small lead-acid batteries (up to about 1.2A charge current or 12Ah rating).
The LM317 initially operates in a constant-current mode until the maximum charge voltage is reached, as determined by the U2 pot setting.
A TL431 reference (U1) is used as a precision comparator to detect this voltage, at which point it turns on and latches by turning on Q1 and Q2.
Q2 then converts the LM317 into a constant voltage charger, with voltage determined by U4's setting.
Upon power-up the circuit starts with Q1 and Q1 off.
This puts the LM317 into a constant-current mode with current equal to 1.25V/Rcc.
When the voltage at the junction of pot U2 and R3 reaches 2.5V [corresponding to a battery voltage V(Out) of 14.4V for the shown pot setting] the TL431 starts to turn on and its cathode voltage drops.
This turns on Q1 and the positive feedback from its collector through D3 further turns on the TL431, resulting in a latched condition.
This also turns on Q2, which grounds the pot U4 with a few tens of millivolts of saturation voltage.
This changes the LM317 into a constant voltage output mode, nominally set by U4 to a trickle charge voltage of 13.6V.
This also turns on M1 to short out R_CC so it doesn't degrade the trickle-charge voltage.
The charge voltage trip point and trickle charge voltages are typical values for a 12.6V lead acid battery.
These can be independently adjusted as needed for a particular battery or charging conditions.
The desired charging current, equal to 1.25V / R_CC, is determined by the battery capacity.
Typically, for good battery life, you want to charge no faster than the 10-hour rate for its ampere-hour capacity, i.e. a 6Ah battery should be charged at no more than 0.6A, giving a R_CC value of 2Ω.
The charging values to use are further discussed here.
The LTspice simulation shows a constant battery charge current, I(V_bat), of ≈1.05A, as set by a R_CC value of 1.2Ω, until a V(Out) of 14.45V is reached, at which point the circuit latches into the trickle-charge mode with the output voltage dropping to ≈13.6V.
LED D5 indicates the circuit is powered and LED D1 indicates it's in the trickle charge mode.
To reset it back to the charge mode from the trickle mode you can either remove power or press reset switch S1.
The input voltage should be ≥17.5V (Vin at least 3V greater than the maximum Vout) to allow enough voltage headroom for the LM317 to provide full charge current up to the maximum battery voltage.
Except for low maximum charge current, the LM317 will need to be on a heatsink since it will dissipate [V(in)-V(out)] * I(out) watts.
LM317 CC/CV 12V Lead-Acid Battery Charger With Automatic Trickle Charge
Lead-acid battery charger starts with constant-current and ends with constant-voltage trickle charge