Smart Agricultural Monitoring

Published: February 23, 2025 10 min read

🌱 Key Concept

The Smart Agriculture Monitoring System is an IoT-based solution that integrates Arduino Uno with various sensors to monitor and control agricultural conditions in real-time. The system collects environmental data including soil moisture, temperature, humidity, and light conditions, then processes this information to provide alerts and automated actions, optimizing farming operations.

Key Benefits:

  • Real-time monitoring of key environmental factors
  • Automated irrigation based on soil moisture
  • Early detection of adverse conditions
  • Reduced water usage and operational costs

🔧 Components Required

Arduino Uno

Microcontroller that processes sensor data and controls components

LED Indicators

Red, Green, Blue LEDs to indicate different system states

Temperature Sensor

TMP36 sensor for measuring ambient temperature

Buzzer

Provides audible alerts for critical conditions

LCD Display

Shows real-time sensor readings and status messages

Relay Module

SPDT relay for controlling the DC motor/pump

Soil Moisture Sensor

Measures soil moisture content for irrigation control

Light Sensor (LDR)

Detects ambient light levels for day/night monitoring

DC Motor

Simulates an irrigation pump or mechanical farming task

🔌 Connections

Important Wiring Instructions

  • Ensure all components are properly grounded to prevent electrical noise and interference.
  • Connect power supplies correctly to avoid short circuits and component damage.
  • Follow the pin mapping carefully to ensure correct sensor readings.
  • Use appropriate resistors for LEDs and other components to prevent damage.

📜 Circuit Diagram

Circuit Diagram
Click to enlarge

Circuit Explanation

The circuit diagram shows the complete wiring setup for the Smart Agricultural Monitoring system. The Arduino Uno serves as the central controller, with various sensors connected to analog pins for data collection. Digital pins control the LED indicators, buzzer, and relay module. The system uses a common ground and 5V supply from the Arduino for most components, with the DC motor powered separately through the relay module.

🔍 Prototype Overview

Prototype Overview
Click to enlarge

Physical Setup

The prototype is constructed on a breadboard for easy testing and modification. The Arduino Uno is the central component with sensors and actuators arranged for optimal functionality. The LED indicators are positioned for clear visibility, while the LCD display shows real-time data readings.

Operational Features

This model demonstrates real-time monitoring of soil moisture, temperature, and light conditions. When soil moisture falls below the threshold, the system activates the water pump (DC motor) automatically. The buzzer provides alerts for critical conditions, enhancing the system's ability to prevent crop damage.

💻 Arduino Code

Complete source code for the Smart Agricultural Monitoring System:


#include <DHT.h>

// Define sensor pins
#define DHTPIN 12       // DHT sensor data pin
#define DHTTYPE DHT11   // DHT sensor type
#define LDR_PIN A0      // LDR sensor analog pin
#define SOIL_SENSOR A1  // Soil moisture sensor analog pin
#define RELAY_PIN 13    // Relay for Motor control (Pump)
#define BUZZER 9        // Buzzer pin

// LED Indicators
#define RED_LED 3       // Dry Soil
#define GREEN_LED 4     // Moderate Moisture
#define YELLOW_LED 5    // Wet Soil
#define TEMP_LED 6      // High Temperature
#define LIGHT_LED 7     // Light Condition

DHT dht(DHTPIN, DHTTYPE);

void setup() {
    Serial.begin(9600);
    dht.begin();
    
    pinMode(LDR_PIN, INPUT);
    pinMode(SOIL_SENSOR, INPUT);
    pinMode(RELAY_PIN, OUTPUT);
    pinMode(BUZZER, OUTPUT);
    pinMode(RED_LED, OUTPUT);
    pinMode(YELLOW_LED, OUTPUT);
    pinMode(GREEN_LED, OUTPUT);
    pinMode(TEMP_LED, OUTPUT);
    pinMode(LIGHT_LED, OUTPUT);
    
    digitalWrite(RELAY_PIN, HIGH); // Relay OFF initially (Active LOW)
}

