(SOLVED) Issues reading battery voltage (DC) on analog pins for a data logger

I had a very similar problem as you can see here where you will find the solution.

I see you are using USB to power the Mega.
Because the spec for usb voltage is so loose (Vbus = 4.45V - 5.25V ) you cant usefully use it to measure your battery voltage directly. However at least its always higher then the battery voltage you are measuiring.

You CAN use the "magic voltmeter" to measure Vcc against the "INTERNAL" reference (1.1V approx) but again you lose precision because its such a small fraction of Vcc.

And if you are logging battery voltage it would seem important to get an accurate value.

My solution would be to use an external reference as described on my site here

Another approach is to use an external reference for continuous calibration