Soil moisture sensor


I want to use a soil moisture sensor in my project. Can I use it like that? Is my connections are right?

1 Like

Hi Larry.

Your connection is absolutely correct.

The sensor you’re using has one analog and one digital output. Always use analog output to read moisture level.

We also recommend you to use a capacitive soil moisture sensor to get more stable results in the long term.

Thanks. How to read analog inputs in Arduino IDE?

Larry, your sensor is connected to the GPIO 35 pin. So, use int analogVal = analogRead(35); command to read and store the analog value to analogVal variable. The maximum value analogRead() function return is 4095 since ESP32 has 12-bits of ADC resolution.

Ok, I’ll try. Thank you.

Mine is also working fine.


@Beray which sensor are you using? Any good sensor recommendations? I’m planning to make a smart self watering pot, so open to any ideas.

I use this one : DFROBOT Analog Capacitive Soil Moisture Sensor

1 Like

I bought a capacitive soil moisture sensor, and I got an ambient light sensor. How to get the soil temperature, do you have any suggestion? What kind of sensor is appropriate for soil and IoT Node? Thanks.

Hi @Larry.

You can use waterproof DS18B20 probes for soil temperature sensing. They work with one wire protocol so they can be integrated into your application quickly. Just add a 4.7K pull-up resistor to the data line.

1 Like