# LM339 Lipo Battery Voltage Tester Circuit - How does it work?

After reviewing the eevblog video on OpAmps and various other videos on the LM339, as well as copying a circuit which works, I am still genuinely confused on the math / logic behind this, which makes it hard to move on to more complicated and customized circuits.

To the best of my understanding, a circuit like this comparing voltages from two sets of voltage dividers should result the same even if the input voltage changes, because the difference between the two remains the same.

Here is the circuit in question:

simulate this circuit – Schematic created using CircuitLab

Note: This circuit was copied from this instructables article I actually changed some of the resistor values in real life just to see if it would change the voltage range in which the LEDs would light up, and it did.

Since the V1 voltage source, which in practice is a Lipo battery, can be anywhere from 3.2v - 4.2v, I tested it in the CircuitLab simulator. According to the simulator, there should be voltage on all LEDs all the time, which makes sense to me since VCC is changing for both sets of voltage dividers, so the difference should remain the same, thus LEDs will either be on all the time, or all off when the voltage is too low.

In real life (and in the article) however, it doesn't work that way! The LEDs ACTUALLY light up at different voltage levels depending on what voltage is input at V1!

How is this possible?

Ideally, I would like to be able to do the math myself to figure out what resistors I need for what desired outcomes.

Thank you for any input!