# Op-amp battery charge indicator

**URL:** <https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893>\
**Category:** General Electronics\
**Created:** [October 4, 2017, 12:56am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893 "2017-10-04T00:56:22Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marciokoko](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/marciokoko/32/220446_2.png) [@Marciokoko](https://forum.arduino.cc/u/Marciokoko)\
**Post date:** [October 4, 2017, 12:56am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/1 "2017-10-04T00:56:22Z")

</div>

I followed this tutorial:

[![]( " - YouTube") ](https://www.youtube.com/watch?v=xGrbq0IoK4k)

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:

 ![IMG_4193.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/a/f/e/afef704c0ca377caa992155ab3ee6a49f4299e84.jpeg)

This is what the diagram should be:

 ![Screen Shot 2017-10-03 at 6.59.46 PM.png](https://europe1.discourse-cdn.com/arduino/original/4X/7/f/7/7f7687c648632469793d91341f2eca9fdf4f8355.png)

 ![IMG_4193.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/a/f/e/afef704c0ca377caa992155ab3ee6a49f4299e84.jpeg)

 ![Screen Shot 2017-10-03 at 6.59.46 PM.png](https://europe1.discourse-cdn.com/arduino/original/4X/7/f/7/7f7687c648632469793d91341f2eca9fdf4f8355.png)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 4, 2017, 1:25am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/2 "2017-10-04T01:25:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [October 4, 2017, 1:55am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/3 "2017-10-04T01:55:11Z")

</div>

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.  
Then:

\<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

Leo..

---

<div class="post-metadata">

**Author:** ![Marciokoko](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/marciokoko/32/220446_2.png) [@Marciokoko](https://forum.arduino.cc/u/Marciokoko)\
**Post date:** [October 4, 2017, 2:06am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/4 "2017-10-04T02:06:14Z")

</div>

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

 ![opampCOLORED.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/0/e/4/0e4a5ad69eb37bcc05013c3370a0e0c76b0e3643.jpeg)

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:

 ![IMG_4209.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/2/5/7/257d0d593f704efa3b5b1d049611eba9fcc5c8d7.jpeg)

 ![opampCOLORED.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/0/e/4/0e4a5ad69eb37bcc05013c3370a0e0c76b0e3643.jpeg)

 ![IMG_4209.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/2/5/7/257d0d593f704efa3b5b1d049611eba9fcc5c8d7.jpeg)

---

<div class="post-metadata">

**Author:** ![allanhurst](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@allanhurst](https://forum.arduino.cc/u/allanhurst)\
**Post date:** [October 4, 2017, 9:44am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/5 "2017-10-04T09:44:23Z")

</div>

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

regards

Allan

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [October 4, 2017, 10:00am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/6 "2017-10-04T10:00:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![TomGeorge](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tomgeorge/32/215261_2.png) [@TomGeorge](https://forum.arduino.cc/u/TomGeorge)\
**Post date:** [October 4, 2017, 11:36am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/7 "2017-10-04T11:36:32Z")

</div>

Hi,  
Using 5 Resistors.  
Edit as you wish..

 ![BatteryMon.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/5/e/7/5e73a26d79ba4880cec70a3c992701d71699aa4a.jpeg)

Tom.. 🙂

 ![BatteryMon.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/5/e/7/5e73a26d79ba4880cec70a3c992701d71699aa4a.jpeg)

---

<div class="post-metadata">

**Author:** ![allanhurst](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@allanhurst](https://forum.arduino.cc/u/allanhurst)\
**Post date:** [October 4, 2017, 12:48pm UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/8 "2017-10-04T12:48:26Z")

</div>

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

Allan

---

<div class="post-metadata">

**Author:** ![TomGeorge](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/tomgeorge/32/215261_2.png) [@TomGeorge](https://forum.arduino.cc/u/TomGeorge)\
**Post date:** [October 4, 2017, 1:10pm UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/9 "2017-10-04T13:10:30Z")

</div>

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

 ![BatteryMon.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/e/9/3/e93b6dfd0647d38c4ee9569f5ebc26abbb82127f.jpeg)

Tom... 🙂

 ![BatteryMon.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/e/9/3/e93b6dfd0647d38c4ee9569f5ebc26abbb82127f.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [October 4, 2017, 1:21pm UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/10 "2017-10-04T13:21:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [October 4, 2017, 5:16pm UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/11 "2017-10-04T17:16:53Z")

</div>

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(!)

---

<div class="post-metadata">

**Author:** ![anon94801460](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@anon94801460](https://forum.arduino.cc/u/anon94801460)\
**Post date:** [October 4, 2017, 5:39pm UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/12 "2017-10-04T17:39:12Z")

</div>

Consider the [LM3914 bar graph driver chip](http://www.ti.com/lit/ds/symlink/lm3914.pdf). Does all that for you.

---

<div class="post-metadata">

**Author:** ![Marciokoko](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/marciokoko/32/220446_2.png) [@Marciokoko](https://forum.arduino.cc/u/Marciokoko)\
**Post date:** [October 10, 2017, 2:55am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/13 "2017-10-10T02:55:16Z")

</div>

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:

 ![Screen Shot 2017-10-11 at 5.35.17 PM.png](https://europe1.discourse-cdn.com/arduino/original/4X/c/3/6/c36ff5de398ce7a78d0ca6a7c216171282865685.png)

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](https://europe1.discourse-cdn.com/arduino/original/4X/a/9/c/a9c3b2867088d33a207c46aefe317f8baa693cc4.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.17 PM.png](https://europe1.discourse-cdn.com/arduino/original/4X/c/3/6/c36ff5de398ce7a78d0ca6a7c216171282865685.png)

![Screen Shot 2017-10-11 at 5.35.30 PM.png](https://europe1.discourse-cdn.com/arduino/original/4X/a/9/c/a9c3b2867088d33a207c46aefe317f8baa693cc4.png)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 2:09am UTC](https://forum.arduino.cc/t/op-amp-battery-charge-indicator/483893/14 "2021-05-06T02:09:37Z")

</div>

Closed on May 6, 2021, 2:09am UTC


