# Voltage comparator - how to get a stable voltage reference from a battery

I'm trying to build a circuit which will be used to monitor the voltage of Li-ion battery. The voltage comparator I'm using is LM393.

Since the whole circuit will be powered by, it the battery will be drained and would not stayed at the constant voltage. The battery stays at 4.2 V when it is fully charged. I want to put the reference voltage at 3.7 V and the actual voltage of the battery at V(in).

I tried to put a voltage divider at the reference voltage but cannot find the resistor values which will satisfy this case.

How do I build the circuit so that the ever changing voltage of the battery gives a stable constant value at the reference node?

• I think someone will write a good answer to this question. While you are waiting for that answer, you may wish to type the term "voltage reference" into a search engine. Commented Aug 14, 2020 at 8:20

Here's a circuit I did for a similar question you raised yesterday. It uses a very low-power voltage reference such as the MAX6006 (it consumes less than 1 μA) or the LT1389 which is also sub μA consumption. Because they are shunt references they will work down to quite low battery voltages.

For instance, with 0.5 μA flowing to feed the reference, R3 drops 1.025 volts hence the battery voltage can fall to 2.275 volts before the reference voltage starts to fail in stability and accuracy.

The op-amp is also very low power (less than 0.5 μA current consumption for the LPV521) and therefore is good for monitoring a battery especially as the input bias currents are around 40 fA typically (that's not a lot).: -

If the battery voltage is ramped from 1 volt to 4 volts, you can see the points where the comparator switches: -

As the battery voltage rises, the output triggers on at 3.79 volts and, as the battery voltage falls, the output switches to 0 volts at 3.64 volts. The points are not the same due to a small amount of hysteresis in the circuit caused by R5 and R4.

• The threshold calculations are not quite clear to me... When the output is high, the voltage on the 100k is about Vbat * 100k / 105k, and so the voltage on V+ is Vbat * 305/315. This is equal to 1.25V when the battery is at 1.3V, not 3.7V... Did I miss something? Commented Aug 14, 2020 at 8:45
• You must have missed something. The plot I showed in my answer is a proper simulation and it works. R2 is 3.3 Mohms in case you misread it. Commented Aug 14, 2020 at 8:49
• yes, that's the point... 3300k is 3.3M, not 3.3k... Thank you Commented Aug 14, 2020 at 8:54

You can use a voltage reference (e.g. MCP1501) for a precise reference; for instance:

simulate this circuit – Schematic created using CircuitLab

In this case the LM will output a 1 when the voltage on the battery drops below 1.2V * (27k+13k) / 13k = 3.69V

If you need a less precise way of measuring, you can use a zener or even a diode (even less precise)

simulate this circuit

In this case the LM will output a 1 when the voltage on the battery drops below 2.4V * (27k+51k) / 51k = 3.67V

simulate this circuit

In this case the LM will output a 1 when the voltage on the battery drops below 0.6V * (27k+51k) / 5.1k = 3.77V

Please consider that especially this last circuit is quite imprecise (the 0.6V threshold changes quite a lot). For this reason, you'd better measure to find out the actual voltage detected by the LM

You need a voltage reference or a LDO regulator. In the simplest (and not very precise) case, this can be a zener diode with a resistor.

Potential divider will do exactly that divide voltage supplied to it based on a ratio. You need a zener diode with an appropriate resistor. This way Zener voltage stays constant even when the battery voltage drops. Of course, within the limit at some point, your battery might drop below Zener voltage and your reference will not be valid anymore. Alternatively, just get a voltage reference chip.

A zener diode is probably the easiest, at the expense of what could be a significant amount of current running through it. If your circuit can be modified to use a different reference, a bandgap voltage reference uses less power but 3.7V options aren’t available.