Shaukatali HusseinSaid KassimSahil Abdulalim
Published © GPL3+

Automated Irrigation System

Providing a low cost system to assist small holder farmers with monitoring and watering their crops

BeginnerFull instructions provided3 hours317
Automated Irrigation System

Things used in this project

Hardware components

Grove - Ultrasonic Ranger
Seeed Studio Grove - Ultrasonic Ranger
×1
Grove - 2-Channel SPDT Relay
Seeed Studio Grove - 2-Channel SPDT Relay
×1
Water pump
×2
Grove - Soil Moisture Sensor
Seeed Studio Grove - Soil Moisture Sensor
×1
Arduino UNO
Arduino UNO
×1
Base Shield V2
Seeed Studio Base Shield V2
×1
9V battery (generic)
9V battery (generic)
×2

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Tape, Clear
Tape, Clear
Hot glue gun (generic)
Hot glue gun (generic)
styrofoam sheet
Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

Wiring Schematic

Instead of the DC motors connect the water pumps PS: wasn't able to find them while making the circuit diagram. As for the relay, I've labeled the parts where to connect them

Code

Irrigation_code_generic_ultrasonic.ino

Arduino
Using the generic ultrasonic sensor
int moist_pin = A0;
int relay1 = 11;
int relay2 = 10;
int trigpin=13;
int echopin=12;
int led1 = 9;
long distance,duration;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(led1,OUTPUT);
pinMode(relay1,OUTPUT);
pinMode(relay2,OUTPUT);
pinMode(moist_pin,INPUT);
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(trigpin,LOW);
delayMicroseconds(10);
digitalWrite(trigpin,HIGH);
delayMicroseconds(12);
digitalWrite(trigpin,LOW);
delayMicroseconds(10);

duration=pulseIn(echopin,HIGH);
distance=((duration/2)*0.034);

int moist =analogRead(moist_pin);

Serial.print("water level is ");
Serial.print(distance);
Serial.print(" ");
Serial.print("moisture is ");
Serial.println(moist);
delay(200);

if(moist>=0 && moist<=300){
  digitalWrite(relay1,HIGH);
}
else{         
  digitalWrite(relay1,LOW);
}
if(distance>=5 && distance<=11){
  digitalWrite(relay2,LOW);
  digitalWrite(led1,HIGH);
}
else{
  digitalWrite(relay2,HIGH);
  digitalWrite(led1,LOW);
}

}

automated irrigation system code

Arduino
Using the seed grove ultrasonic sensor
#include<Ultrasonic.h>

Ultrasonic ultrasonic(7);

int moist_pin = A0;
int relay1 = 11;
int relay2 = 10;

int led1 = 13;


void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
pinMode(led1,OUTPUT);
pinMode(relay1,OUTPUT);
pinMode(relay2,OUTPUT);
pinMode(moist_pin,INPUT);


}

void loop() {
  
  // put your main code here, to run repeatedly:

long distance;
distance = ultrasonic.MeasureInCentimeters();

int moist =analogRead(moist_pin);
Serial.println(moist);
delay(100);

if(moist>=0 && moist<=300){
  digitalWrite(relay1,HIGH);
}
else{         
  digitalWrite(relay1,LOW);
}
if(distance>=5 && distance<=11){
  digitalWrite(relay2,LOW);
  digitalWrite(led1,HIGH);
}
else{
  digitalWrite(relay2,HIGH);
  digitalWrite(led1,LOW);
}
}

Credits

Shaukatali Hussein

Shaukatali Hussein

7 projects • 10 followers
Said Kassim

Said Kassim

1 project • 4 followers
I really love robotics
Sahil Abdulalim

Sahil Abdulalim

5 projects • 8 followers
Tech enthusiast...not much to say😂

Comments