For sensing the terminal voltage levels of the battery series, LM339 IC is used. LM339 from Texas Instruments is a single supply quad comparator which has four channels to detect the magnitude of Analog voltages and indicate the voltage level by lighting up to 4 LEDs. So, the IC is designed to indicate four voltage levels respective to a common voltage reference. For voltage indication LEDs can be connected to the IC.
This circuit designed to measure up to 4V supply from li-ion battery, and most suitable for 3.7V 800mAH battery. Use Reverse voltage protection diode with lithium ion battery if you are implementing this circuit in sensitive applications.
Construction and working
The Functioning of this circuit is based on the comparator. A comparator compare two input signal and gives the output indicating which one is larger. If inverting pin of LM339 IC is higher than non-inverting than output is low otherwise it is high. This concept of comparator can be used in sensing the desired voltage level. When Li-ion battery is connected to the R3 resistor and LM339 IC.
The voltage at inverting pin (4th,6th,8th and 10th pin) of all the comparators are same and will vary as per the change in battery voltage. The resistor R1 and R2 makes a resistor divider network which always provides 1/3rd of the battery voltage to the inverting pin of the comparator. When inverting input of the comparator is at high voltage than the non-inverting pin then the output voltage of comparator is low otherwise it is high. This make cathode of the output LED at low voltage and the anode of LED is already at positive of the battery. This will turn on the LED which will indicate the voltage level of the battery in other case, the LED will be in off state. Use the LED colors as you want to indicate in the particular level.