I'm having a small problem with my soil moisture sensor

it gives me weird readings, in the second the smallest connection is made between the legs it just gives me 4096 (which is max possible value), its either about 0 or 4095

I can't really seem to see the problem, any help is appreciated

(the output voltage is read on an ESP32, almost visible in the bottom of the image) enter image description here

  • 1
    And what is your soil monitor?
    – Majenko
    Commented Mar 26, 2020 at 20:00
  • not sure what your question is, but I'm reading the output voltage on an ESP32 Commented Mar 26, 2020 at 20:09
  • The output voltage of what? How is it wired? What is your schematic?
    – Majenko
    Commented Mar 26, 2020 at 20:10
  • the output of the sensor, one leg has 3.3v going in, the other leg is wired to a GPIO pin Commented Mar 26, 2020 at 20:13
  • do you want the full schematic? Commented Mar 26, 2020 at 20:14

1 Answer 1


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 – 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.