Moisture sensors
Different types of sensors
There are two different types of moisture sensors:
- resistive sensors, measuring the resistance between two electrodes which changes with humidity
- capacitive sensors, where the change in capacitance is measured.
Resistive sensors
For resistive sensors, I found again two types:
The sensor on the left, using a PCB to implement the electrodes, should be avoided because electrolysis happens when a current flows from one electrode to the other in a humid environment, dissolving the electrodes in just a few days of operation.
Capacitive sensors
There are plenty of these sensors on the market, and they all look pretty much the same. However, quite a number of them have serious design flaws, as explained in this YouTube video:
https://www.youtube.com/watch?v=IGP38bz-K48.
The principle of how to convert the change of capacitance into a signal level is also explained in the video. Here is the circuit diagram of the sensor for reference:
Software
The software for these sensors is rather simple, as they provide an analogue signal, inversely proportional to the moisture in the soil. The software must therefore simply read out an ADC channel.
The plot shows a value of ~ 1000 measured when the sensor was inserted into a glass of water and ~ 2500 when it was removed. These values lay in the linear range of the ESP32 ADC.
--
Uli Raich - 2022-07-31