# Calculating battery voltage when powering trough Vin

Hello,

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!

The battery voltage IS dropping.

9V batteries can't provide much current -- they are for smoke alarms, not Arduinos running other things. When your devices try to draw too much current, the voltage drops.

Its best not to expect more than 50mA from a PP3 sized 9V battery, though rechargable versions can be rather better.

Not only are they low current, they tend to have a low energy density compared to most form-factors due to cramming 6 non-cylindrical cells into a small case - much of the battery is packaging/insulation, not electrochemistry, unlike AA cells.

Please define "semi-new". Might that mean "not-new"? 8.7V on a non-rechargeable PP3 is likely to be depleted, falling to 8.4V from only the tiny load of a base arduino hints that it is, and a depleted PP3 is liable to fall (eg to 6V) when loaded. What happens if you provide a steady >7V from any scrap AC-DC adapter which you might find and cannibalise? Perhaps six AA rechargeables would be better than what you use.