XIAO ADC problem

I have two Xiao board and with boths I have problems.

I tried with both board all analogRead() examples, but with no success.

The pins are connected right, I checked that with an multimeter.

That is one of my test sketches:

#define ADC_GND_PIN A1
#define ADC_VCC_PIN 6
#define ADC_BITS    12   // The SAM D1 on Seeeduino XIAO has 12 bit ADC inputs

void setup() {
    Serial.begin(115200);
    while(!Serial);  

    Serial.println("\nReading Ground and VCC values with Analog Input");

    analogReadResolution(ADC_BITS);
    pinMode(ADC_GND_PIN, INPUT);
    pinMode(ADC_VCC_PIN, INPUT);  
}

int gndValue;
int vccValue;
void loop() {
    gndValue = analogRead(ADC_GND_PIN);
    delay(10);
    vccValue = analogRead(ADC_VCC_PIN);
    Serial.printf("ADC(GND) = %d, ADC(VCC) = %d\n", gndValue, vccValue);
    delay(1500);
}

and the Serial output is:

ADC(GND) = 599, ADC(VCC) = 1376
ADC(GND) = 711, ADC(VCC) = 1258
ADC(GND) = 562, ADC(VCC) = 1416
ADC(GND) = 739, ADC(VCC) = 1230
ADC(GND) = 521, ADC(VCC) = 1449
ADC(GND) = 792, ADC(VCC) = 1182
.....

it looks like that the VCC and GND ist not connected, but that is the case .

I hope anyone can help me !?

Regards Matthias

@Matthias_Fre which arduinocore version do you use ? our lastest ArduinoCore version should be v1.8.1

Hi,

i have the same problem.Is there any solution?
How can the GND and VCC be calibrated?
My analogread is fluctuating extremly on all of my 3 xiaos.

Hope anybody can help us.

Regards

The result of executing the sample code seems to be no problem as shown below. I just connected it with two jumper wires.
XIAO A1 pin <—> XIAO GND pin
XIAO A6 pin <—> XIAO 3V3 pin

Serial monitor is:

Reading Ground and VCC values with Analog Input
ADC(GND) = 0, ADC(VCC) = 4047
ADC(GND) = 0, ADC(VCC) = 4048
ADC(GND) = 0, ADC(VCC) = 4047
ADC(GND) = 0, ADC(VCC) = 4050
ADC(GND) = 0, ADC(VCC) = 4050
ADC(GND) = 0, ADC(VCC) = 4049
ADC(GND) = 0, ADC(VCC) = 4038
ADC(GND) = 0, ADC(VCC) = 4046
ADC(GND) = 0, ADC(VCC) = 4048
ADC(GND) = 0, ADC(VCC) = 4047
ADC(GND) = 0, ADC(VCC) = 4047
ADC(GND) = 0, ADC(VCC) = 4049

Hi,

my XIAO gives my this
ADC(GND) = 41, ADC(VCC) = 4090
ADC(GND) = 30, ADC(VCC) = 4095
ADC(GND) = 28, ADC(VCC) = 4093
ADC(GND) = 38, ADC(VCC) = 4093
ADC(GND) = 32, ADC(VCC) = 4094
ADC(GND) = 24, ADC(VCC) = 4086
ADC(GND) = 33, ADC(VCC) = 4095
ADC(GND) = 30, ADC(VCC) = 4082
ADC(GND) = 31, ADC(VCC) = 4094
ADC(GND) = 24, ADC(VCC) = 4094
ADC(GND) = 27, ADC(VCC) = 4086
ADC(GND) = 0, ADC(VCC) = 4092
ADC(GND) = 29, ADC(VCC) = 4069
ADC(GND) = 26, ADC(VCC) = 4094
ADC(GND) = 31, ADC(VCC) = 4089
ADC(GND) = 29, ADC(VCC) = 4091

And the second: (only XIAO on breadboard)
ADC(GND) = 17, ADC(VCC) = 4091
ADC(GND) = 17, ADC(VCC) = 4090
ADC(GND) = 20, ADC(VCC) = 4095
ADC(GND) = 18, ADC(VCC) = 4090
ADC(GND) = 17, ADC(VCC) = 4090
ADC(GND) = 15, ADC(VCC) = 4090
ADC(GND) = 16, ADC(VCC) = 4088
ADC(GND) = 16, ADC(VCC) = 4089
ADC(GND) = 19, ADC(VCC) = 4094
ADC(GND) = 17, ADC(VCC) = 4090
ADC(GND) = 18, ADC(VCC) = 4089
ADC(GND) = 21, ADC(VCC) = 4090
ADC(GND) = 15, ADC(VCC) = 4090
ADC(GND) = 19, ADC(VCC) = 4091
ADC(GND) = 17, ADC(VCC) = 4088
ADC(GND) = 18, ADC(VCC) = 4091
ADC(GND) = 17, ADC(VCC) = 4090
ADC(GND) = 17, ADC(VCC) = 4090
ADC(GND) = 18, ADC(VCC) = 4092
ADC(GND) = 22, ADC(VCC) = 4090
ADC(GND) = 17, ADC(VCC) = 4091
ADC(GND) = 19, ADC(VCC) = 4092
ADC(GND) = 18, ADC(VCC) = 4082
ADC(GND) = 20, ADC(VCC) = 4090
ADC(GND) = 13, ADC(VCC) = 4091
ADC(GND) = 15, ADC(VCC) = 4089
ADC(GND) = 19, ADC(VCC) = 4088
Only connected A7 to GND and A8 to 3.3

Have you tried SAMD_AnalogCorrection?
The ADC gain and offset correction values are calculated.

Hi, thanks! With this hint ( Code for the XIAO seem to need a pause after Serial.begin(9600), waiting for the serial port to be available.
Solution is to add this line after Serial.begin(9600):
while(!Serial);) the code was working and i could get an analog calibration ! Now its much better.GND is still jumping sometimes (80 to 100) but most of the measurements are correct now :slight_smile: