Arduino 9V power supply measuring voltage remaining

OK, I am trying to devise a way to see the burn rate of a 9V batter powering my Arduino micro. I have seen the internal VCC reading code below. However, this appears to show the voltage that is after micro controller because it reads 3332 pretty much till it just dies due to lack of voltage/amps? I could be very wrong here, so I need some help in understanding what the code is reading below, and if there is an option besides a voltage divider, don’t want to draw more current than I have too for my circuit. Does anyone have any suggestions that might help me accomplish this goal?

long readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(200); // 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;

Why not start the easy way?
Add 2*100k resistors in series from 9v to GND. Center to (5Vreference if possible)
A fresh battery should give a reading near 1000

Yes, I could do the voltage divider method, I was hoping to get some insight on the internal VCC and other options.


I was hoping to get some insight on the internal VCC and other options

What does that mean?

The voltage divider method works.

I referenced the code above, I know voltage dividers, but I am looking for other options, and trying to avoid extra milli amps and use what is already there versus creating extra circuit I have to include in a very small box.


Vcc is regulated, it wont change till the 9V batt is down to 6.6V or so...

If 50uA inst affortable, increase R. ADC input impedanse is many MOhm
Or. Use an optocoupler (draw many mA) to switch R-network in/out.
(if so - remember to log with loooong time intervals. You may save a Q or 2)