Mutaz AlwakilNARENDRANS_al7yTeja KanagalaAmro khalidOsman Gamal
Published

Future Irrigation System

This system keeps track of the moisture in the soil, temperature, humidity, light, and rain, while watering and blowing air when needed.

ExpertWork in progress7 hours419
Future Irrigation System

Things used in this project

Hardware components

DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Arduino Uno Rev3
Seeed Studio Arduino Uno Rev3
×1
3V-5V 0.2A Cooling Fan for RPi with Screws
×1
Rain Sensor Module
×1
Moisture Sensor Module
×1
Grove- light sensor v1.2
×1
Micro Submersible Water Pump DC 3V-5V
×1
Breadboard 16.5x5.5cm (830 Holes)
×1
ESP8266 ESP-01
Espressif ESP8266 ESP-01
×1
ESR01 USB Programmer Adapter
×1
3.7V 3350mAh 18650 Li-Ion Battery
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×2

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Code

Watering System

Arduino
#define MOISTUREPIN A2       // Digital pin connected to the moisture sensor
#define PUMP 5 
 //Moisture and Water level

  int moistureValue = analogRead(MOISTUREPIN);  // Read moisture sensor value

  // Check if the soil moisture is below a certain threshold
  if (moistureValue < 1) {   // Adjust the threshold value as per your requirement
    digitalWrite(PUMP, HIGH);  // Turn on the second relay (pump)
    lcd.clear();
    lcd.print("Water Pump");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched On ");
    delay(2000);
  } else {
    digitalWrite(PUMP, LOW);   // Turn off the second relay (pump)
    lcd.clear();
    lcd.print("Water Pump");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched Off ");
    delay(2000);
  }
  lcd.clear();
  lcd.print("Moisture: ");
  lcd.print(moistureValue);
  delay(2000);

Environmental Control System

Arduino
#define DHTPIN 4             // Digital pin connected to the DHT11 sensor
#define FAN 6                // Digital pin connected to fan 
DHT dht(DHTPIN, DHT11);

void setup()
{

   dht.begin();
    
  // Debug console
  Serial.begin(115200);

  pinMode(FAN, OUTPUT);             // Set FAN pin as an output
  pinMode(LEDPIN2, OUTPUT);         // Set LED2 pin as an output
  pinMode(PUMP, OUTPUT);            // Set PUMP pin as an output
  /* Start the DHT11 Sensor */
  dht.begin();
  pinMode(MOISTUREPIN, OUTPUT);     // Set the Mositurepin as an output
  pinMode(LEDPIN, OUTPUT);          // Set LED pin as an output
//DHT11 and fan 
  float temperature = dht.readTemperature();  // Get the temperature value
  float humidity = dht.readHumidity();  // Get the Humidity value

  // Check if the temperature is above a certain threshold
  if (temperature > 10) {   // Adjust the threshold value as per your requirement 
    digitalWrite(FAN, HIGH);   // Turn on the first relay (fan) (the relays work inversely i.e. Low - On) 
    lcd.clear();
    lcd.print("Fan");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched On ");
    delay(2000);
  } else {
    digitalWrite(FAN, LOW);    // Turn off the first relay (fan)
    lcd.clear();
    lcd.print("Fan");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched off ");
    delay(2000);
  }
  // initialize the LCD
  lcd.begin();

  // Turn on the backlight and print a message.
  lcd.backlight();
  
  lcd.clear();
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print(" C");
  delay(2000);

  lcd.clear();
  lcd.print("Humidity: ");
  lcd.print(humidity);
  delay(2000);

Smart Irrigation System

Arduino
its made to connect to gui with wifi and measure raindrops, humidity & temperature, light intensity, moisture while in control of the fan and the pump
/*************************************************************
  WARNING!
    It's very tricky to get it working. Please read this article:
    http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware

  You’ll need:
   - Blynk IoT app (download from App Store or Google Play)
   - Arduino Uno board
   - Decide how to connect to Blynk
     (USB, Ethernet, Wi-Fi, Bluetooth, ...)

  There is a bunch of great example sketches included to show you how to get
  started. Think of them as LEGO bricks  and combine them as you wish.
  For example, take the Ethernet Shield sketch and combine it with the
  Servo example, or choose a USB sketch and add a code from SendData
  example.
 *************************************************************/
/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID           "TMPL6EhAtYMAx"
#define BLYNK_TEMPLATE_NAME         "MSES IOT"
#define BLYNK_AUTH_TOKEN            "LTy3TmX6zd0qLTyEVTgPsxo-pMTl_USo"


#include "DHT.h"
#include <Wire.h>
#include <LiquidCrystal_I2C.h>


/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#define VIRTUAL_PIN_TEMPERATURE V1
#define VIRTUAL_PIN_HUMIDITY V2


#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "posh_life_2.4Ghz";
char pass[] = "123456789";

// Hardware Serial on Mega, Leonardo, Micro...
//#define EspSerial Serial1

// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(2, 3); // RX, TX

// Your ESP8266 baud rate:
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);


#define DHTPIN 4             // Digital pin connected to the DHT11 sensor
#define FAN 6                // Digital pin connected to fan 

DHT dht(DHTPIN, DHT11);

