Hey guys, we are back with a new project. In this article, we will share with you how to make a smart irrigation system. This irrigation system is useful for watering the plants as it calculates the amount of moisture present in the soil and then proceeds to the further commands. We are using a relay module to control the water pump. This system can work automatically and there is no need for interference. We are sharing the detailed working of this project. For more information regarding this project please visit the original post of this project and also bookmark TECHATRONIC.COM as all my further projects and tutorials will be pre-uploaded there.
We are using two soil moisture sensors that can sense the moisture content of the soil and send the output data to the Arduino. Place the soil moisture sensors in the soil. If the soil is dry that means the plants need some water so the sensor sends the signals to the Arduino. The Arduino sends the signals to the relay module and the water pump is turned on for some time. You can change the time by modifying the code. If all the water from the water pump will stay in a specific position/place then there is a chance that crops may destroy. To overcome this problem we are using a servo motor that can rotate the pipe from one position to other in a loop.
Smart irrigation system Components required:-- Arduino Uno
- Servo motor
- Soil moisture sensor
- mini water pump
- jumper wires.
- Relay module
- Breadboard
This is the circuit diagram for this project. Make the connections according to this diagram.
Smart irrigation Arduino CodeNOTE: This is the code for the project, upload this to the Arduino.
#include <Servo.h> // servo library
Servo myservo;
int m=0;
int n=0;
int pos = 0;
void setup()
{
// put your setup code here, to run once:
pinMode(A0, INPUT_PULLUP); // Soil Moisture Sensor 1 PIN A0
pinMode(A1, INPUT_PULLUP); // Soil Moisture Sensor 1 PIN A1
pinMode(8,OUTPUT); // Relay Module PIN D8
Serial.begin(9600); // Sensor Buart Rate
myservo.attach(9); // Servo PIN D9
digitalWrite(8, HIGH); // Relay Normally Hight for OFF condition
}
void loop()
{
// put your main code here, to run repeatedly:
int m= analogRead(A0); // Soil Moisture Sensor 1 PIN A0
int n= analogRead(A1); // Soil Moisture Sensor 1 PIN A1
Serial.println(m);
delay(10);
Serial.println(n);
delay(200);
if (m>=980)
{
myservo.write(90); // tell servo to go to position in variable 'pos'
digitalWrite(8, LOW); // Relay ON
delay(1000);
}
else if(m<=970)
{
digitalWrite(8, HIGH); // Relay ON
}
if (n>=980)
{
myservo.write(0); // tell servo to go to position in variable 'pos'
digitalWrite(8, LOW); // Relay ON
delay(1000);
}
else if(n<=970)
{
digitalWrite(8, HIGH); // Relay OFF
}
else
{
digitalWrite(8, HIGH); // Relay OFF
}
}
HAPPY LEARNING!
Comments