All About Circuits Forum  

Go Back   All About Circuits Forum > Software, Microcomputing, and Communications Forums > Embedded Systems and Microcontrollers

Notices

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.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 12-21-2010, 12:52 AM
strontium strontium is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Exclamation 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
Reply With Quote
  #2  
Old 12-21-2010, 02:35 AM
thatoneguy's Avatar
thatoneguy thatoneguy is offline
Senior Member
 
Join Date: Feb 2009
Location: Midwest USA
Posts: 6,356
Blog Entries: 4
Default

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.
Reply With Quote
The Following User Says Thank You to thatoneguy For This Useful Post:
strontium (12-22-2010)
  #3  
Old 12-21-2010, 03:24 AM
AlexR's Avatar
AlexR AlexR is offline
Senior Member
 
Join Date: Jan 2008
Location: Australia (UTC+10)
Posts: 735
Default

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
Reply With Quote
The Following User Says Thank You to AlexR For This Useful Post:
strontium (12-22-2010)
  #4  
Old 12-22-2010, 04:59 PM
strontium strontium is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Default

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
Reply With Quote
  #5  
Old 12-22-2010, 05:15 PM
spinnaker's Avatar
spinnaker spinnaker is offline
Senior Member
 
Join Date: Oct 2009
Location: Pittsburgh, PA U.S.A.
Posts: 3,645
Default

Quote:
Originally Posted by strontium View Post
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.
Reply With Quote
The Following User Says Thank You to spinnaker For This Useful Post:
strontium (12-22-2010)
  #6  
Old 12-22-2010, 05:31 PM
strontium strontium is offline
New Member
 
Join Date: Apr 2009
Posts: 3
Default

Quote:
Originally Posted by spinnaker View Post
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
Reply With Quote
  #7  
Old 01-06-2011, 12:10 PM
Arm_n_Legs Arm_n_Legs is offline
Senior Member
 
Join Date: Mar 2007
Posts: 170
Default

Simply use a low voltage detector chip like the STM1061
Reply With Quote
Reply   Post New Thread

Tags
, , ,


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Low Voltage Battery Alarm and Disconnect 12v trader007 The Projects Forum 19 07-20-2010 05:07 PM
battery recharge ??? Mathematics! General Electronics Chat 11 01-05-2010 05:08 AM
Battery Powered PIC Design Help Robert1 The Projects Forum 1 05-04-2009 02:17 AM
Low Voltage Battery Warning Circuit jgeerman The Projects Forum 2 02-07-2008 03:28 PM

Thread Tools
Display Modes

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 Jump


All times are GMT. The time now is 03:50 PM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.