Soil Moisture Tester


Description

     In this project, we are going to measure the soil moisture using a Soil Moisture Sensor. The Soil Moisture Sensor measures the content of water inside the soil grace to the changes in electrical conductivity of earth and gives us the moisture level as output. The soil resistance increases when the soil gets dry. The electrical resistance is measured between the two electrodes of the sensor. A comparator activates a digital output when an adjustable threshold is exceeded. In this project an LED is turned ON when the value of the sensor is high and LED is turned OFF when the value of the sensor is low. Okay, let's do this.
       
Components Required

 1. Arduino UNO   * 1
 2. LED     * 1
 3. Resister(220 Ohm)  * 1
 4. Soil Moisture Sensor Module  * 1
 5. Jumper Wires  * 1

Circuit Diagram



Program

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
int soilsensor=0;

void setup()
 {
  Serial.begin(9600);
    lcd.begin(16, 2);
     lcd.setCursor(2,0);
   lcd.print("SOIL MOISTURE");
   lcd.setCursor(5,1);
      lcd.print("TESTER");
       delay(2500);
        lcd.clear();
}

void loop() 
{    
soilsensor=analogRead(A0);
Serial.println(soilsensor);

if(soilsensor>700)
{
  lcd.setCursor(3,0);
     lcd.print("NO Content");
delay(500);
}
if(soilsensor<500)
{lcd.setCursor(0,0);
  lcd.print("Moisture Content");
delay(700);
}
   lcd.clear();
  }