Here's something else to try. This code uses the 1.1V reference in the Arduino to calibrate what the actual value of the nominal 5V supply is. If you want to use the USB power supply, call readVcc and use the value returned instaed of the 5000 as the divisor in the temperature calculation.
int readVcc()
// Calculate current Vcc in mV from the 1.1V reference voltage
{
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return(result);
}
void setup() {
Serial.begin(57600);
}
void loop() {
Serial.println( readVcc(), DEC );
delay(1000);
}