Op-amp battery charge indicator

I followed this tutorial:

But Im using a 3.7V battery that im measuring which the meter clocked at 3.17V. Im using 2 of those same batteries in series (7.4V) as the source that goes into the 7805 regulator.

But when I connect the 3.7V battery (3.17V charged), all 4 LEDs light up instead of just the 1st one which should according to the math.

I uploaded the circuit but i think it'll be quite hard to follow:

This is what the diagram should be:

The red lead of the 7.4v battery disappears under blue wires and does not appear to be connected.

Diagram looks ok, so it must be your wiring, assuming the resistors have the right values.

When it all works, use a single 5-resistor divider string instead of four 2-resistor dividers.

Resting voltage of a LiPo is fairly linear with charge, so use these values.

Ground | 3k3 | 200 | 200 | 200 | 1k1 | 5volt.

The four resistor taps go to the four negative opamp inputs.
The four positive opamp inputs go to the battery to measure.

<3.3volt = all LEDs off.
3.3-3.5 = Led1
3.5-3.7 = LED1+2
3.7-3.9 = LED1+2+3

3.9volt = all LEDs on


I color coded the image with the diagram like so in order to make it a bit clearer. The description goes like this:

  1. Regulated 5V goes out purple (bottom rail) and turns orange to feed the resistors in the divider.
  2. opamp 4 has green wires both Inv & Out.
  3. opamp 3 has yellow wires both Inv & Out.
  4. opamp 2 has blue wires both Inv & Out.
  5. opamp 1 has blue wires both Inv & Out.
  6. All opamps non inverting pins are wired red towards the measured battery (I had this wrong in my first)
  7. All Grounds are connected and wired black

and here is the new picture. Im getting both red lights which signal 3.54-3.86 which would seem fine:

1/ After wiring correctly all worls? Fine.

2/ A 5-resistor chain is a neater method.

3/ Remember all resistors have tolerances, so the switchpoints won't be any more accurate than these.

4/ This is an arduino forum - using an a/d input and comparing the values in sw is a viable option



I make the voltage thresholds 3.51, 3.86, 4.00 and 4.09V, assuming the regulator is 5.00V and the resistors are accurate. You can measure the voltages for each divider with a multimeter to confirm these values.

Using 5 Resistors.
Edit as you wish..

Tom.. :slight_smile:

Well, Tom - for one thing the LEDs wil go out one by one as the voltage rises - you've got the + and - opamp inputs swapped.

But they won't even do that - because the LM324 is only rated with inputs up to Vcc- 1.5 volts, so with a 5v supply this won't work with inputs above 3.5v - most of the cell's working range.

I don't know what will happen


Amended generic.. Its Midnight here, I need sleep but got hayfever. Damn tablets aren't working.

Tom... :slight_smile:

OP's schematic shows LM324 VCC connected to 7.4v supply, not 5v.

BTW I'd personally use a comparator (which is designed for comparing voltages) like the LM339 quad comparator. Some opamps don't tolerate large voltage differences between their inputs, since they are designed for negative feedback which keeps them at the same voltage.

Most comparators have open-collector outputs, so you'd have to change to driving the LEDs to the positive rail and reverse the sense of the inputs.

In fast circuits opamps make poor comparators as they take a while to recover from saturation, not that that's an issue here(!)

Consider the LM3914 bar graph driver chip. Does all that for you.

Thanks for the comparator/LM3914 suggestions. Ill try that when those parts arrive (just bought them). But in the meantime Im working with this. Like this and modeled it on iCircuit:

The voltages in iCircuit are:

4.63V (930Ω-1.93kΩ)
3.90V (1.93kΩ-1.93kΩ)
3.17V (1.93kΩ-3.82kΩ)
1.73V (3.82kΩ-4.59kΩ)

Screen Shot 2017-10-11 at 5.35.30 PM.png

I just want to make sure my connections are correct.

Please assume I figure out a way to route the wires. I havent routed them, I know. Im just thinking about the pin connections at the moment. Ill use hookwire for now.

Screen Shot 2017-10-11 at 5.35.30 PM.png