void loop() {
    float temp = dht.readTemperature();
    float humidity = dht.readHumidity();

    if (isnan(temp) || isnan(humidity)) {
        Serial.println("DHT sensor error!");
        return;
    }

    int lightValue = analogRead(LDR_PIN);
    int soilValue = 1023 - analogRead(SOIL_SENSOR);

    Serial.print("Temp: "); Serial.print(temp);
    Serial.print("C  Humidity: "); Serial.print(humidity);
    Serial.print("%  Light: "); Serial.print(lightValue);
    Serial.print("  Soil Moisture: "); Serial.println(soilValue);

    // Soil Moisture Control
    if (soilValue < 300) {  
        digitalWrite(RED_LED, HIGH);
        digitalWrite(YELLOW_LED, LOW);
        digitalWrite(GREEN_LED, LOW);
        digitalWrite(RELAY_PIN, HIGH);
        digitalWrite(BUZZER, HIGH);
        delay(500);
        digitalWrite(BUZZER, LOW);
    } 
    else if (soilValue < 700) {  
        digitalWrite(RED_LED, LOW);
        digitalWrite(GREEN_LED, HIGH);
        digitalWrite(YELLOW_LED, LOW);
        digitalWrite(RELAY_PIN, LOW);
    } 
    else {  
        digitalWrite(RED_LED, LOW);
        digitalWrite(GREEN_LED, LOW);
        digitalWrite(YELLOW_LED, HIGH);
        digitalWrite(RELAY_PIN, LOW);
        tone(BUZZER, 2050);
        delay(500);
        noTone(BUZZER);
    }

    // Temperature Alert
    if (temp > 35) { 
        digitalWrite(TEMP_LED, HIGH);
        digitalWrite(BUZZER, HIGH);
        delay(500);
        digitalWrite(BUZZER, LOW);
    } else {
        digitalWrite(TEMP_LED, LOW);
    }

    // Light Condition
    digitalWrite(LIGHT_LED, lightValue > 800 ? LOW : HIGH);

    delay(2000);
}

This Arduino code implements a comprehensive agricultural monitoring system that reads data from multiple sensors, processes the information, and controls various output devices. The system monitors soil moisture, temperature, humidity, and light conditions to automate irrigation and provide alerts for critical conditions.

🎥 Prototype Simulation

Setup Demonstration

The video shows the complete hardware setup and connection process for the Smart Agricultural Monitoring system.

Working Demonstration

Watch the system respond to different soil moisture, temperature, and light conditions in real-time.

Code Explanation

The video includes a walkthrough of the Arduino code, explaining how different components interact and respond to sensor inputs.

📱 Share on LinkedIn

Prolayjit Biswas

Prolayjit Biswas

IoT Developer | Electronics Engineer

12h • 🌎

Excited to share my latest IoT project: Smart Agricultural Monitoring System! 🌱

This Arduino-based solution helps farmers monitor soil moisture, temperature, and light conditions in real-time, automating irrigation when needed. The system uses multiple sensors and provides alerts for critical conditions through visual and audible indicators.

Tech stack: • Arduino Uno • DHT11 Temperature/Humidity Sensor • Soil Moisture Sensor • Light Sensor (LDR) • Relay Module for Pump Control

Check out the full project documentation on my portfolio: [link]

#IoT #Agriculture #SmartFarming #Arduino #Sustainability

Project Preview
154
42 comments • 28 shares

💬 Comments

Leave a Comment

User

John Doe

March 15, 2025

This is an impressive project! I've been looking for an affordable solution to monitor my small garden. Have you considered adding Wi-Fi connectivity to send the data to a mobile app?

User

Emma Wilson

March 12, 2025

The project looks great! As an agricultural engineer, I've been working on similar systems. What threshold values are you using for soil moisture to trigger irrigation? I found that different crops have vastly different requirements.

Author
Prolayjit Biswas (Author)

March 12, 2025

Thanks, Emma! You're absolutely right about crop-specific requirements. For this prototype, I've set the threshold at 300-700 range for moderate moisture, but the code is designed to be easily configurable. I'm working on adding a UI component where users can adjust thresholds for different crops.

User

Michael Chen

March 10, 2025

Have you considered adding a solar panel to make this truly off-grid? I'm working on similar systems for remote agricultural monitoring and power is always a concern.

👨‍💻 About the Author

Prolayjit Biswas

Prolayjit Biswas

IoT Developer & Electronics Engineer

Prolayjit is an experienced IoT developer with a passion for creating smart solutions for real-world problems. With a background in Electronics Engineering and over 5 years of experience in embedded systems development, he specializes in agricultural technology and environmental monitoring systems.

Areas of Expertise:

Arduino Raspberry Pi IoT Prototyping Sensor Networks PCB Design AgTech

🔗 Related Projects

Smart Irrigation System

Smart Irrigation System

Automated water management solution using soil sensors and weather data

View Project
Greenhouse Automation

Greenhouse Automation

Complete climate control and monitoring system for greenhouses

View Project
Crop Disease Detection

Crop Disease Detection

AI-powered camera system to identify plant diseases early

View Project
×