Using ADC to measure battery voltage

Thread Starter

Chacabucogod

Joined Nov 16, 2013
26
Hi,

I'm developing a gadget with a PIC18 and I would like to have the amount of charge that is left on the battery(LI-ion) that is charging it. My initial thought was to use the ADC to measure the battery's voltage, but since the ADC uses that same voltage as reference it wouldn't work at all. How is charge measured in a battery normally?

Thank you
 

be80be

Joined Jul 5, 2008
2,072
There are pic18 that can do what you want with just the ADC they use a regulated programmable voltage for the ADC.
You set this for say 2.5 volts. have to check the data sheet I'm using 2.5 as example.
So the ADC can only read 0 to 2.5 you use a voltage divider to let the ADC read the battery voltage and your ADC will read it.

This can also be done with a zener diode to feed the ADC reference on chips too both work as long as the voltage is higher then the reference.
 

Thread Starter

Chacabucogod

Joined Nov 16, 2013
26
I don't really get it. Let's say I have a zener diode connected to the ADC's port. What if the battery's voltage go below 5.0 volts, which is the desired voltage I'd like to keep?The zener diode wouldn't mantain it, as far as I understand. Do you know if the PIC18F4550 supports that regulated programmable ADC you are talking about?I checked thet datasheet, and it doesn't mention it at all. Do you have a name or number of pic that does have it?

Thank you
 

ErnieM

Joined Apr 24, 2011
8,377
All you need is a reference voltage well below the normal battery voltage so the ref is still active as the battery is dead.

Any PIC that can use an external reference for the A2D can do this.

Many PICs have an internal reference for the A2D and can also do this by itself.
 

be80be

Joined Jul 5, 2008
2,072
Use a 3 volt zener on AN3 and set that to be used as reference then use voltage divider on AN0 to scale 0 to 3 to AN0 and what your highest battery reading could be you cant input higher then the reference voltage so you scale it down to the 3 volt and with a little math you output the battery reading.
 
Top