Surely that looks OK, yes? You've got your Arduino plugged into the USB, which is supposedly 5 volts - after all, all the examples on the web just say 5v.

Wrong!

What you have there is a rough approximation. Nothing more.

If you want to make ACCURATE readings you have to know exactly what your supply voltage is.

Measuring the 5V connection on my Arduino while plugged in to the USB is actually reading 5.12V. That makes a big difference to the results of the conversion from ADC to voltage value. And it fluctuates. Sometimes it's 5.12V, sometimes it's 5.14V. so, you really need to know the supply voltage at the time you are doing your ADC reading.

Sounds tricky, yes?

Yes.

However, if you have a known precise voltage you can measure using the ADC, then it is possible to calculate what your supply voltage is. Fortunately, some of the AVR chips used on Arduinos have just such a voltage available, and can be measured with the ADC. Any Arduino based on the 328 or 168 chips has this facility.

I came across this nice piece of code on the TinkerIt site. It measures this 1.1V reference voltage, and uses the resultant ADC value to work out what the supply voltage must be.

Addendum on calibration and accuracy

The internal band-gap, while nominally 1.1V can actually be anywhere between 1V and 1.2V. If you want super-accurate readings you may need to adjust the value 1125200 to a more accurate value to represent your band-gap. That value is calculated as the band-gap voltage (in mV) multiplied by 1023. You can do the opposite of the above system and manually measure your Vcc with a DMM, then use that to measure and calculate the band-gap voltage in your chip. Multiply that voltage by 1000 for mV and then by 1023 to get the ADC division value, and Bob's your uncle. From then on, whatever your Vcc voltage does, you can get even more accurate ADC results.

These handy pushbuttons are great for rapidly connecting to your pet Arduino. With 50cm (approx 20 inches) of wire and a 2-pin 2.54mm (0.1") plug on the end they are simple to use. And the action on them is nice and definite. A good click without being hard to press.