A2D battery reads inaccurate due high source impedance

Has anyone looked at the accuracy of the A2D? I wrote a simple sketch to read the battery voltage three times in rapid succession and report it to the Serial port. The Battery voltage is available on the B0 pin via a voltage divider that has a 4.7M to a 10M to ground. The readings (average of the three reads) I get vary from a raw value of 642 to 771. This is variance of almost 415mV. The only other functionality that I have is I am blinking the LED every 500mS so there should be very little systems noise.

My guess is that the source impedance is MUCH too large. Most Arduino’s suggest a source impedance of less than 10K and the Autonomo has 4.7M. I think this was done to reduce unnecessary current drain from the battery.


Hi Phil,

After the reading you need to do a little calculation.
Can you test the following sketch?


// MBili / Tatu
//#define debugSerial Serial
// Autonomo
#define debugSerial SerialUSB

//These constants are used for reading the battery voltage
#define ADC_AREF 3.3
#define BATVOLT_R1 4.7
#define BATVOLT_R2 10

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:

float getRealBatteryVoltageMV()
  uint16_t batteryVoltage = analogRead(BATVOLTPIN);
  return (ADC_AREF / 1.023) * (BATVOLT_R1 + BATVOLT_R2) / BATVOLT_R2 * batteryVoltage;

Changing my sketch to use the BAT_VOLT definition instead of B0 and the result is now stable. According to the schematic that I was able to find on line the signal BAT_VOLT is connected to pin 62 (B0) of the controller. The schematic is dated 19-7-2015 Rev 3.

  • Changing from
    #define BatVoltage B0
    #define BatVoltage BAT_VOLT

  • Was I using an out of date schematic? Where can I locate up to date schematic and PCB layout files?


1 Like

Forgot I was working in an Arduino world and I was attempting to access the I/O directly, My mistake.

Are there schematic and layout files available for the Rev 4b boards that we received?