how to detect a low battery condition

Thread Starter

strontium

Joined Apr 6, 2009
3
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
 

thatoneguy

Joined Feb 19, 2009
6,359
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.
 

AlexR

Joined Jan 16, 2008
732
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.
 

Thread Starter

strontium

Joined Apr 6, 2009
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
 

spinnaker

Joined Oct 29, 2009
7,830
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.
 

Thread Starter

strontium

Joined Apr 6, 2009
3
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.
:eek: Wow, you're totally right! My bad jajaj
 
Top