Although it’s not obvious, the two blue 2431 Ω resistors just above the toroid are a divider that scales the switched battery voltage (from the p-MOSFET on their left) by 50% and sends it to input A0 on the Arduino Pro Mini board:
The firmware can use that input to dim the LEDs when the voltage drops below some preset threshold and, eventually, turn them off completely.
Figuring the actual battery voltage is straightforward:
- get 10 bit ADC value with
- multiply by actual VCC (measured at 4.96 V for this board)
- divide by actual voltage divider ratio (measured at 3.78/7.57)
Which, of course, reported the battery voltage was 4.116 V. Huh?
After spending far too much time poking the code with a sharp stick, I wired the divider to the (previously unused) A6 and A7 inputs and dumped the raw ADC counts for all three. The answer should be somewhere near 763, but the three values came out around 215, 667, and 750. Huh?
The A0 value is totally bogus, so I finally looked at the Arduino Pro Mini board:
Hmmm. It turns out A0 is the second pin back on the left side:
Double hmmm. An even closer look:
I slathered flux on all the pins, touched each one with a soldering iron, and it’s all good.
This is a knockoff Arduino Pro Mini board from eBay, of course, and the rest of the boards in that lot were OK. Their QC inspection almost certainly boils down to running the Blink sketch: if the LED blinks after the power goes on, ship it!
Blink doesn’t verify the analog inputs, which turn out to be wrapped around that corner of the package.