Soil moisture sensor, weird readings
It looks like you're trying to measure the resistance of soil by connecting an ADC input through the soil to VCC.  That is not the way to to it.

At the moment you effectively have this schematic for that portion:







simulate this circuit &ndash; Schematic created using CircuitLab

The voltage dropped across the soil is proportional to the current flowing through it. And there is no current flowing through it1 because there's no path to ground, only the very high impedance of the ADC.

So you never see anything except VCC (or a floating input when the probe is not in the ground).

To measure a resistance like that you have to have it as one half of a potential divider, just like you would for an LDR.







simulate this circuit

What actual value R2 should have depends entirely on the resistance range detected by your probe. It can be good to experiment with different values until you find one that works for you.



1: Actually there is some small leakage current through the ADC to ground, but that is so tiny we can ignore it.