Hi, whenever I read voltages from a pin using analogRead() I get a value that is about 85% of the true voltage. The problem appeared when measuring battery voltages in a circuit, resulting in about 4.40 V for a true 5.1 V voltage (which is reduced to fit the 2V range of the ADC)
I’m using a custom board with the Artemis module, but I mounted a small testing circuit with a RedBoard Artemis Nano, getting the same results. The testing circuit applies a constant, 1V voltage to A0, and analogRead() returns 0.83-0.85 V after conversion.
This is the code:
void setup() {
Serial.begin(115200);
delay(10);
pinMode(A0);
analogReadResolution(14);
}
void loop() {
uint16_t meas = analogRead(A0);
Serial.print(meas); Serial.print(" ");
float volt = meas * 2.0 / 16384.0;
Serial.println(volt);
delay(1000);
}
The ouput is something like this:
6900 0.84
For 1V input analogRead() should return something near 8192 for a resolution of 14 bits, not values around 6900.
I tested it with Eclipse, the Arduino IDE and PlatformIO, getting the same results. Using other ADC pin doesn’t change anything. The problem persists also when other ADC resolutions are used.
The boards are updated to the last version, 1.1.1 at this moment.
Has anyone encountered the same issue?
Thanks,
David.