Project in progress
Automatic garden irrigator (AGI)

Automatic garden irrigator (AGI) © CC BY-NC-SA

By analyzing atmospheric values, this tiny unit can decide when to irrigate your garden if it is necessary.

  • 2,663 views
  • 0 comments
  • 11 respects

Components and supplies

Necessary tools and machines

welder

Apps and online services

Ide web
Arduino IDE
fritzing

About this project

Irrigating the garden is a tiring and repetitive job. My idea is to build a small central unit which can check weather and soil conditions. Then this unit will decide wether irrigate the garden, optimizing water consumption but at the same time obtaining the best results from the vegetables.

The most important things that the system will monitor are: temperature, sunlight and humidity of the soil. These three things are very important when you have to irrigate your garden. There mustnt' be too cold cause it could freeze the plants or too hot risking to burn them. Watering when the sunlight is very intense could burn the vegetables too. Then, for example, if it rained one hour ago, irrigating means wasting water.

For a best monitoring of weather conditions i added a DHT11 (humdity sensor). All the values collected by the system will be showed on the display connected to arduino. It will be possible to switch all the values by pushing an integrated button which will be change the information showed on the display.

Nevertheless if it seems to have all the necessary for this project, i wanted to add also a RC module for monitoring the time. This is an optimization choice cause it's obvious that the best conditions for watering the garden, if it has not rained for a while, are between 18.00 to 22.00/23.00 (6pm to 11pm) and from 8.00 to 10.00 (8am to 10 am).

Reference & contacts

Daniel Rossi

My YouTube Channel

https://www.youtube.com/channel/OfficialProjecto

Code

AGI codeC/C++
#include <LiquidCrystal.h>
#include <Wire.h>
#include "RTClib.h"

#define TEMP A5 //LM35
#define H1 A0 //igrometro 1
#define H2 A1 //igrometro 2
#define H3 A2 //igrometro 3
#define H4 A3 //igrometro 4
#define H5 A4 //igrometro 5
#define HUM 5 //umidità
#define LHT 6 //intensità luminosa
#define BTN 4 //controllo display
#define MOTOR 12 //pompa acqua
#define SDA 10 //sda rtc
#define SCL 11 //scl rtc

int x = 0;
bool innaffiato = false;
LiquidCrystal lcd (8, 9, 3, 2, 1, 0);
RTC_DS1307 rtc;



void setup() {
  lcd.begin(16, 2);
  Serial.begin(9600);
  rtc.begin();
  Wire.begin();

  lcd.setCursor(0, 0);
  lcd.print("initialization");
  lcd.setCursor(0, 1);
  lcd.print("please wait");

  pinMode(TEMP, INPUT);
  pinMode(H1, INPUT);
  pinMode(H2, INPUT);
  pinMode(H3, INPUT);
  pinMode(H4, INPUT);
  pinMode(H5, INPUT);
  pinMode(HUM, INPUT);
  pinMode(LHT, INPUT);
  pinMode(BTN, INPUT);
  pinMode(MOTOR, OUTPUT);
  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(__DATE__, __TIME__));
  }
  else
  {
    //    rtc.DateTime(2018, 04, 18, 11, 55, 0);
  }

  delay(1000);
  lcd.clear();
}

void loop() {
  DateTime _now = rtc.now();
  float t = analogRead(TEMP) / 2.046;
  float hyg1 = map(analogRead(H1), 1023, 350, 0, 100);
  float hyg2 = map(analogRead(H2), 1023, 350, 0, 100);
  float hyg3 = map(analogRead(H3), 1023, 350, 0, 100);
  float hyg4 = map(analogRead(H4), 1023, 350, 0, 100);
  float hyg5 = map(analogRead(H5), 1023, 350, 0, 100);
  float hm = map(analogRead(HUM), 1023, 350, 0, 100);
  float light = map(analogRead(LHT), 1023, 350, 0, 100);

  if (digitalRead(BTN) == HIGH)
    x++;
  if (x >= 9)
    x = 0;
  switch (x)
  {
    case 1:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Temperatura");
      lcd.setCursor(0, 1);
      lcd.print(t + '%'); //1 temperatura
      break;
    case 2:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("igrometro 1");
      lcd.setCursor(0, 1);
      lcd.print(hyg1 + '%');
      break;
    case 3:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("igrometro 2");
      lcd.setCursor(0, 1);
      lcd.print(hyg2 + '%');
      break;
    case 4:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("igrometro 3");
      lcd.setCursor(0, 1);
      lcd.print(hyg3 + '%');
      break;
    case 5:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("igrometro 4");
      lcd.setCursor(0, 1);
      lcd.print(hyg4 + '%');
      break;
    case 6:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("igrometro 5");
      lcd.setCursor(0, 1);
      lcd.print(hyg5 + '%');
      break;
    case 7:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Umidita");
      lcd.setCursor(0, 1);
      lcd.print(hm + '%');
      break;
    case 8:
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Luminosita");
      lcd.setCursor(0, 1);
      lcd.print(light + '%');
      break;
  }
  if (((light < 25) && (innaffiato == false)) && ((hyg1 < 30) || (hyg2 < 30) || (hyg3 < 30) || (hyg4 < 30) || (hyg5 < 30)) && ((_now.hour() > 17) && (_now.hour() < 23)))
    digitalWrite(MOTOR, HIGH);

  if ((hyg1 > 80) && (hyg2 > 80) && (hyg3 > 80) && (hyg4 > 80) && (hyg5 > 80))
  {
    digitalWrite(MOTOR, LOW);
    innaffiato = true;
  }
  if (_now.hour() == 1)
    innaffiato = false;
}

Schematics

schematics of AGI
Orto bb de7ec9itma

Comments

Similar projects you might like

Smart Garden

Project showcase by patel Dipen

  • 62,522 views
  • 20 comments
  • 110 respects

Lazy Indoor Garden

Project in progress by londonium2021

  • 34,454 views
  • 23 comments
  • 124 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Autoshack

  • 74,686 views
  • 23 comments
  • 174 respects

Soil Moisture Sensor With LCD Display

Project tutorial by Patel Darshil

  • 58,385 views
  • 19 comments
  • 86 respects

Mini GreenHouse 1.20X0.60X0.60

Project showcase by Billy King

  • 50,692 views
  • 27 comments
  • 183 respects

Automatic Watering System

Project tutorial by PRosenb

  • 40,809 views
  • 28 comments
  • 98 respects
Add projectSign up / Login