View previous topic :: View next topic |
Author |
Message |
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
Battery level monitor |
Posted: Mon Apr 16, 2007 3:40 am |
|
|
Hi,
What could be the minimal configuration to monitor the level of a battery?
In detail: I'd like to know if the Vbat is above or below a defined threshold. The PIC is powered @ 5V and the battery voltage is about 12V.
In other projects I used the internal ADC and an external op-amp to reduce both the voltage to max 5V and the source impedance.
But now I want use the internal comparator. I need a resistor divider but the source impedance must be < 10 kohm... thus the battery draws always several mA.
May you suggest me a tricky way to do this using few external components (no op-amp) ?
Thanks
Marco / iw2nzm |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon Apr 16, 2007 8:04 am |
|
|
Since you are only looking for consistency, not true accuracy, you can cheat quite a bit. Also you only need an impedance below 10K for the brief duration of the A/D measurement.
The 10K figure comes from making sure the input changes less than 1 LSB when loaded by the A/D. Since we are measuring a DC voltage we can use a capacitor to stop the input from drifting when loaded at no DC current cost. Using C=T/R with t=10us and R=10K gives 0.001uF for a single time constant. For any accuracy you need at least 5 time constants, and if you use 0.1uF you will be very safe.
So if you use a divider of say 700k and 500k with a 0.1uF cap to ground you will have a battery drain of only 10uA and a reading that is consistent within 1LSB. Note you should wait at least 250ms from when you first apply battery power till you take your first reading to let the cap get its initial charge. T=5RC=5*(500k//700k)*0.1uF
Have I lost you yet?...Just try it, it will work. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
|
Posted: Mon Apr 16, 2007 8:21 am |
|
|
It's very interesting!
Just a question: is the capacitor connected between the A/D input and ground, right?
I'll try it of course!
Ah, btw, what's the tradeoff of this method? What cannot I do?
Thanks
Marco / iw2nzm |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Mon Apr 16, 2007 11:08 am |
|
|
Yes, the cap goes from the A/D input to ground.
iw2nzm wrote: |
Ah, btw, what's the tradeoff of this method? What cannot I do?
|
What an amazing question! I wish I heard that more often.
The problem with hanging this much capacitance on the A/D is that it limits the frequency the A/D can see. With a RC time constant of 300k * 0.1uF= 30ms a signal of 33 Hz will be distorted and nothing above about 6 Hz can be read accurately. Fortunately battery drain happens much slower than 6 Hz, so it will work in this application. Also if you use a very large capacitor you may have capacitor leakage problems if the divider impedance si too high. But a generic 0.1uF ceramic cap should do fine.
SherpaDoug _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
iw2nzm
Joined: 23 Feb 2007 Posts: 55
|
|
Posted: Tue Apr 17, 2007 1:24 am |
|
|
Thanks!!! |
|
|
|