Just a beginner question, can I use the 5 volt rail as the external voltage reference on the arduino nano? It seems to be more stable than the internal voltage reference.
or should i just map the exact value like this?
int fiveVolts=4723;
void setup() {
pinMode(A1, INPUT);
Serial.begin(9600);
}
void loop() {
int digitalVal= analogRead(A1);
int analogVal= map(digitalVal,0,1023,0,fiveVolts);
Serial.println(analogVal);
delay(100);
}
szevlin:
Just a beginner question, can I use the 5 volt rail as the external voltage reference on the arduino nano? It seems to be more stable than the internal voltage reference.
The 5volt supply is already used as reference by default.
You won't have to do anything for that.
Which sensor you are using.
Many sensors (pots) are ratiometric. Absolute voltage does not matter, and default is the most stable setting.
But if you want to measure 'voltage', you need a stable reference. The Nano has a built-in 1.1volt Aref for that.
Study ratiometric vs absolute measurements.
Leo..