Battery level indicator with Arduino Mega

Hello guys, I made a GPS tracking and logging device(Logs data in SD card) using Arduino Mega, I've a Lithium ion single cell Battery to the device for supplying power, I want to measure the battery voltage level of the same battery, I'll add three LEDs to my device to indicate three levels of remaining power.

I don't want to connect battery positive supply to any Analog or Digital pin and measure.

I've seen few forums about measuring voltage using Internal Reference(This could be helpful). How to do this.?

Please help

Thanks

I don't want to connect battery positive supply to any Analog or Digital pin and measure

Why not ?

Why not ?

That's the method i don't prefer for my self, I want to learn more new stuffs in Arduino, I know that will be the easiest method to measure the voltage.

Well, in order to measure the voltage of a battery you must connect something to each of its terminals so you will need to think again. Exactly how you measure the voltage and under what conditions is a different matter.

Is the Mega being powered by the battery whose voltage you want to measure? if so the technique is described in this link.

…R

@Robin, thank you very much, I was looking for something like this only, that post made me also realise that using voltage divider will also drain battery.

mudassir9999: only, that post made me also realise that using voltage divider will also drain battery.

I have wondered (but never tested) if it would be possible to feed the GND of the voltage divider into an Arduino I/O pin and set it to INPUT to get a very high impedance to minimize battery drain. Then set it to OUTPUT and LOW when you need to measure the voltage.

Hopefully someone else will comment on whether that is a sensible or silly idea.

...R