self battery sensing
Dan Michaels email (remove spam text)
Actually this was my "guess" as to what Roman's ckt was,
as he wasn't saying at the time :). Turns out he liked my
guess better than his own actual ckt.
I hadn't really thought about it much, but Alice mentioned
offlist that this dohicky is quite dependent upon the tolerance
on the cap. Then of course you have to worry about calculations
related to exponential charging waveforms, but I am sure the
s.w. weenies got a way around exp/log computations.
>This charge time will be dependant on the battery voltage,
>and since the PIC is run from regulated 5v it's input pin
>threshold will give a fairly reliable trigger point. You don't
>need an analogue input pin.
Actually, as mentioned last week, my "preferred" ckt would
use an A/D channel connected to a digital I/O pin thru 10K
as well as to the battery thru a 5.1v zener. Pull the I/O
pin low, and you get battery value directly, Vanal_in = Vbatt-5.1v.
Also, when you pull the I/O pin high, the only current thru
the zener is gonna be leakage - hopefully low. But you could
probably deal with that by floating the I/O pin rather than
pulling high. If you don't like floating tie a 500K from the
pin to Vdd.
>For low power use hold the pin at logic high, 5v, so current
>will be 9v-5v = 4v/560000 = 7uA so not too bad. I imagine
>the PIC pin protection diodes will handle that 7uA,
Yeah, supposedly 25 mA - although I have put 75-100 mA into
PIC pins in qual testing without frying the diodes.
Also, if you look in the old AN521 appnote, Mchp shows a
ckt where they connect 120VAC out of the wall straight into
a PIC thru a 5M resistor. Gives me the willies, but they do
it. They obviously figure the clamping diode knows its job.
>you have the space and budget put a 5.1v 400mW zener from
>pin to ground to keep everything in spec. I would do this
>if the product was for commercial sale. Heck I always have
>5.1v zeners around so I would do it anyway!
Bingo - see comments above about 120VAC to pin.
>leakage, with the PIC unplugged, you may need a higher
>voltage zener to balance at such a low current, like 7uA.
>I am not sure how this circuit will hold up under battery
>measuring when the battery gets to 5v, but hopefully the
>user has seen the low battery indication and changed the
>battery by the time it gets under 7v or so. :o)
Hopefully you track Vbatt and catch it before the ckt
[hey Roman, I'll trade you some good stepper motor code
for your milling machine - having but one of those and a
1 Ghz scope, and I'll die happy :)].
- Dan Michaels
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
See also: www.piclist.com/techref/power/batterys.htm?key=battery
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the