Sie sind auf Seite 1von 2

WORKING EXPLANATION:

Moisture sensor senses the volumetric water content in soil. After inserting a probe into
soil for approximately 60 seconds, it starts feeding the controller with some live
moisture data. Code was written in such a way that Arduino decides the cutoff level of
Dry soil and Wet soil using the data provided by the the sensor.

Once Arduino decides whether the soil was in Wet or Dry condition it will decide either
to activate the water pump. If the sensor reading indicates that the soil is dry it will
activate a simple DC motor which will pump the water to soil. By this way the moisture
in the soil will be maintained indefinitely. A little help, here is an Intructable to build
your own water pump using a simple DC motor.

For those who are really worried about your plants. Here is a feature that might delight
you. I have added a GSM module which is intended to notify users upon the motor and
plat care status. When the moisture sensor senses low moisture content, the motor gets
on and the message displays on lcd screen. In addition this message will also be sent to
user number which is programmed in the Arduino code.

PROJECT SETUP:
 Different soils retain moisture level differently so i suggest you to test your soil
nature and set the moisture value accordingly.
 Upload the below code into your Arduino.
 Fix the moisture sensor into the dry soil where your plants are planted
 Turn the system ON, you will see the soil moisture in LCD.
 In my project i have taken 50 as cutoff value for dry soil but if you feel differently
about your soil you can change the this cutoff value after testing it.
 This will be helpful in case if you feel that this automatic plant watering system
is feeding plants more/less frequently. Changing the value in line 22 will
customize this project as per your requirements

CODE:
#include<LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
float temp;
int SENSE= A0; // Soil Sensor input at Analog PIN A0
int value= 0;
void setup()
{
Serial.begin(9600);
lcd.begin(16,2);
pinMode(7, OUTPUT);
Serial.println("SOIL MOISTURE SENSOR");
Serial.println("-----------------------------");
}
void loop()
{
value= analogRead(A0);
value= value/10;
lcd.setCursor(2,1);
lcd.print(value);
Serial.println(value);

if(value>50)
{
digitalWrite(7,HIGH);
lcd.setCursor(0,0);
lcd.print("motor on");
void SendMessage();
delay(1000);
}

else
{
digitalWrite(7,LOW);
lcd.setCursor(0,0);
lcd.print("motor off");
void SendMessage2();
}
delay(1000);
}

void SendMessage()
{
Serial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile
number
delay(1000);
Serial.println("motor on");// The SMS text you want to send
delay(100);
Serial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}

void SendMessage2()

{
Serial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
Serial.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile
number
delay(1000);
Serial.println("motor off");// The SMS text you want to send
delay(100);
Serial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}

Das könnte Ihnen auch gefallen