Table of Contents

Play Video

IOT BASED SMART AGRI AND IRRIGATION SYSTEM

This smart agriculture system uses NODE MCU for connectivity, DHT11 sensor to monitor temperature and humidity, soil moisture sensor to check water levels in the soil, and a relay module to control the water pump. It all connects through Blynk cloud for easy monitoring and control, ensuring crops get the right amount of water for better growth and efficiency.

This smart agriculture and irrigation system employs several key components to automate and optimize farming practices. It includes the NODE MCU (WI-FI module) for handling data communication, the DHT11 sensor for monitoring temperature and humidity levels in the environment, a soil moisture sensor to sense the water content in the soil, a relay module for controlling the water pump, and Blynk cloud for remote monitoring and control.

Components Description:

  1. NODE MCU: This is a  microcontroller unit based on the ESP8266 WiFi module, enabling wireless communication and IoT capabilities.
  2. DHT11 Sensor: It is a basic, low-cost digital temperature and humidity sensor that provides reliable data for environmental monitoring.
  3. Soil Moisture Sensor: Typically uses capacitive or resistive methods to measure the water content in the soil, crucial for determining irrigation needs.
  4. Relay Module: Acts as a switch to control the water pump based on signals received from the microcontroller, allowing automated irrigation based on soil moisture readings.
  5. Blynk Cloud: A platform that facilitates IoT applications by providing a user-friendly interface to monitor and control connected devices remotely via smartphones or computers.

Working Principle:

The system operates by continuously monitoring environmental conditions using the DHT11 sensor for temperature and humidity and the soil moisture sensor for soil water content. These sensors send data to the NODE MCU, which processes the information and decides whether irrigation is necessary based on predefined thresholds.

When the soil moisture falls below a set level indicating dryness, the NODE MCU activates the relay module, triggering the water pump to supply water to the crops. This automation ensures that plants receive optimal irrigation without human intervention, improving crop yield and conserving water resources.

Blynk Cloud Integration:

To monitor and control the system remotely, Blynk cloud plays a crucial role. Users can create a graphical interface (dashboard) on the Blynk app to display real-time temperature, humidity, and soil moisture data. This involves setting up virtual pins on the Blynk platform, which correspond to the sensor readings sent by the NODE MCU.

By configuring widgets (such as gauges or graphs) on the Blynk app, farmers can easily visualize and track environmental conditions affecting their crops. Additionally, Blynk allows setting alerts or notifications based on sensor thresholds, ensuring timely actions to maintain optimal growing conditions.

In summary, this IoT-based smart agriculture and irrigation system leverages NODE MCU, DHT11 sensor, soil moisture sensor, relay module, and Blynk cloud to automate irrigation processes, enhance crop growth, and facilitate remote monitoring and control for efficient farming practices.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <SimpleTimer.h>

// Blynk Auth Token
char auth[] = "YourBlynkAuthToken";

// WiFi credentials
char ssid[] = "YourWiFiSSID";
char pass[] = "YourWiFiPassword";

// DHT11 sensor settings
#define DHTPIN D3
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

// Soil moisture sensor settings
#define SOIL_MOISTURE_PIN A0

// Relay settings
#define RELAY_PIN D0

// Timer for periodic updates
SimpleTimer timer;

// Function to read sensors and send data to Blynk
void sendSensorData() {
  // Reading temperature and humidity from DHT11
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  
  // Reading soil moisture value
  int soilMoistureValue = analogRead(SOIL_MOISTURE_PIN);
  
  // Sending data to Blynk
  Blynk.virtualWrite(V1, t); // Temperature
  Blynk.virtualWrite(V2, h); // Humidity
  Blynk.virtualWrite(V3, soilMoistureValue); // Soil Moisture
  
  // Printing data to Serial Monitor
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.print(" °C, Humidity: ");
  Serial.print(h);
  Serial.print(" %, Soil Moisture: ");
  Serial.println(soilMoistureValue);
  
  // Control relay based on soil moisture value
  if (soilMoistureValue < 500) { // Adjust threshold value as needed
    digitalWrite(RELAY_PIN, LOW); // Turn on the pump
    Blynk.virtualWrite(V4, 1); // Update Blynk app
  } else {
    digitalWrite(RELAY_PIN, HIGH); // Turn off the pump
    Blynk.virtualWrite(V4, 0); // Update Blynk app
  }
}

void setup() {
  // Starting serial communication
  Serial.begin(9600);
  
  // Blynk connection
  Blynk.begin(auth, ssid, pass);
  
  // DHT sensor initialization
  dht.begin();
  
  // Relay pin setup
  pinMode(RELAY_PIN, OUTPUT);
  digitalWrite(RELAY_PIN, HIGH); // Keep relay off initially
  
  // Setting up timer to read sensors every 5 seconds
  timer.setInterval(5000L, sendSensorData);
}

void loop() {
  Blynk.run();
  timer.run();
}
Scroll to Top