Hi,
I need to measure the voltage of a battery. The problem is that the
PIC i'll use (18F452) will be powered by the battery whos voltage I want
to measure.
It's for a hand held equipment and I want to be able to show how
much battery "is left" on a LCD display... any ideas?
Mauricio
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
Maxim makes fuel gauge ICs for the exact application you have in mind; look
at their app notes in battery management and you will find good ready to use
circuit blocks to do this.
Madhu
-----Original Message-----
Hi,
I need to measure the voltage of a battery. The problem is that the
PIC i'll use (18F452) will be powered by the battery whos voltage I want
to measure.
It's for a hand held equipment and I want to be able to show how
much battery "is left" on a LCD display... any ideas?
Mauricio
On Wed, 23 Jul 2003, Mauricio Jancic wrote:
> Hi,
> I need to measure the voltage of a battery. The problem is that the
> PIC i'll use (18F452) will be powered by the battery whos voltage I want
> to measure.
> It's for a hand held equipment and I want to be able to show how
> much battery "is left" on a LCD display... any ideas?
>
How accurate do you need it? I was thinking of doing a battery-low
indicator by using a couple of resistors in series, one end going into an
IO pin the other other to ground. Then use another IO pin in the middle of
the resistors and you can see when the voltage is low enough to cause a 0
on that pin. The resistor pair is fed from the first IO pin so you can
turn it off to conserve power.
Obviously it would need a bit of tweaking to get the resistor values
right, but I'm sure you can add a few more resistors to it to have a
'medium' and 'full' level (at the expense of a couple more IO pins).
For simplicity, you can use a voltage reference into the PIC a/d reference pin, and input the measured voltage into a PIC a/d channel (but voltage-divide if necessary to keep it <= reference voltage). The vref will need to be lower than the supply voltage.
If you're using a regulator somewhere in the circuit, and depending on how accurate you need it, you could leave off the reference. The PIC would use the regulated output as the reference, and measure the voltage at the input of the reference (ie: the battery voltage). Again, voltage divide the battery voltage as necessary.
Cheers,
-Neil.
On Wednesday 23 July 2003 10:40, Mauricio Jancic scribbled: {Quote hidden}
> Hi,
> I need to measure the voltage of a battery. The problem is that the
> PIC i'll use (18F452) will be powered by the battery whos voltage I want
> to measure.
> It's for a hand held equipment and I want to be able to show how
> much battery "is left" on a LCD display... any ideas?
>
> Mauricio
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.502 / Virus Database: 300 - Release Date: 18/07/2003
Mauricio Jancic wrote:
> I need to measure the voltage of a battery. The problem
> is that the PIC i'll use (18F452) will be powered by the
> battery whos voltage I want to measure...
Maybe a voltage divider between some output pin and Vdd.
The centre of a divider - to ADC pin.
(Or the only ADC pin and some capacitor to store voltage of
a divider)
Use 18LF452 it can run lower voltage then 18F452.
Use LVD low voltage device to detect when you want
To shut down and use one of A/D input to read the voltage
If you are using 8 bit conversion
Adres*5/256
If you are using 10 bit conversion
Adres*5/1024
Suppose adres=247
247*5/1024=1.20volt send it to LCD
How about a lm317 in constant voltage configuration to ref pin. Sometime ago
I made the brown out ext. circuit just to back up a few ram regs. to eeprom
before the supply is gone. I've connected before the regulated stage. I
think there are a few others components with a low tempco and they consumes
nothing
I have several alkaline battery-powered designs out working. They all have a common design. Nominal battery drain averages 15-25 uA.
What I do is to use a 250mw 3.3V 5% zener as a reference. Because it draws quite a bit (5-10mA) to put it above the "knee", I only measure battery level in a "pulse" of activity (i.e. total time on is about 2mS) every 60min or so. My battery supply is nominally 6V, so I have a battery range of 1.65V per cell down to 1.1V per cell. I divide the nominal 6V in half with 2% 100-ohm resistors. This provides a reasonable, but not excessive, load on the supply for 2mS (driven by a PIC pin). I read the value twice then release the load immediately. I average the two readings.
I have a table of 12 values plotted for the 8-bit ADC reading; I test against each value and interpolate between-values (but usually, just take the lower value). The output is a value for a common user, 'F' for full, 'E' for empty, '9.9'-'0.1' so the user has some idea how much life is left. In actuality, a voltage of 6.5+ is 'FULL' and 4.4 or less is EMPTY.
The table is NOT linear, the battery spends more time in the lower regions than the upper, which drops off pretty fast at first. Note that most PICs will work flawlessly at 32.768Khz at even lower voltages, but I don't push it because of the extreme temperatures it might face.
I derived the table by sending the ADC reading out from an unused PIC PIN while using a Fluke DVM attached to a precision lab supply as a "battery". I used my "Single-Pin Diagnostic" scheme, a Manchester-Mark data transfer system, to send the data. It works regardless of PIC clock speed, driving into a Win98 parallel-port receiver.
--Bob
At 01:26 PM 7/23/2003 -0300, you wrote:
>Actually, I was thinking of a 4~6 level indicator... That’s why I needed
>the ADC...
>
>Mauricio Jancic
>Janso Desarrollos
>(54) 11 4542 3519
>Republica Argentina
>Microchip Consultant Program Member
>
>
>{Original Message removed}
>> It's for a hand held equipment and I want to be able to show how
>> much battery "is left" on a LCD display... any ideas?
>>
>How accurate do you need it? I was thinking of doing a battery-low
>indicator by using a couple of resistors in series, one end going into an
>IO pin the other other to ground. Then use another IO pin in the middle of
>the resistors and you can see when the voltage is low enough to cause a 0
>on that pin. The resistor pair is fed from the first IO pin so you can
>turn it off to conserve power.
>
>Obviously it would need a bit of tweaking to get the resistor values
>right, but I'm sure you can add a few more resistors to it to have a
>'medium' and 'full' level (at the expense of a couple more IO pins).
>
>Good luck with it,
A good way to do this is to attach a stable reference to the Vref+ pin of
the PIC, and use this as the reference voltage when doing any other analogue
measurements, (with caveats about the linear input voltage needing to be
less than the Vref voltage), but when you want to measure the battery
voltage, convert to using Vcc as the reference, and measure the Vref
voltage. Now this will give you an inverse function, I.e. as the battery
voltage falls the voltage you will measure will rise. When the "voltage" you
measure gets above a certain value (you should be able to precalculate this)
then the battery is below its end voltage.