Soil Moisture Sensor Interfacing with Arduino UNO

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

154.5k views1 min readUpdated Apr 17, 2023
Soil Moisture Sensor Interfacing with Arduino UNO

Overview of Soil Moisture

 

Soil Moisture Sensor
Soil Moisture Sensor

 

Soil moisture is basically the content of water present in the soil. This can be measured using a soil moisture sensor which consists of two conducting probes that act as a probe. It can measure the moisture content in the soil based on the change in resistance between the two conducting plates.

The resistance between the two conducting plates varies in an inverse manner with the amount of moisture present in the soil.

For more information about soil moisture sensor and how to use it, refer the topic Soil Moisture Sensor in the sensors and modules section.

 

Connection Diagram of Soil Moisture with Arduino

Interfacing Soil Moisture Sensor With Arduino UNO
Interfacing Soil Moisture Sensor With Arduino UNO

 

 

 

Measure soil moisture using Arduino Uno

Here, the analog output of soil moisture sensor is processed using ADC. The moisture content in terms of percentage is displayed on the serial monitor.

The output of the soil moisture sensor changes in the range of ADC value from 0 to 1023.

This can be represented as moisture value in terms of percentage using formula given below.

Analog Output = \frac{ADCValue}{1023}

Moisture in percentage = 100 – (Analog output * 100)

For zero moisture, we get maximum value of 10-bit ADC, i.e. 1023. This, in turn, gives 0% moisture.

 

Soil Moisture Code for Arduino Uno

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 = ");
  Serial.print(moisture_percentage);
  Serial.print("%\n\n");
  delay(1000);
}

 

​​​​​

Video of Soil Moisture measurement using Arduino Uno

Components Used

Powered byMouser Electronics

Downloads

Comments5

Join the discussion — share a question or tip.

  • SO

    How it is different from already existing project

  • AM
    AmeerKhan

    Whats is ideal moisture level for plants in weather conditions say ranging from 35-55 C

  • KE
    kelvindeog20

    good

  • JE
    jeevankumarvatturi

    I interfaced soil moisture sensor to automatic watering on plants but how to get the humidity data from cloud using pubnub ?? To planting with automatic watering system http://bigbelectronics.in/product.php?product=soil-moisture-meter-testing-humidity-water-sensor-hygrometer-detection-module-arduino-3-5-inch-multicolour

  • RA
    ratnasravyaguntuku

    I interfaced soil moisture sensor to know the humidity at soil I interfaced the sensor with Arduino nano I want to push the data with thingspeak but the humidity of soil to crop the agriculture plurpose projet any body provide the code thank you http://bigbelectronics.in/product.php?product=soil-moisture-meter-testing-humidity-water-sensor-hygrometer-detection-module-arduino-3-5-inch-multicolour