0
I hope I am just missing something simple here, but I have been banging my head on the desk for a while trying to solve this very simple problem that I can't seem to find a solution for online.
I have a seeed XIAO nrf52840 and I want to simply do an analogRead(A3)
.
The issue is that when I apply 3 volts, the output is 2.7 volts from this code below:
#include <Arduino.h>
float mv_per_lsb = 3300.0F / 1024.0F; // 10-bit ADC with 3.3V input range
void setup() {
Serial.begin(9600);
}
void loop() {
// read the input on analog pin 3:
int sensorValue = analogRead(A3);
// print out the value as mV:
Serial.println((float)sensorValue * mv_per_lsb);
delay(50); // delay in between reads for stability
}
I have tried other voltages and this is what I see:
INPUT: 0.5V OUTPUT: 0.47V
INPUT: 1.5V OUTPUT: 1.41V
INPUT: 3.3V OUTPUT: 3.05V
So it seems to be slightly more accurate on the lower range.
My setup is a power supply with ground connected to the GND pin on the nRF and the power connected directly to the A3 pin on the nRF. The nRF is being powered over USB.
What am I missing here?
I also confirmed with a volt meter that the voltage output from my bench power supply is outputting correct values. Lastly I tried a brand new nRF board, and got same result.