Battery level detector - Page 1
Forum section: electronics / projects

author: redrobingarden
author_rank: Newbie
timestamp: June 01, 2012, 05:17:10 am
content: Hello!I'm trying to make a simple portable circuit that uses a PIC18F chip that is powered by 2 double AA batteries, and I'd like to be able to monitor the battery level so I can flash a red light when the batteries get too low. In my application, I want it to run till the end of time, so low power is critical.At first I was thinking of just sticking the VDD line into an analog to digital converter pin, but then I realized that I need a reference voltage. If all I have is the battery voltage for reference, how do I check the level of the batteries?I was thinking of maybe using a zener with a breakdown voltage that is matched to the low voltage threshold, and attached to VDD and a digital input. When the voltage goes below the zener's breakdown, I should read a low on a pulled-down pin. Because I have a low power application I was thinking I could attach the zener anode to a digital output, so that way when the device is sleeping, I can turn off power to the zener and the pull down resistor. With this i think i might run into issues with my high voltage level sometimes not being high enough to be read by the PIC.I'm curious to see what you guys do in situations like this. Thanks!

author: PeterG
author_rank: Frequent Contributor
timestamp: June 01, 2012, 05:51:37 am
content: Quote from: redrobingarden on June 01, 2012, 05:17:10 amI am thinking Atomic batteries or Flux capacitor as a minimum in order to last to the end of time.....Regards

author: TerminalJack505
author_rank: Super Contributor
timestamp: June 01, 2012, 07:07:57 am
content: Here's a circuit along the same lines as to what you're thinking but would require less power.This one uses a TLV431 instead of a zener diode. A TLV431 is basically a "programmable zener diode." Here the TLV431 is being used as a comparator (with a built-in voltage reference.) Seethis app notefor more information.You can set the battery low threshold voltage via R1 and R2. You enable the comparator the same way as in your circuit and then check the output.The output will remain at Vcc until Vcc reaches the battery low threshold voltage level. Once Vcc reaches this level the output will gotowardground. The problem here is that it may not get close enough to ground that you can read the comparator's output with a digital pin. You might have to use an ADC pin. You'd have to check the datasheets and make sure that VKA(min)is less than your MCU's worse case input low voltage before using a digital pin.R3 just limits the current through the TLV431. It should be made as large as possible to conserve power. (R3 should allow at least 100uA to flow through the TLV431.)They make voltage detector ICs as well. (For example.) These are 3-terminal devices that output a logic signal that indicates whether the supply voltage is above a fixed voltage. These require even less power. I haven't had good luck with the MicroChip voltage detector ICs, however.Edit: The output of the TLV431 is actually opposite to what I stated above.

author: Jon Chandler
author_rank: Frequent Contributor
timestamp: June 01, 2012, 07:37:24 am
content: Some of the 18F-k-series parts have a built in Fixed Voltage Reference. You can either use this as a reference (on most parts) or measure it using Vdd as the reference to calculate Vdd. The 18F25K20 can be used in the later way, as the FVR can't actually be used as a reference voltage.

author: Bored@Work
author_rank: Super Contributor
timestamp: June 01, 2012, 08:53:50 am
content: Quote from: TerminalJack505 on June 01, 2012, 07:07:57 amI you use a generic 431 instead of the TLV421 then 100µA are too low. Most need something like 1 mA for a start, and some cheap clones are more happy with 5 mA than 1 mA. And that could become a problem for a low battery indicator, at least in low power applications.BTW, interesting that Diodes/Zetex has multiple 431 application notes. Other vendors have the same circuits all in the datasheet, instead of splitting them over five app notes. E.g. Fairchildhttp://www.ti.com/lit/ds/symlink/lm431.pdfor TIhttp://www.ti.com/lit/ds/symlink/lm431.pdf

author: SeanB
author_rank: Super Contributor
timestamp: June 01, 2012, 03:16:35 pm
content: Have a look at Dave's uCurrent for a nice low voltage detector, there Dave is using it as a very low power and simple low battery detector, you just use it to drive the input on your micro to show low battery.

author: redrobingarden
author_rank: Newbie
timestamp: June 01, 2012, 03:29:05 pm
content: Thanks for your input! I didn't know about the fixed voltage reference on PICs. I just did some digging through the datasheet of the device i'm using (PIC18F45K20) and found out about the HLVD feature, the high low voltage detect module. With it I can simply monitor Vdd and have a flag go up if it goes below a certain threshold.0 external components and no extra cost! Yay! I think this should work perfect for me.http://cl.ly/2U2A3a0W3d1p2M1a2f0Ghttp://cl.ly/1X0g201A473J3F290q2w