Automatic Irrigation System Using Arduino


Introduction: Automatic Irrigation System Using Arduino

Hello Everybody! I am Back with another Instructables!!

In this project i will be demonstrating Automatic Irrigation System with integrated temperature sensor which irrigates or waters your plants automatically. This system is best suited for drip irrigation technique.

A Moisture sensor is used to read the Moisture content of the soil. The LM35 Temperature Sensor reads the ambient temperature.

This System will help you to irrigate your backyard Garden or your Indoor Garden automatically and you need not worry about watering your favorite plants in your busy schedule.

An LCD is provided to monitor the Soil Status, Ambient Temperature and Status of Water supply(Water Pump).

Arduino UNO is the brain of this system and all the sensors and display devices are controlled by it.

I basically got the Idea of this project from Teacher in my University and could bring the Idea to Reality with the help of these Guys. I am really thankful to them.


The following Components are used in this project__________________________________________

* Arduino UNO

* Soil Moisture Sensor ( with LM393 Driver)

* LM 35 Temperature Sensor

* 16x2 LCD Display

* Water level Switch

* Speaker

* 5V Relay

* BC547 or similar NPN Transistors

* Resistors ( Refer Circuit Diagram)

* Potentiometer ( 10Kohm )

* 5mm LED

* 1N4007 Diode

* Terminal Strips and Screw Terminals


Step 2: Understanding the Working....

The Soil Moisture Sensor values depends on the resistance of the soil. The LM393 Driver is a dual differential comparator which compares the sensor voltage with fixed 5V supply voltage .

The value of this sensor varies from 0- 1023. 0 being most wet condition and 1023 being very dry condition.

The LM35 is a precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius temperature. The LM35 is operates at -55˚ to +120˚C.

The Water level Switch Contains a Reed-Magnetic Switch surrounded by a floating magnet. When water is available it Conducts.

The Arduino reads the status of the soil using Soil Moisture Sensor. If the Soil is DRY it does the following Operations....

1) Checks for the availability of water using water level sensor.

2) If the water is available, the Pump is turned ON and is automatically turned OFF when sufficient amount of water is supplied.

The Pump is Driven by a Relay driver circuit.

3) If the Water is Unavailable, you will be notified with a sound.

The Status of soil( Dry, Moist ,Soggy) , the temperature and the status of Pump is displayed on the LCD Screen.

Step 3: Building Up the System( Circuit Construction)

Pleas refer the circuit diagram and build the circuit accordingly.

The Arduino Connections are given below._________________________________________________________























I have built this project on the Printed Circuit Board. It can also be constructed on Breadboard.

I have designed the Arduino shield for this project and all the components like Led, relay, etc are embedded in the shield itself.

You can refer to my video and instructables on how to make a PCB in this link..

Step 4: Upload the Code to Arduino

The Arduino Code is written by me for the specific task of Automatic Irrigation.

This Software is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


1 Connect the Arduino to your computer.

2 Download the attached code and open it.

3 Select your COM Port and your Arduino Board from Tools Option.

4 Click Upload Botton.


The temperature id calculated using the following formula
X = ((Sensor value) * 1023.0)/ 5000

Temperature in Celsius =( X/10)

If you want to change the sensitivity of the sensor for different soil conditions alter the values of the 3 conditions commented in the Code.

Step 5: Testing and Implimentation

The following steps can be followed to test the project.

1) Connect the Arduino to power supply (5V) via USB or External power source.

2) Dip or bury the moisture sensor in the soil. Better place the sensor near the roots of plants for accurate measurements. Do not short the terminals.

3) Connect the Water pump to the Relay (N/O and Common terminals) and switch ON the mains. Refer the Circuit for connection details and pin out. WARNING: HIGH VOLTAGES . UNDERSTAND THE WIRING BEFORE YOU PROCEED.

4) The temperature sensor can be placed on the PCB itself or on the soil. Do not immerse the sensor in water.

Congratulations!!! You have successfully set up the system for irrigating your plants automatically!!!.

5) The potentiometer can be varied to adjust the LCD brightness.

If you come across any doubts feel free to let me know in the comments section.


HS Sandesh (a.k.a THE TECHNOCRAT)



    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest

    20 Discussions

    Great instructable, thank you; sketch uploaded but lcd just flashes every few seconds, any thoughts?

    Can we connect 0.25 hp waterpump instead of small pump you used??

    khank you :)

    Just one question that I wanna raise: Why do we need LM35 ?

    1 reply

    8 months ago

    the programm is giving redefination void setup() error. please help fast

    What is the use of transistor in the circuit will it cause any change without it ?

    1 reply

    The reason is you should not exceed the current rating of the micro controller (about 40mA here). Might cause the micro controller to shut down or damage it.
    So a transistor switch is required to operate the relay.

    Thank you

    what is use of LM35 Temperature sensor

    You can Connect any motor to the relay.
    Make Sure your relay is Rated for the Power Rating of your Motor Pump.

    another question where is the water level switch, and where can I get the switch and the pump from?

    1 reply

    U can get the pump from aquarium shop.. or any hardware store..Ask for fountain pump.

    I have read your instructables and I really thank you for this great effort.

    Just one question that I wanna raise: Why do we need LM393?

    5 replies

    Lm393 is a op amp comparator. It is used to measure the sensor resistance and output the proportional voltage (between 0v-5v). This output is fed to analog input of arduino.

    "The Soil Moisture Sensor uses capacitance to measure dielectric permittivity of the surrounding medium. In soil, dielectric permittivity is a function of the water content. The sensor creates a voltage proportional to the dielectric permittivity, and therefore the water content of the soil."
    I am sorry . I mentioned resistance instead of capacitance in other comment.


    Just one more thing: so the moisture sensor output is voltage, right???

    then can`t send the signal directly to the arduino without using LM393

    since Arduino itself has ADC in the analog pins???

    Sorry for troubling you ^_^

    Not exactly.. the moisture sensor does not output any voltage.. it's capacitance varies with moisture..
    Depending on that capacitance, The lm383 output voltage varies.
    The ADC on Arduino can read voltage.. so the lm393 is used.

    No troubles..U can leave a reply anytime.


    Please look for the code in step 4. The file name is " automatic_irrigation_system.ino"
    Circuit connections are given in step 3.
    Any doubts reply .