All About Circuits Forum how to detect a low battery condition
 Register Blogs FAQ Members List Today's Posts Search Today's Posts Mark Forums Read

 Embedded Systems and Microcontrollers Discussion forum for projects and working with embedded systems and microcontrollers (FPGAs, PICs, AVRs). Get help with hardware issues and embedded programming.

#1
12-21-2010, 01:52 AM
 strontium New Member Join Date: Apr 2009 Posts: 3
how to detect a low battery condition

Hi, i need help detecting a low battery situation. I want to power a small system with a 9V battery but using a 5V regulator. However I want to know how can I detect the battery low condition using a micro controller, so that when it is detected I can turn on a LED to let the user know he should change the battery.

I found out that some PICs come with a HLVD, but I am not sure if I must include a constant power supply that wont degrade to compare it with, or if everything is done internally and I don't have to include anything else.

In case I were to use a PIC without HLVD, how would you recommend doing it?

Thanks
#2
12-21-2010, 03:35 AM
 thatoneguy Senior Member Join Date: Feb 2009 Location: Midwest USA Posts: 6,356 Blog Entries: 4

Use one ADC port and measure off a 50% precision voltage divider (two 500k 1% in series). When the battery goes below 1.3V/Cell (7.8V), that will give a bit of warning, you could cut off at 8V (4V sensed, variable). "Dead" is around 7V on most 9V cells, and they decline quick near the end.

One measurement at the top of the main program loop or other continually called function when no other pressing needs are happening is plenty. If it spends a lot of time in sleep, a long timer can wake it up to update the voltage if this is for a long term idle application.

I'd suggest AA batteries and a 3.3V LDO regulator if the rest of your circuit can work with 3.3V. 3AAs will last quite a bit longer than 1 9V, and the size difference is small.
__________________
$\small{\fra{1}{\fra{1}{R_1}+\fra{1}{R_2}+{\dots}+{ \fra{1}{R_N}}}$ Nifty? -Click Here to see how to make your formulas Look GOOD!
Also-Impedance Graph paper.
 The Following User Says Thank You to thatoneguy For This Useful Post: strontium (12-22-2010)
#3
12-21-2010, 04:24 AM
 AlexR Senior Member Join Date: Jan 2008 Location: Australia (UTC+10) Posts: 735

The HLVD feature won't help you in this case. The voltage reg will keep the supply constant till the battery voltage falls below the regulator drop-out level and then the regulator will drop out leaving you with a dead circuit.
You could use a PIC and its AtoD converter but that seems a massive overkill just to light a low-battery indicator LED. The simplest way to do it would be to use a voltage comparator, either on a PIC or simpler still a stand-alone comparator chip such as a LM311. The LM311 will work of 5Volt and you can feed the reference input through a voltage divider across the regulated supply and the sense input from a voltage divider that is across the battery.
__________________
Alex

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."-Douglas Adams
 The Following User Says Thank You to AlexR For This Useful Post: strontium (12-22-2010)
#4
12-22-2010, 05:59 PM
 strontium New Member Join Date: Apr 2009 Posts: 3

Thanks, ill let you know how it works out. I'll be using a PIC 16F690, which has 2 built in comparators and an operational voltage range from 2-5.5V. Ill be using 3 AAs with an adjustable voltage regulator. To what voltage would you guys recommend me adjusting the regulator? When do you think would be appropriate to issue the battery low warning (i guess it should be somewhere above the regulator's dropout voltage)? Thatoneguy, you mentioned dead for the 9V batteries is around 7V, do you know the dead voltage for the AAs?

Thanks
#5
12-22-2010, 06:15 PM
 spinnaker Senior Member Join Date: Oct 2009 Location: Pittsburgh, PA U.S.A. Posts: 3,532

Quote:
 Originally Posted by strontium Thanks, ill let you know how it works out. I'll be using a PIC 16F690, which has 2 built in comparators and an operational voltage range from 2-5.5V. Ill be using 3 AAs with an adjustable voltage regulator. To what voltage would you guys recommend me adjusting the regulator? When do you think would be appropriate to issue the battery low warning (i guess it should be somewhere above the regulator's dropout voltage)? Thatoneguy, you mentioned dead for the 9V batteries is around 7V, do you know the dead voltage for the AAs? Thanks

There is no need to regulate the power to the PIC if you are using 3 AAA batteries. As you know, your operating range of the PIC is 2-5.5V.

Is the regulator being used for something else? If so just put a voltage divider before the regulator and have the PIC read that voltage. That way you can turn on your led well before the regulator drops out.
 The Following User Says Thank You to spinnaker For This Useful Post: strontium (12-22-2010)
#6
12-22-2010, 06:31 PM
 strontium New Member Join Date: Apr 2009 Posts: 3

Quote:
 Originally Posted by spinnaker There is no need to regulate the power to the PIC if you are using 3 AAA batteries. As you know, your operating range of the PIC is 2-5.5V. Is the regulator being used for something else? If so just put a voltage divider before the regulator and have the PIC read that voltage. That way you can turn on your led well before the regulator drops out.
Wow, you're totally right! My bad jajaj
#7
01-06-2011, 01:10 PM
 Arm_n_Legs Senior Member Join Date: Mar 2007 Posts: 170

Simply use a low voltage detector chip like the STM1061

 Tags battery, condition, detect, low

 Related Site Pages Section Title Textbook 555 Schmitt Trigger : 555 Timer Circuits

 Similar Threads Thread Thread Starter Forum Replies Last Post trader007 The Projects Forum 19 07-20-2010 06:07 PM Mathematics! General Electronics Chat 11 01-05-2010 06:08 AM Robert1 The Projects Forum 1 05-04-2009 03:17 AM jgeerman The Projects Forum 2 02-07-2008 04:28 PM

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Electronics Forums     General Electronics Chat     The Projects Forum     Homework Help     Electronics Resources Software, Microcomputing, and Communications Forums     Programmer's Corner     Embedded Systems and Microcontrollers     Computing and Networks     Radio and Communications Circuits and Projects     The Completed Projects Collection Abstract Forums     Math     Physics     General Science All About Circuits Commmunity Forums     Off-Topic     The Flea Market     Feedback and Suggestions

All times are GMT. The time now is 01:40 AM.