So im trying to measure the correct voltage from an input stream on my analog pins. I already used a diode to restrict the maximum voltage to 5.0 volt. The problem is: The numbers that are measured and printed with Serial.print(), seem to be wrong. They are different values then the acutal ones. So for example: if we have 500 millivolts in reality, the arduino seem to measure something from 4.4-4.7 volt.
Anybody have an idea why this is happening? The code im using to measure the voltage is for example:
int closeposition = analogRead(A3);
// to convert it to volt
float closevoltage = closeposition * (5.0 /1023.0);
Is there anyhting that im not seeing that may be messing with the values?
Thank you in advance for all responses
Hi,
When you read your analog inputs are you reading each input twice then using the last value.
There is only ONE ADC in the Arduino and it is multiplexed to the inputs.
It takes time for the ADC to read the next channel that it is connected to and due to a capacitor on the ADC input there is some lag in the channel voltage stabilizing.
value = analogRead(analogPin);
value = analogRead(analogPin);
Just doing this should help.
What model Arduino are you using?
Can you please post a circuit diagram of your project?
Please not a Fritzy image, a hand drawn schematic will be fine.
You really need to look at using the internal voltage reference , which ever way you do it , you will get the best result if you calibrate it against a known voltage