I started working on a simple battery powered project (door alarm) and I would like to include a simple battery monitoring solution (green/yellow/red led).
I stumbled upon this post, and it seems to work pretty fine (though I use 10k and 1k ohm resistor in my voltage divider, changed the "scale factor" accordingly). When powering the Arduino over usb (instead of Vin) and outputting the voltage measurement over serial I got about 8.4V which seems close enough (semi new 9V battery, multimeter says 8.7V). However when hooking up a HC-06 bluetooth module to the Arduino, and powering the Arduino through Vin (using the same battery as I am trying to measure) and outputing the measurement result over bluetooth the measured voltage drops to about 6V.
Now, clearly the voltage is dropping because when powering the Arduino using the same 9V battery as I am trying to measure, less voltage is applied to analog pin 0. However, the battery is still able to output about 8.4V, so now my question is: using the 6V measurement how can I calculate the actual voltage (i.e. 8.4V)?
Thanks in advance for any help!