Description: In this project we are handling Water pump through Soil Moisture Sensor.When Soil is wet pump is OFF and when Soil becomes dry then your water pump is ON and your field is now wet.Here we show very Basic Explanation of Smart Irrigation System or can see our video as well for Better understanding.This could be your very first step to start with Smart Irrigation System project understanding and more.It is assumed that you already have downloaded latest version of Arduino IDE. If not , you can download it from here .Click For Downloading- > Arduino IDE.
Components: Arduino -UNO,Soil Moisture Sensor,Relay Module,Water Pump,Battery(9V).
Pin Diagram: Do the following connection which is shown in the image and also we had provided a chart for a better understanding.


Step 2:Open Arduino.ide and copy paste the below code
Code:-
/* Welcome to Gnd_to_Vcc */
int sensor_pin =A0; //Soil Sensor input at Analog PIN A0
int output_value;
void setup() // put your setup code here, to run once
{
pinMode(4,OUTPUT);
Serial.begin(9600);
Serial.println(“Reading From the Sensor…”);
delay(2000);
}borderbr
//put your main code here,to run repeatedly:
void loop()
{
output_value= analogRead(sensor_pin);
output_value=map(output_value,500,10,0,100);
Serial.print(“Moisture :”);
Serial.print(output_value) ;
Serial.println(“%”);
if(output_value<0)
{
digitalWrite(4,HIGH);
}
else
{
digitalWrite(4,LOW);
}
delay(1000);
}
Step 3:After copy paste. Select right Board that is Arduino-UNO and right com Port which you have plug in and then compile and Upload code to arduino.
Step 4: Dip your Soil Sensor in wet soil first and after that open your Serial Monitor for your output.Along with that just notice your water pump which will be OFF.
Output on Serial Monitor will appear as shown in the Image and it will be negative because we have set output value <0 when output pin which is pin 4 is high.
if(output_value<0)
{
digitalWrite(4,HIGH);
}
Step 5: Now remove soil moisture sensor from wet soil and dip it into dry soil and after that open your serial monitor and you will see the readings and it will be opposite of the previous reading.Along with that you will notice that water pump which was off is now ON automatically.
Your Output value will turn to positive when you execute Step 5.
{
digitalWrite(4,LOW);
}

Can u tell how to connect the components
LikeLike
You can refer to the pin diagram or refer YouTube video!
LikeLike
Can u send me the link ? Of youtube
LikeLike