Autonomous Irrigation System




This is an Autonomous Irrigation System which has the capability to detect the soil's moisture and keep the plant hydrated.

*This is my first instructable.

Things required:

*DC 3 V-6 V Micro Submersible Mini Water Pump.

*Aquarium Flexible Silicone Air Tube.


*Arduino UNO.

*Relay Module With Optocoupler.

*Soil moisture sensor.

*Jumper Wires

So,let's get making!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Making Connections.................

*Connect the Moisture Sensor to Pin 2.

*Connect the Relay module to Pin 3.

*Connect the Green Led to pin 4.

*Connect the Red Led to pin 5.

Step 2: Let's Get Coding..........

/***************************************************************************** AUTOMATIC IRRIGATION SYSTEM***************************************************************************/

  int SENSOR=2;//Moisture sensor is connected to Pin 2.  
int RELAY=3;//Relay is connected to Pin 3.
  int LED1=4;//Green LED is connected to Pin 4. 
 int LED2=5;//Red LED is connected to Pin 5.  
int VAL=0;//Will be used to store the value of the sensor. 
 void setup(){   //Configuring the pins as INPUT and OUTPUT.  
 pinMode(LED1,OUTPUT);//Set the Green LED as OUTPUT. 
  pinMode(LED2,OUTPUT);//Set the Red LED as OUTPUT.  
 pinMode(RELAY,OUTPUT);//Set the Relay Module as OUTPUT.   
pinMode(SENSOR,INPUT);//Set the Moisture Sensor as INPUT.  

 Serial.begin(9600);//Start the communication at 9600 baud.  }
 void loop(){   VAL=digitalRead(SENSOR);//Fetch the INPUT from the Moisture Sensor and store it.  
 Serial.println(VAL);//Print the INPUT gathered from the Moisture Sensor.  
 //Check whether the INPUT  is HIGH or LOW. 
  if(VAL==LOW){     digitalWrite(LED2,HIGH);//Turn on the Red LED.   
  digitalWrite(LED1,LOW);//Turn off the Green LED.   
  digitalWrite(RELAY,HIGH)//Turn on the PUMP.   
  Serial.println("DONE!!!!!!!")//Print the quoted text.    
 delay(10000);//Stop the pump for 10 Seconds.   }else{   
  digitalWrite(LED2,LOW);//Turn off the Red LED.    
 digitalWrite(LED1,HIGH);//Turn on the Green LED.  
   digitalWrite(RELAY,LOW)//Turn off the PUMP.  
   Serial.println("WATERING!!!!!!!")//Print the quoted text. 

delay(10000);//Delay between reads.
  } }

*Please Note:If the code doesn't work then please feel free to comment.

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Be the First to Share


    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    10 Discussions

    Ayush Aryakenpachi_dono

    Reply 4 months ago

    Check the 9th box from the top and you'll see something like :
    VAL = digitalRead(SENSOR), this records data and stores it in Arduino's memory.

    There are three pools of memory in the microcontroller used on avr-based Arduino boards :
    • Flash memory (program space), is where the Arduino sketch is stored.
    • SRAM (static random access memory) is where the sketch creates and manipulates variables when it runs.
    • EEPROM is memory space that programmers can use to store long-term information.
    To be more specific, I think it's SRAM where input data is stored.
    Happy tinkering :)
    Ayush AryaArielR39

    Reply 1 year ago

    I am from Jharkhand ,India.
    To be more precise from Bokaro Steel City.

    Where do you come from?

    Hi I have uploaded the photo
    I hope you will like it.
    And there are a few changes in the code
    Is now,

    Ayush Arya

    1 year ago

    If you have any problem you can post it in the comment section .
    I will surely look into it.
    Happy coding..☺️☺️☺️

    Ayush Arya

    1 year ago

    there are a few changes in the code
    Is now,