I've designed a circuit for a battery indicator for my 18V Li-ion battery pack, based off this example here: https://www.electroschematics.com/8347/24v-battery-level-indicator/

I have it laid out on a breadboard, and it works as expected for outputs 1-3, but 4 seems to always be low, unless Vin (18V) goes very low, as below:

LED 1: Red - always on

LED 2: Green - on >3V ***This should be ~13.5V, which is my problem

LED 3: Green - on >14.8V

LED 4: Green - on >16.1V

LED 5: Green - on >17.5V

If I move the wires for 4IN- and 4IN+ to 3IN- and 3IN+ LED3 works properly, switching LED3 on >13.5V but off under that, but LED4 is still always on. So I don't think its the wiring, it just seems like comparator 4 doesn't work?

I've also put a new LM339N in, but it makes no difference.

Any obvious errors or thoughts?


Edit/additional info Vin should hopefully never be below 12.5V, otherwise my battery pack is toast! I'm happy with how it currently works, with the current thresholds and LED brightness, except that of comparator 4. The power for this circuit is through a switched input, so it's not always on and current draw isn't really a concern, but I will look into improving it anyway. This will be used on a device outdoors, so I need the LEDs to be pretty bright.

LM339N 18V battery indicator circuit

lm339 pinout

  • \$\begingroup\$ Some pin numbers on the LM339 symbols would be useful... \$\endgroup\$ – Peter Bennett Jan 28 at 23:31
  • \$\begingroup\$ How is your 6.2V zener reference going to remain 6.2V when your input voltage is 3V? \$\endgroup\$ – Hearth Jan 28 at 23:31
  • \$\begingroup\$ In any case, your battery pack should never go anywhere near 3V; that's going to cause severe damage to your batteries. \$\endgroup\$ – Hearth Jan 28 at 23:33
  • \$\begingroup\$ You should never let each cell stay below 3V for long nor above 4V for long and 12.5V is 2.5V/cell !!! best to change your specs \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 29 at 2:19
  • \$\begingroup\$ Exactly, so if comp4 worked as I hoped, it would turn off the last green LED when the pack is below 13.5V, allowing for 0.5V buffer as well. The battery pack itself has a BMS for charging and discharging management anyway \$\endgroup\$ – Greg Foord Jan 29 at 2:22

Would you like to specify your desired threshold voltages and tolerances?

This design is poor due to Zener Rs but could be improved with R9,11~14 raised to 10x...to draw less current. Thus the R divider draws current from the Zener making its variation too much for your thresholds.

The best R values depends on your SPECS.

You can use whatever you want but you can see the threshold variation in the graphs due to the zener have improved. which caused your fault. I would put the battery on Red alert below 14V. enter image description here

  • \$\begingroup\$ Thanks, whatever than online circuit thing is its great, I'll have to look into it. I've updated my description to explain the input is switched, so this circuit is rarely powered, so current draw isn't a big concern, but still something I will consider. The LED current will be 18mA right? This will be used outdoors, so I need them bright \$\endgroup\$ – Greg Foord Jan 29 at 2:31
  • \$\begingroup\$ If you choose 10~ ~ 20Cd 30 deg LED's they will be blinding \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 29 at 3:01
  • \$\begingroup\$ You can adjust any R-value and battery voltage \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 29 at 3:02
  • \$\begingroup\$ tinyurl.com/y9d52vy4 \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jan 29 at 5:56
  • \$\begingroup\$ Well I've updated my circuit using some of the advice I've had on this post. I've simplified it, removing the zener and used a 3.3V LDO (LP2950ACN-L-3-3), and increased my resistors, reducing the current. I still have the exact same problem though. None of the + or - inputs from the other comparators work on comp4, but if I put the inputs for comp 4 to any other comp they work. tinyurl.com/y8vkf7sk \$\endgroup\$ – Greg Foord Feb 7 at 4:02

Your reference won't work until the input voltage exceeds about 7V. You can replace the zener with a LM431 2.5V reference and adjust the resistor values, (or a TLV431 1.24V reference-- better because it needs less current to regulate, but more expensive).

  • \$\begingroup\$ The battery pack will (should) never go below 13V, so It should be fine, and I've updated the description to explain that current draw isn't a concern for me, but something I will consider, thanks. \$\endgroup\$ – Greg Foord Jan 29 at 2:33

Well let this be a lesson to me and everyone reading this, don't overlook the simple things! Turns out my breadboard was faulty, so the rail that the comp4 output pin was on was shorted to ground. Thanks for all the help anyway, some of the answers have been helpful improving my design anyway!

  • \$\begingroup\$ The engineer’s rule is look at voltages all around the chip and if anything suspicious , then check for bad connections, functions then noise. This is automatic. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 7 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.