Soil Moisture Sensor Guide with Arduino Interfacing

Overview of Soil Moisture Sensor

  • Soil moisture sensor consist of two conducting plates which function as a probe and acting as a variable resistor together.
  • When the sensor is inserted into the water, the resistance will decrease and get better conductivity between plates.
This is the picture of Soil Moisture Sensor
Soil Moisture Sensor


How Does Soil Moisture Sensor Work?

This is the picture of Soil Moisture Sensor Working Principle
Working principle of soil moisture sensor


  • The above figure shows the working principle of the soil moisture sensor.
  • Soil moisture sensor has two conducting plates. First plate is connected to the +5Volt supply through series resistance of 10K ohm and second plate is connected directly to the ground.
  • It simply acts as a voltage divider bias network, and output is taken directly from the first terminal of the sensor pin, which is shown in figure above.
  • The output will change in the range of 0 – 5 Volt, in proportion with change in content of water in the soil.
  • Ideally, when there is zero moisture in soil, the sensor acts as open circuit i.e. infinite resistance. For this condition, we get 5V at the output.


Specification of Soil Moisture Sensor

  • Operating Voltage: The voltage range is 3.3V to 5V DC.
  • Operating Current: 15mA
  • Output Type: The type of output that the sensor generates, such as analog voltage or digital signals.
  • Connectivity: The type of connector or interface that the sensor uses to connect to the controller or computer.
  • IC Used: LM393 IC is used as a comparator.
  • Indicator: Two LED Indicators are used one for Power and one for Output


Alternate options for Soil Moisture Sensor

  1. Tensiometers: Tensiometers measure the tension or pressure in the soil that is created by the water.
  2. Time Domain Reflectometry (TDR): TDR measures the time it takes for an electromagnetic pulse to travel through the soil.
  3. Neutron Probe: A neutron probe measures soil moisture by using a radioactive source that emits neutrons.


Soil Moisture Sensor interfacing with Arduino

Interfacing Soil Moisture Sensor With Arduino UNO
Soil Moisture Sensor interfacing with Arduino


Soil Moisture Measurement Code for Arduino

const int sensor_pin = A1;   /* Soil moisture sensor O/P pin */

void setup(){
 Serial.begin(9600);  /* Define baud rate for serial communication */

void loop(){
 	float moisture_percentage;
 	int sensor_analog;
 	sensor_analog = analogRead(sensor_pin);
 	moisture_percentage = ( 100 - ( (sensor_analog/1023.00) * 100 ) );
 	Serial.print("Moisture Percentage = ");


The output of the code will be the percentage value of soil moisture level measured by the soil moisture sensor connected to analog pin A1. The code will continuously read the analog value from the sensor, calculate the moisture percentage using a formula, and print it to the serial monitor.

To know more about Soil Moisture Sensor using Arduino refer to this link


Examples of Soil Moisture Sensor interfacing

  1. Soil Moisture Sensor Interfacing with ATmega16
  2. Soil Moisture Sensor Interfacing with Arduino
  3. Soil Moisture Sensor Interfacing with TI Launchpad
  4. Soil moisture Sensor interfacing with NodeMCU
  5. Soil moisture Sensor interfacing with ESP32
  6. Soil moisture Sensor interfacing with ARM MBED

Components Used

Soil Moisture Sensor
Soil moisture sensor is used to measure the water content (moisture) in soil. It is used in agriculture applications, irrigation and gardening systems, etc.