PDA

View Full Version : Measuring Battery voltage



BobP
- 3rd December 2006, 21:20
Hi all,

I want my cake and eat it too!

I need to monitor the battery voltage powering a Pic (16F876) circuit. The voltage swing is around 4.5v to 3.3v. The problem is the batteries are small "AAA" size and the PIC 'sleeps for 99.9% of the time. What is the best way (if any) for the PIC to periodically monitor the battery without the measuring circuit draining the battery all the time?

I thought of switching the battery voltage to a circuit but not sure how the switching transistors voltage drop would affect the measurment, for example with temprature?

Thanks,
Bob

mister_e
- 3rd December 2006, 21:30
use a timer (watchdog) interrupt + resistive voltage divider. one side of your voltage divider go to the battery, the other side (wich is suppose to go to GND) will go on a extra I/O. When your PIC wake up of the timer interrupt or sleep, or WDT or whatever else, you configure this i/o as output and send this PIN to GND, then take the battery reading. Once done, you turn this i/o to input and go back to sleep.

Another method is to use high value resistors (few hundreds Kohms) and use analog comparator interrupt.

16F876 is probably not the best choice for a battery opeated system. a LF serie could be better. 18F even better.

BobP
- 3rd December 2006, 23:07
Thanks Mister e,

I was thinking of switching the 5v to it but your solution is better. The Pic I was intending to use was the LF version.

But any pointers on a better 18F part with similar ports and pinouts would be appreciated. I now get confused by the seemingly massive choice of parts.
Is there a group of 18F parts that are commonly used?

Thanks,
Bob