Soil Moisture


The Soil Moisture Sensor [Product Link] can be used to test the moisture of soil.


Soil Moisture Sensor with PCB and wires
Soil Moisture Sensor with PCB and wires
  • Potentiometer for adjustable sensitivity
  • Digital and Analog Output
  • Fixed bolt hole for convenient installation
  • Power indicator and digital output LEDs
  • Operating Voltage: 3.3-5V


This module sensor module package consists of has 2 parts- a Sensor part, and a PCB for output and sensitivity control.

The sensitivity control PCB has 4 pins (Vcc GND, D0, A0) on one side, and 2 pins on the other where the sensor will be connected. For following details, the potentiometer side of the PCB will be ‘top side’. The Sensor (YL-69) has only 2 pins. The sensor side with ‘YL-69’ written on it will be considered ‘top side’.

When looking at both from the top side, the Sensor’s right pin has to be connected to the PCB’s left pin (marked with the GND symbol), and the Sensor’s left pin, is connected to the PCB’s right pin.

When there is Soil water shortage, the module outputs a HIGH value. This sensor can be used with the DC Submersible Pump [Product Link] in gardening systems. When soil moisture is less than the set threshold, Do outputs HIGH value; When soil moisture is more than the set threshold, module D0 outputs LOW value.

The analog output A0 gives a more accurate value of the soil moisture and can be used to monitor the system till a particular value is reached and then turn on the pump if the value drops below a certain point.

The digital output can be directly connected to a Chineduino Uno Rev3 [Product Link] to detect the HIGH and LOW values. The digital output can also be connected to a Piezo Buzzer [Product Link], etc. which can form a soil moisture alarm system. Take care that the 2 pins of the Sensor are never submerged in the water, typically keeping the water level below the black portion of the Sensor.

// Code by Jasmeet Singh for
int Dpin0=5; //Digital Pin 5 connected to D0
int Apin0=1; //Analog Pin 1 connected to A0
int Apinval;

void setup()
pinMode(Dpin0, INPUT);

void loop()
Serial.print("D0 Value:");
Serial.println(digitalRead(Dpin0)); // Read Digital Pin
Serial.print("A0 Value:");
Apinval=analogRead(Apin0); // Read Analog Pin for Moisture Sensor Value


Arduino and Soil Moisture Sensor working example [Video Link]

Possible Application Areas

1. Self Watering Plant System [Link]

Did you create a project using this product? Leave details/links below!


So empty here ... leave a comment!

Leave a Reply

Your email address will not be published. Required fields are marked *