void setup()
{

   dht.begin();
    
  // Debug console
  Serial.begin(115200);

  pinMode(FAN, OUTPUT);             // Set FAN pin as an output
  pinMode(LEDPIN2, OUTPUT);         // Set LED2 pin as an output
  pinMode(PUMP, OUTPUT);            // Set PUMP pin as an output
  /* Start the DHT11 Sensor */
  dht.begin();
  pinMode(MOISTUREPIN, OUTPUT);     // Set the Mositurepin as an output
  pinMode(LEDPIN, OUTPUT);          // Set LED pin as an output

  // initialize the LCD
  lcd.begin();

  // Turn on the backlight and print a message.
  lcd.backlight();

  // Set ESP8266 baud rate
  EspSerial.begin(ESP8266_BAUD);
  delay(10);

  //Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass);
  // You can also specify server:
  Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(BLYNK_AUTH_TOKEN, wifi, ssid, pass, IPAddress(192,168,1,100), 8080);
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!

  //DHT11 and fan 
  float temperature = dht.readTemperature();  // Get the temperature value
  float humidity = dht.readHumidity();  // Get the Humidity value

  // Check if the temperature is above a certain threshold
  if (temperature > 20) {   // Adjust the threshold value as per your requirement 
    digitalWrite(FAN, HIGH);   // Turn on the first relay (fan) (the relays work inversely i.e. Low - On) 
    lcd.clear();
    lcd.print("Fan");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched On ");
    delay(2000);
  } else {
    digitalWrite(FAN, LOW);    // Turn off the first relay (fan)
    lcd.clear();
    lcd.print("Fan");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched off ");
    delay(2000);
  }

   //Moisture and Water level

  int moistureValue = analogRead(MOISTUREPIN);  // Read moisture sensor value

  // Check if the soil moisture is below a certain threshold
  if (moistureValue < 1) {   // Adjust the threshold value as per your requirement
    digitalWrite(PUMP, HIGH);  // Turn on the second relay (pump)
    lcd.clear();
    lcd.print("Water Pump");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched On ");
    delay(2000);
  } else {
    digitalWrite(PUMP, LOW);   // Turn off the second relay (pump)
    lcd.clear();
    lcd.print("Water Pump");
    lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
    lcd.print("Switched Off ");
    delay(2000);
  }

  //Raindrop and LED

  int raindropValue = analogRead(RAINDROP_ANALOG);  // Read raindrop module value

  // Check if it is raining based on raindrop module reading
  if (raindropValue < 500) {   // Adjust the threshold value as per your requirement
    Serial.println("Rain detected!");  // Display a message on the serial monitor
    digitalWrite(LEDPIN2, HIGH);  // Turn on the LED
  } else {
    digitalWrite(LEDPIN2, LOW);   // Turn off the LED
    }

  //LightSensor Grove

  int lightValue = analogRead(LIGHTPIN);  // Read light sensor value

  if (lightValue < 300) {  // Adjust the threshold value as per your requirement
    digitalWrite(LEDPIN, HIGH);  // Turn on the LED
  } else {
    digitalWrite(LEDPIN, LOW);   // Turn off the LED
  }

     // Send sensor values to Blynk gauges
  Blynk.virtualWrite(VIRTUAL_PIN_TEMPERATURE, temperature);
  Blynk.virtualWrite(VIRTUAL_PIN_HUMIDITY, humidity);

  lcd.clear();
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print(" C");
  delay(2000);

  lcd.clear();
  lcd.print("Humidity: ");
  lcd.print(humidity);
  delay(2000);

  lcd.clear();
  lcd.print("Moisture: ");
  lcd.print(moistureValue);
  delay(2000);

  lcd.clear();
  lcd.print("Raindrop: ");
  lcd.print(raindropValue);
  delay(2000);

  lcd.clear();
  lcd.print("Light Sensor");
  lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
  lcd.print("Value: ");
  lcd.print(lightValue);
  delay(2000);
  
  delay(2000);
}

Light Tracking System

Arduino
define LIGHTPIN A0          // Analog pin connected to the Grove light sensor
#define LEDPIN 13            // Digital pin connected to the LED
//LightSensor Grove

  int lightValue = analogRead(LIGHTPIN);  // Read light sensor value

  if (lightValue < 300) {  // Adjust the threshold value as per your requirement
    digitalWrite(LEDPIN, HIGH);  // Turn on the LED
  } else {
    digitalWrite(LEDPIN, LOW);   // Turn off the LED
  }

 lcd.clear();
  lcd.print("Light Sensor");
  lcd.setCursor(0, 1); // Set cursor to the first column (0) and second row (1)
  lcd.print("Value: ");
  lcd.print(lightValue);
  delay(2000);

Raindrop Tracking System

Arduino
#define RAINDROP_ANALOG A1   // Analog pin connected to the raindrop module
#define LEDPIN2 12           // Digital pin connected to the LED
 //Raindrop and LED

  int raindropValue = analogRead(RAINDROP_ANALOG);  // Read raindrop module value

  // Check if it is raining based on raindrop module reading
  if (raindropValue < 500) {   // Adjust the threshold value as per your requirement
    Serial.println("Rain detected!");  // Display a message on the serial monitor
    digitalWrite(LEDPIN2, HIGH);  // Turn on the LED
  } else {
    digitalWrite(LEDPIN2, LOW);   // Turn off the LED
    }
    
  lcd.clear();
  lcd.print("Raindrop: ");
  lcd.print(raindropValue);
  delay(2000);

Credits

Mutaz Alwakil

Mutaz Alwakil

1 project • 0 followers
NARENDRAN

NARENDRAN

18 projects • 14 followers
S_al7y

S_al7y

1 project • 0 followers
Teja Kanagala

Teja Kanagala

0 projects • 0 followers
Amro khalid

Amro khalid

0 projects • 0 followers
Osman Gamal

Osman Gamal

0 projects • 0 followers

Comments

Add projectSign up / Login