I would like a very simple way (preferably a single IC) of sending a HIGH or LOW signal when the voltage of my Lipo battery dips below 3.3V (I set this as my low battery threshold value, which I think is reasonable). What I have been doing is reading ADC with a voltage divider, but sometimes this fluctuates and requires some calibration because my experience is that my ADC values are always about 5% off, at least on the ESP8266. I also need something that draws as little current as possible (< 2uA preferably), otherwise I'd just stick to my voltage divider method.
What's the best way of doing this? Also, what about voltage fluctuations due to the load turning on? For example, if the ESP8266 turns on and does something, the battery voltage can dip below 3.3V them to back up and give a false alarm. However, this shouldn't be too much of an issue for now.
My first thoughts were to use a voltage comparator that compares the battery voltage to a 3.3V regulator, and when the battery dips below the 3.3V it will output HIGH. Comparators also often have hysteresis built-in. However, what if I wanted to change the 3.3V threshold to something else, or what if I didn't have a 3.3V regulator? (Like 2.8V regulator but I would still want the 3.3V threshold)? At that point, would I have to use a voltage reference IC?
Any ideas? Thanks!
EDIT: looks like this comparator is perfect if I have a 3.3V reference and it draws 75nA lol.
OpAmp wired as schmidt trigger comes to mind, but you'll need some kind of stable reference voltage for it, or anything similar, to work.
Comparing to the output of a 3.3V regulator doesn't work as the regulator will ALWAYS be below battery voltage, due to the regulator's minimum drop (if your battery is down to 3.5V, your regulator output will be below 3V - for exact minimum drop check the spec sheet of your regulator).
I had a similar issue with reading a TMP36 sensor into an ADC port on my ATMega 328- based project. I found that there is a fair amount of 'jitter' in the conversion, probably due to noise and the fact that the ADC is dividing into very small steps. I solved this problem firstly by putting a capacitor from the middle leg of the voltage divider to ground to stabilize the voltage, and secondly by repeating the reading a number of times and taking an average reading. I also allowed time for the capacitor to charge by using the Serial.print() function to read the output and discarding the readings that indicated that the capacitor was charging. When I eventually took out the Serial.print() comments I replaced them with a delay(5) to allow charging time. This has worked very reliably for my own project.
In addition, because I was using rechargeable batteries I used the reference voltage feature so the state of charge is not a factor and I would suggest that you look at that if that feature is available. By doing this I was able to calibrate the conversion in software to match my multi meter reading.
I would suggest that you only poll the voltage when the circuit is not under load, via software.
Hope this is of some help
I use the ADC method - but average twenty samples over ~30 secs to get a meaningful reading without the sags & surges.
Works perfectly - and can send messages or shutdown at setpoints, as well as notifying when the suply has recovered above a third setpoint.
@wvmarle: Good point, for some reason I forgot about the dropout voltage of the regulator. I guess if I take this comparator route I will be stuck with 2 IC's, a 3.3V voltage reference feeding into the V- pin of the comparator, and the battery feeding into the V+ pin. Both IC's will be powered by VBAT.