CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Check Battery Level

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

Check Battery Level
PostPosted: Wed Feb 09, 2005 9:07 am     Reply with quote

Any ideas how a guy could check the battery level of 2 AA batteries from the A/D port of a 16F628? The 2 AA's are the only power supply in the circuit. No regulator. I want to flash an LED if they are low. (Even though this means faster battery drain.)
Guest








PostPosted: Wed Feb 09, 2005 9:21 am     Reply with quote

rt(f)m Question
Guest








PostPosted: Wed Feb 09, 2005 9:22 am     Reply with quote

and maybe use a resistor divider to lower the voltage to a measurable value.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 9:35 am     Reply with quote

I would use a Micro-Power Rail-to-Rail CMOS Comparators with Open-Drain/Push-Pull
Outputs like National LMC7215 ($0.54) or similar wich will run down to 2V of power supply,
detect the minimum allowable voltage, switch-off the microcontroller and slow blink a LED
until batt is completelly die. My $0.02 contribution.

Humberto
ljbeng



Joined: 10 Feb 2004
Posts: 205

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 10:26 am     Reply with quote

I will try the MCP100-270DI/TO-ND from Digikey. It goes low <2.7V. Adds 45ua to supply.
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 10:41 am     Reply with quote

In answer to your original question: Yes it can be done.

Two AA cells would be a max of about 3.2 volts which could be monitored directly by the PIC ADC. You will need to have some kind of circuit isolation due to the low impedence of the battery. A low cost op-amp and a few resistors would be what you need in that case.

To learn how to code for using ADCs to monitor voltage, search for ADC in this forum. There is a huge amount of info here.

That being said, the most cost (and time) effective approach is the one being suggested above using a battery monitor chip.
valemike
Guest







PostPosted: Wed Feb 09, 2005 11:32 am     Reply with quote

I had a 9V battery which i wanted to monitor if it got to 7V (low batt).

I went with someone's advice of using a MAX666 voltage regulator with lowbatt detector (the lowbat level was configured using an xMohm resistor voltage divider). This method is costly, but saves a lot of current (standby of 5uA or something like that).

As for your 2AA method, then i really don't see how a MAX666 could apply. Might want to check the lowest possible Vout of the MAX666 and the lowest possible Vdd of the PIC. This would be overkill because you then wouldn't need a voltage regulator.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Feb 09, 2005 3:24 pm     Reply with quote

Is the problem that your batteries are also the reference for the A/D? If so then as the batteries drop both the reference and the divider output drop together so the A/D reading doesn't change.
If you can power a 1.25V reference chip from a port pin that will give you something to compare to. Look at a MAX6190 or simillar. As the batteries fail and the A/D Vref drops the 1.25V will look like it is getting bigger.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group