Here is my schematic enter image description here

It's basically a crude battery level detector (I am very aware that this isn't the best way to guage battery life, I'm not here for that) it's not crucial that it is super accurate.


When the battery voltage is near 4.05V or 3.45V the output of U9 oscillates and two LEDs are on at the same time, LED1 and LED2 or LED2 and LED3 respectively. Datasheet here

It is necessary that only 1 LED is on at a time.


I have found one solution but I am asking a question here to see if there is a more elegant or clever one (hopefully). Board space is ridiculously important here and my solution really doesn't fit well despite being only 4 components. The biggest problem is I want to be able to rework it into existing boards, and my solution is ugly and time consuming (4 cuts, 4 jumps).

I made U9 into two schmitt triggers with 100mV of hysteresis. Yes it works, but it makes the schematic ugly and adds 4 more components.


My thoughts were maybe there is an off the shelf comparator that has built-in hysteresis (don't know how to search for this on digikey) or maybe you clever guys on EESE have a better solution.

  • \$\begingroup\$ ti.com/lsds/ti/amplifiers-linear/… \$\endgroup\$ Aug 5, 2014 at 2:08
  • 1
    \$\begingroup\$ I think your solution (hysteresis) is the best answer. You should be able to remove one of your added resistors by combining it with R15 or R16. You could also save board space by removing C23, C29, C30 which are probably only contributing to instability in your amplifiers. \$\endgroup\$
    – The Photon
    Aug 5, 2014 at 2:40
  • \$\begingroup\$ Are these assembled boards, where removing parts requires labor, or are they bare boards where less parts is a saving? \$\endgroup\$
    – gwideman
    Aug 5, 2014 at 10:18
  • \$\begingroup\$ assembled boards. \$\endgroup\$
    – ACD
    Aug 5, 2014 at 11:35
  • 1
    \$\begingroup\$ I think you would add 3 resistors to your current design. On U9 between output and + input; between U11 output and U9 + input; and on the device with no designator, between output and + input. \$\endgroup\$
    – The Photon
    Oct 20, 2014 at 23:22

4 Answers 4


Sorry, but hysteresis is the way to go, and in this case it will take 3 extra resistors, not 4. In order for the low-voltage hysteresis to work, C25 has to go, and you can take advantage of the Thevenin equivalent resistance in the R15/R16 divider to provide the input resistance you need.

And that said, your circuit has a couple of things that make my brain itch, so I'll deliver some unwanted analysis.

1) The 4.05 set point violates common mode limits by .25 to .5 volts, depending on your paranoia about operating temperature.

2) The LEDs may not be as bright as you expect. High output for the comparator is only claimed to be 2.4 volts (typ) for a 4 mA load.

3) As a result of the previous, if U10 is a standard CMOS part with 2.5 volt input threshold, it may not work properly. It probably will, since at 2.4 volts your LED won't be drawing 4 mA.

4) You can get rid of U11 altogether. With a worst-case bias current of 600 pA, the offset due to a 1 M input resistance is only .6 mV, compared to a comparator input offset of 5 mV.

5) You don't need the 22 pF caps on the output of the comparators. If anything, they'll fight the hysteresis. They'll lose, of course, but still...

6) You probably don't need C31, since the input capacitance of Q2 is 27 pF (typ), but a 10 to 100 ohm series gate resistor would be a good idea just on general principles.

7) Your voltage set point networks could be done with 3 resistors rather than 4.

8) C38 can go, since VBAT is already filtered by C22.

Other than that, nothing jumps out at me. I do like to see someone as paranoid about decoupling as I am.

  • \$\begingroup\$ 1) Nice catch, I'll replace Ull with a voltage divider 2) This is by design 4) I like this idea. Will use another 1meg to divide voltage in half for Vicm 5) I was paranoid with decoupling... 6) Why a series R for a MOSFET? What are we protecting? 7) I wanted to be able to change each one individually without a lot of thought haha 8) I wanted local capacitance at this node \$\endgroup\$
    – ACD
    Aug 5, 2014 at 12:21
  • \$\begingroup\$ Can you provide a schematic of the 3 resistor hysteresis solution. I can't quite figure it out. I'm aiming for 100mV of hysteresis. \$\endgroup\$
    – ACD
    Oct 20, 2014 at 22:32

You're probably going to hate me, but I'll suggest using a microcontroller with an ADC converter. Just have it wake up every now and then and set the output state.

The LTC1042 window comparator is an old-school solution (I think I designed one in back in the '90s) but its kind of expensive. It is a window comparator that you can set the sample rate on, so both LEDs won't be on at once (but they might go back and forth).

Neither of those suggestions are helpful with rework, but for a relatively small quantity of boards the cut and jumps doesn't sound too terrible (especially if you get someone else to do it for you).

The LTC6702 does have built-in hysteresis, but only 4mV. Of course you're free to divide down the input to make more of that.


If you want to reduce your parts count (and space requirements) drastically, I would replace all of your circuitry with a small microcontroller, such as the PIC16LF1613 which comes in a tiny 16 pin, 4 mm square QFN package (plus several other choices). So you handle the window comparison and hysteresis in firmware.

The microcontroller has a multiple channel 10-bit ADC and plenty of I/O lines to drive the LED's. The outputs can drive 25 mA so you won't need external drivers. Since it has an internal oscillator, all you need to add is a decoupling cap. Costs about $1 in single quantities, and 70 cents in 100's.


Depending why and what you want the comparator for, you may find what you need from one of the hundreds of battery control/charger/power management IC, readily make and designed to handle great variety of real-life situations, spanning wide range of battery chemistry/design/capacity.

There are different IC for LiPo, NiMH, Lead Acid, etc. Some are multiple modes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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