Hello everyone,
I recently encountered a surprising issue with the ADC on my Arduino Uno R4 WiFi. While attempting to measure a constant voltage, I noticed that the analogRead() function returns values that seem incorrect compared to my older Arduino Uno R3.
Below is the code I used.
void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT);
}
void loop()
{
int value = analogRead(A1);
double converted = value * 5.0 / 1023.0;
Serial.print("value = "); Serial.println(value);
Serial.print("converted = "); Serial.println(converted);
Serial.println("");
delay(1000);
}
When probing GND (wire from pin A1 to closest GND pin), and 5V, both Arduino's give the same result : value = 0 or value = 1023.
However, when probing the 3.3V pin, R4 result is incorrect :
- R3 :
value = 683,converted = 3.33 - R4 :
value = 725,converted = 3.54
This behavior is similar on all analog pins (from A0 to A5). Moreover, it also appears with different resolutions (12-bit or 14-bit).
I don't see any mentions of this behavior in the datasheet, nor in the Arduino UNO R4 WiFi ADC Resolution doc page.
Is this behavior expected on the Uno R4, and if so, can it be calibrated ? Or Do I have a defect board ?
Thanks a lot for your help.
Pierre