0.4-0.5V on analog inputs


I have tested a soil moisture sensor (YL38 - YL69) which is based on measuring the voltage. On the analog input I must get values between 0 and 4095, but I’m getting values between 1500 and 4095. After disconnecting the sensor I’m getting the values between 1500 and 1600. I measured the voltage on all analog inputs/outputs and is between 0.4 and 0.5V without anything connected.

In the setup() I’m setting the A0 to INPUT and in the loop() with analogRead I’m reading the analog input.

Why is influencing the measurements the 0.5V and after setting the A0 to INPUT, why is doesn’t decrease to 0V?

Thank and best regards.

You should not use pinMode() for analogRead() and a floating (not connected) pin will always give you odd readings.
The bias you get with your volt meter may well be due to the way the ADC works with an internal pre-charged (aprox 3.3V / 2) cap, but doesn’t influence your reading unless your sensor’s output impedance is too high.

1 Like