Soil Moisture Measurement using Arduino

Soil Moisture Sensor can be used to detect water level on the soil, if the soil moisture is depleted it will send a signal to HIGH or give corresponding analog output. This sensor uses two probes to pass the current through the soil, and it reads resistance to get the moisture level, the more water into the soil the more soil conduct the electricity easily. Less resistance if the soil is dry.

The module uses a LM393 precision voltages comparator capable of single or split supply operation.

Arduino Connections with Soil Moisture Sensor

Soil Moisture Arduino Connections
Soil Moisture Arduino Connections

Arduino Code for Soil Moisture Measurement

/*
  Soil Moisture Measurement
  www.circuits4you.com
*/

//the pins used:
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to

int sensorValue = 0;        // value read from the pot
int outputValue = 0;

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 100);    //maps the adc values to 0 to 100%
  
  // print the results to the serial monitor:
  Serial.print("Soil Moisture Level = ");
  Serial.print(outputValue);
  Serial.println(" %");

  delay(1000);
}

Result of Soil Moisture Measurement

Soil Moisture Measurement Result
Soil Moisture Result

Leave a Reply