The soil moisture sensor or the hygrometer is usually used to detect the humidity of the soil. So, it is perfect to build an automatic watering system or to monitor the soil moisture of your plants. The sensor is set up by two pieces: the electronic board (at the right), and the probe with two pads, that detects the water content (at the left).
The sensor has a built-in potentiometer for sensitivity adjustment of the digital output (D0), a power LED and a digital output LED, as you can see in the following figure.
The voltage that the sensor outputs changes accordingly to the water content in the soil.
When the soil is:
Wet: the output voltage decreases
Dry: the output voltage increases
The output can be a digital signal (D0) LOW or HIGH, depending on the water content. If the soil humidity exceeds a certain predefined threshold value, the modules outputs LOW, otherwise it outputs HIGH. The threshold value for the digital signal can be adjusted using the potentiometer. The output can also be an analog signal and so you’ll get a value between 0 and 1023.
The advantages and disadvantages:
1. Can be connected to a range of DC loggers (DC Output signal)
2. Relatively inexpensive when compared to other measurements
3. Accurate after specific soil calibration
1. Only covers a small sensing area
2. Requires good contact between the soil and the sensor
3. Installation requires care to ensure there are no air gaps
4. Larger sensitivity to temperature, clay content and air gaps than other sensor types
MOISTURE SENSOR WITH ARDUINO.
In this example, you’ll read the analog sensor output values using the Arduino and print those readings in the Arduino IDE serial monitor.
Upload the following sketch to your Arduino board:
int rainPin = A3;
int greenLED = 5;
int redLED = 6;
// you can adjust the threshold value int thresholdValue = 800;
// read the input on analog pin 3:int sensorValue = analogRead(rainPin);Serial.print(sensorValue);
if(sensorValue < thresholdValue)
Serial.println(” – Doesn’t need watering”);
Serial.println(” Time to water your plant”);
Open the Arduino IDE serial monitor to see the values. Then, try your sensor in a wet and in a dry soil and see what happens.