Code and Circuit Diagram for Automated Irrigation System using Arduino Uno

You can copy or paste the code from below.

int water; //random variable
void setup() {
pinMode(3,OUTPUT); //output pin for relay board, this will sent signal to the relay
pinMode(6,INPUT); //input pin coming from soil sensor
}void loop() {
water = digitalRead(6); // reading the coming signal from the soil sensor
if(water == HIGH) // if water level is full then cut the relay
{
digitalWrite(3,LOW); // low is to cut the relay
}
else
{
digitalWrite(3,HIGH); //high to continue proving signal and water supply
}
delay(400);
}
If you are getting a stray error then you can download the code from the link below

Yes click here 😉



CIRCUIT DIAGRAM

 

Leave a Reply

Your email address will not be published. Required fields are marked *