Project tutorial
Arduino Irrigation System

Arduino Irrigation System © CC BY-NC-SA

In this project we want to make an automatic irrigation system with Arduino.

  • 24 respects

Components and supplies

Necessary tools and machines

Laser cutter (generic)

Apps and online services

About this project

Have you ever wanted beautiful plants in your garden?

L’A.I.S, acronym for Arduino Irrigation System, can irrigate the plants in your home to a defined environmental condition, because you mustn’t irrigate them whenever you want.

When the environmental conditions are correct, and it's the correct hour, l’A.I.S will irrigate.

How We Made It

We made it in two distinct parts: the “brain”, that control the system, and the irrigation part, that irrigate the plants.

The Brain

The brain was made with the school’s laser cutter and 6 mm plywood.

First, we thought about how we could make the tank for Arduino and the sensors. We decided to make it with a dovetail. After we drew it with AutoCAD Mechanical, we exported the file and we cut it.

We assembled it and we pasted with Vinavil, after that we made all the electric parts.

The Irrigation Part

The irrigation part was made with a slab of laminated timber, cut with a copping saw.

First, we thought about the structure and we decided to screw the parts without any kind of glue. We increased the height of a part because the water needed to climb down from the tank to the plant’s vase.

We stick “the brain” on the structure and we tested it.

Temperature Sensor

We used the temperature sensor because we want to restrict the ambient conditions that could damage the plant, like irrigation with elevated temperature.

If the temperature is over the limit that you chose, the system will not irrigate.

Real Time Clock

The DS3231 is a low-cost, highly accurate Real Time Clock which can maintain hours, minutes and seconds, as well as day, month and year information.

When the hours and the minutes are the same, you will choose when the system starts.


Keypad is used to change the system variable. If you press the “1” key, you change the hour that the system will start. If you press the “4” key, you change the minute that the system will start. If you press the “7” key, you change the limit temperature over which you mustn’t irrigate.

LCD Monitor

The LCD monitor allows you to know what system variable that you can change with the keypad.

In the first line, we will see the hour at which the irrigation starts (Sh) and the current hour (Ch). In the second line we will see the limit temperature (Tl), and the current temperature (Tm).

The potentiometer is used to change the visibility of the LCD display.

Solenoid Valve

The solenoid valve is using to stop the water if it isn’t time to irrigate. We decided to use a solenoid valve because is easier than use a pump.

The solenoid valve is connected to the power supply and the relay, when it is time to irrigate, Arduino will change the state of the relay and in doing so the state of the solenoid valve.


#include <Wire.h>  //real time clock sensor library
#include <DS3231.h>
#include <LiquidCrystal.h> //LCD monitor library
#include <Keypad.h>  //keypad library

DS3231 clock;
RTCDateTime dt;
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);   // initialize the library with the numbers of the interface pins

const byte ROWS = 4; //four rows
const byte COLS = 1; //one column
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
byte rowPins[ROWS] = {6, 5, 4, 3}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

int ThermistorPin = A0; // Temperature sensor
int relaypin = 13; //relay pin

int Vore = 0;   //time, in hours
int Vmin = 0;   //time, in minutes
int Vtemp = 0;  //limit temperature
int VOfin = 0;  //end time, in hour
int VMfin = 0;  //end time, in minutes
int Vo = 0;     //conversion

float R1 = 10000;  //temperature sensor variables
float logR2, R2, T, Tc, Tf;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void setup() {
  clock.setDateTime(__DATE__, __TIME__);  //set up the real time clock sensor
  pinMode (ThermistorPin, INPUT);
  pinMode (relaypin, OUTPUT);
  lcd.begin(16, 2);   // set up the LCD's number of columns and rows:
  lcd.setCursor(0, 0);     //reset the lcd monitor
  lcd.print ("         ");
  lcd.setCursor(0, 1);
  lcd.print ("         ");

void loop() {
  Vo = analogRead(ThermistorPin); // reading the temperature and conversion in celsius
  R2 = R1 * (1023.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (c1 + c2 * logR2 + c3 * logR2 * logR2 * logR2));
  Tc = T - 273.15;
  dt = clock.getDateTime();   //reading the time from the  RTC DS3231
  char customKey1 = customKeypad.getKey();  //reading the keypad key
  if (customKey1 == '1' ) { // change of time 
    Vore = Vore + 1;
    if (Vore > 23) {
      Vore = 0;
  if (customKey1 == '2' ) {
    Vmin  = Vmin + 1;
    if (Vmin > 59) {
      Vmin = 0;
  if (customKey1 == '3' ) { //change of temperature
    Vtemp = Vtemp + 1;
    if (Vtemp > 40) {
      Vtemp = 0;
  lcd.setCursor(0, 0);   // set the cursor to column 0, line 0
  lcd.print ("Sh");      //print the time that it will start (start hour)
  lcd.print (Vore);      
  lcd.print("  Ch");   //print the current time (current hour)
  lcd.print (dt.hour);
  lcd.print (":");
  lcd.setCursor(0, 1);   // set the cursor to column 0, line 1
  lcd.print ("Tl ");     //print the limit temperature
  lcd.print (Vtemp);
  lcd.print(" Tm ");     //print the current temperature
  lcd.print (Tc);
  if ((dt.hour == Vore) && (dt.minute == Vmin)) {   //condition for irrigation
    if (Tc < Vtemp) {
      digitalWrite (relaypin, HIGH);      //start irrigate
      if (dt.second < 50) {
        VMfin = Vmin + 2;
        VOfin = Vore;        //set the final time of irrigation
        if (VMfin > 60) {
          VMfin = VMfin - 60;
          VOfin = Vore + 1;
          if (VOfin == 24) {
            VOfin = 0;
        delay(50000);      //delay to allow the correct calculation of the final time of irrigation, because we need to calculate it one time and not more//
  else if ((dt.hour == VOfin) && (dt.minute == VMfin)) {
    digitalWrite (relaypin, LOW);   //stop irrigate at final time of irrigation
  else {
    delay(120);   //delay to refresh the LCD monitor

Custom parts and enclosures

laser cutter file
laser cutter file
laser cutter file
laser cutter file




Similar projects you might like

Arduino Keyless Door Lock System with Keypad and LCD

Project tutorial by DIY Hacking

  • 43 respects

Home Plant Watering System

Project tutorial by Alexander

  • 42 respects

Integrated HOME Irrigation System

by Hernanduino

  • 17 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 75 respects

Automated Irrigation System Using Cayenne

Project in progress by Jhonnatan Garcia

  • 32 respects

Smart Home Automation And Security System Using 1Sheeld

Project tutorial by Team SADEE

  • 25 respects
Add projectSign up / Login