Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation



๐ŸŒพ IoT-Enabled Smart Agriculture Monitoring System

Enterprise-grade Agritech telemetry platform featuring real-time environmental sensing, automated irrigation control loops, Python-based digital twin simulation, and a premium React dashboard

License Hardware Backend Frontend Analytics Status



๐Ÿ“Œ Table of Contents


๐Ÿ” Overview

The IoT-Enabled Smart Agriculture Monitoring System is a comprehensive, end-to-end Agritech solution engineered to continuously monitor farm microclimates and automate irrigation infrastructure.

By integrating a five-sensor arrayโ€”measuring temperature, humidity, soil moisture, ambient light, and water tank levelsโ€”the system dynamically actuates water pumps based on highly tuned hysteresis control loops.

The architecture supports dual-mode operation:

  1. Physical Edge Deployment: Utilizing Arduino/ESP32 microcontrollers for real-world hardware actuation.
  2. Digital Twin Simulation: A sophisticated Python physics engine that mathematically models diurnal cycles and soil desiccation, allowing for software-centric development and UI testing without physical hardware constraints.

Telemetry is visualized through a premium, glassmorphism-styled React + Vite operational dashboard, providing facility managers with real-time analytics, historical trends, and critical environmental alerts.


โ— Problem Statement

Traditional agriculture relies heavily on manual field inspections and timer-based irrigation systems, resulting in profound operational inefficiencies and resource waste.

Operational Issue Business & Environmental Impact
Water Waste Blind, schedule-based irrigation over-waters crops and depletes local reservoirs.
Crop Loss Lack of real-time temperature/humidity tracking leads to irreversible heat stress or frost damage.
Labor Inefficiency Manual daily inspection of expansive acreage is highly labor-intensive and non-scalable.
Equipment Failure Running water pumps dry (due to empty reservoir tanks) destroys expensive hardware.

Data-driven smart farming solves these architectural flaws. By transitioning from reactive, manual schedules to proactive, telemetry-driven event loops, deployed systems typically achieve 30โ€“40% water conservation while eliminating the need for routine physical field audits.


๐Ÿš€ Core Features

Edge Sensing & Actuation

  • Multi-Sensor Array: Acquisition of Temperature, Humidity, Soil Moisture, Light Intensity, and Tank Volume.
  • Automated Irrigation: 5V Relay actuation directly tied to soil desiccation thresholds.

Simulation & Data Engineering

  • Mathematical Digital Twin: Python models replicate diurnal temperature variations, exponential soil moisture decay, and Poisson-distributed tank refill events.
  • Hysteresis Control Logic: Advanced pump regulation to prevent mechanical oscillation/chattering near threshold boundaries.
  • Safety Interlocks: Hard-coded algorithmic overrides that disable pump actuation if the primary water reservoir falls below 10% capacity.

Operations Dashboard

  • Real-Time Web UI: Ultra-fast React 18 application bundled with Vite.
  • Interactive Timeseries: Recharts-powered area and line graphs for 24-hour historical trend analysis.
  • Event-Driven Alert Feed: Priority-based notifications (INFO, WARNING, CRITICAL).

Analytics Pipeline

  • Dual-Format Persistence: Automated CSV logging for local Pandas analytics and JSON output for API ingestion.
  • Automated Chart Generation: Python-driven visual reports including correlation heatmaps and alert distributions.

๐Ÿญ Industry Relevance & Business Insights

Deployment Sector Technical Use Case Real-World Equivalent
Commercial Greenhouses Precision climate control and fertigation. Priva / Argus Control Systems
Open-Field Agritech Mesh-networked soil moisture monitoring. CropX / John Deere Field Connect
Vertical Farming Automated hydroponic nutrient dosing loops. Bowery Farming OS
Smart Irrigation Reservoir monitoring and pump orchestration. Netafim automated valves

ROI Metrics: IoT monitoring pipelines typically achieve capital expenditure payback within 1-2 growing seasons through combined savings in water utility costs, labor reduction, and optimized crop yields.


๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    SMART AGRICULTURE SYSTEM                     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚   DHT22      โ”‚    โ”‚ Soil Moistureโ”‚    โ”‚     LDR      โ”‚       โ”‚
โ”‚  โ”‚  Temp + Hum  โ”‚    โ”‚   Sensor     โ”‚    โ”‚  Light Sensorโ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚         โ”‚                   โ”‚                   โ”‚               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”‚               โ”‚
โ”‚  โ”‚ Water Level  โ”‚    โ”‚   Relay      โ”‚           โ”‚               โ”‚
โ”‚  โ”‚   Sensor     โ”‚    โ”‚   Module     โ”‚           โ”‚               โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ”‚               โ”‚
โ”‚         โ”‚                   โ”‚                   โ”‚               โ”‚
โ”‚         โ–ผ                   โ–ผ                   โ–ผ               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚               ESP32 / Arduino UNO                    โ”‚       โ”‚
โ”‚  โ”‚      (or Python Digital Twin Simulation Engine)      โ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚                             โ”‚                                   โ”‚
โ”‚                             โ–ผ                                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚               Data Processing Engine                 โ”‚       โ”‚
โ”‚  โ”‚  โ€ข Threshold Comparison    โ€ข Alert Generation        โ”‚       โ”‚
โ”‚  โ”‚  โ€ข Hysteresis Pump Control โ€ข CSV / JSON Logging      โ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚                             โ”‚                                   โ”‚
โ”‚                             โ–ผ                                   โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚  โ”‚               React + Vite Dashboard                 โ”‚       โ”‚
โ”‚  โ”‚  โ€ข Real-time SVG Gauges    โ€ข Pump Control Status     โ”‚       โ”‚
โ”‚  โ”‚  โ€ข Historical Trend Charts โ€ข Alert Notifications     โ”‚       โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ—„๏ธ Hardware & Telemetry Schema

Sensor Integration

Sensor Class Measurement Range Actuation Logic / Simulation Model
DHT22 Temp & Humidity -40โ€“80ยฐC, 0โ€“100% Model: Sinusoidal diurnal day/night cycle
Capacitive Soil Soil Moisture 0โ€“100% Logic: Triggers irrigation below 30%. Model: Exponential decay
LDR Light Intensity 0โ€“1000 lux Model: Half-sine solar radiation pattern
HC-SR04 Tank Water Level 0โ€“100% Logic: Triggers safety interlock <10%. Model: Linear consumption
5V Relay Pump Status Boolean (0/1) Actuation: Driven by Hysteresis Control Engine

๐Ÿง  Digital Twin & Processing Engine

To enable enterprise software development without hardware dependencies, the Python backend acts as a highly accurate physics simulator (python_simulation/sensor_simulator.py).

Advanced Control Algorithms

  • Hysteresis Loop (threshold_engine.py): Instead of a static threshold (e.g., Turn ON at 30%, OFF at 31%), the engine uses a lower bound to activate (30%) and a higher bound to deactivate (60%). This prevents rapid, destructive relay switching.
  • Safety Interlock: If the ultrasonic sensor detects the water tank is empty, the software forcibly overrides the soil moisture demand, disabling the pump to prevent motor burnout.

๐Ÿ“Š Dashboard Layer

The frontend is a dedicated React SPA (Single Page Application) optimized for operational oversight.

  • KPI Matrix: Glassmorphism metric cards rendering instantaneous sensor telemetry.
  • Timeseries Analytics: Recharts integration rendering a 24-hour moving window of environmental trends, overlaid with static danger thresholds.
  • Actuation Timeline: Visual Gantt-style chart tracking historical pump ON/OFF durations.
  • Intelligent Alerting: Dynamic feed prioritizing environmental anomalies (e.g., "CRITICAL: High Temperature 38ยฐC detected").

๐Ÿ“ Project Structure

IoT-Smart-Agriculture-Monitoring-System/
โ”‚
โ”œโ”€โ”€ arduino_code/                   # Physical Edge Firmware
โ”‚   โ”œโ”€โ”€ smart_agriculture.ino       # C++ Sensor & Relay Logic
โ”‚   โ””โ”€โ”€ wokwi_simulation.json       # Virtual Circuit Diagram
โ”‚
โ”œโ”€โ”€ python_simulation/              # Digital Twin Engine
โ”‚   โ”œโ”€โ”€ sensor_simulator.py         # Mathematical Sensor Physics
โ”‚   โ”œโ”€โ”€ threshold_engine.py         # Hysteresis & Interlock Logic
โ”‚   โ”œโ”€โ”€ alert_system.py             # Event Classification
โ”‚   โ”œโ”€โ”€ data_logger.py              # I/O Persistence
โ”‚   โ””โ”€โ”€ generate_outputs.py         # Pandas/Matplotlib Visualizations
โ”‚
โ”œโ”€โ”€ dashboard/                      # Presentation Layer
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ vite.config.js
โ”‚   โ””โ”€โ”€ src/
โ”‚       โ”œโ”€โ”€ App.jsx                 # Dashboard Routing
โ”‚       โ”œโ”€โ”€ components/             # Reusable UI Blocks
โ”‚       โ””โ”€โ”€ utils/                  # Client-side state hydration
โ”‚
โ”œโ”€โ”€ data/                           # Generated Telemetry Outputs
โ”‚   โ”œโ”€โ”€ sensor_readings.csv
โ”‚   โ””โ”€โ”€ sensor_readings.json
โ”‚
โ”œโ”€โ”€ outputs/                        # Automated Analytical Charts
โ”‚   โ”œโ”€โ”€ sensor_trends.png
โ”‚   โ””โ”€โ”€ alert_distribution.png
โ”‚
โ”œโ”€โ”€ docs/                           # Technical Writeups
โ”œโ”€โ”€ main.py                         # Simulator Entry Point
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

โš™๏ธ Installation

Step 1 โ€” Clone Repository

git clone [https://github.com/CH-S-K-CHAITANYA/IoT-Smart-Agriculture-Monitoring-System.git](https://github.com/CH-S-K-CHAITANYA/IoT-Smart-Agriculture-Monitoring-System.git)
cd IoT-Smart-Agriculture-Monitoring-System

Step 2 โ€” Initialize Python Analytics Engine

python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt

Step 3 โ€” Initialize React Dashboard

cd dashboard
npm install
cd ..

โ–ถ๏ธ How to Run

Execute the Digital Twin Pipeline

To generate the 24-hour synthetic telemetry dataset, process the control logic, and compile analytical charts:

python main.py

Expected Output: The script will populate the data/ folder with CSV/JSON logs and the outputs/ folder with analytical PNG charts.

Launch the Operations Dashboard

cd dashboard
npm run dev

Navigate to the local Vite port (usually http://localhost:5173) to view the interactive web console.


๐Ÿ–ฅ๏ธ Dashboard Overview

Unified Command Console

The React frontend translates raw CSV/JSON telemetry into a cohesive command center. Users can seamlessly toggle between real-time spatial awareness (SVG Gauges) and longitudinal analysis (Area Charts). The conditional rendering logic ensures critical alerts draw immediate operator attention via color-coded visual cues.


๐Ÿ–ผ๏ธ Screenshots & Outputs

Dashboard



Sensor Trends (24-Hour Timeseries)



Automated Pump Actuation Timeline



Event Alert Distribution



Telemetry Correlation Heatmap



๐ŸŽฅ Live Demonstration

โ–ถ๏ธ Watch Demo Video




โœ… Verification Performed

  • Simulation Integrity: Validated that exponential decay models for soil moisture accurately trigger the hysteresis control loop at precisely 30% and disengage at 60%.
  • Safety Interlock Testing: Verified pump actuation is absolutely restricted when synthetic tank levels drop below the 10% threshold.
  • Frontend Hydration: Confirmed the React dashboard successfully parses and maps the generated sensor_readings.json file without blocking the main browser thread.
  • Data Engineering: Ensured Pandas correctly handles timestamps and interpolates synthetic environmental noise.

๐ŸŽ“ Learning Outcomes

Embedded & Systems Engineering

  • Implementing robust closed-loop control systems (Hysteresis) to protect mechanical relays.
  • Designing fail-safe logic (Pump Interlocks) based on multi-variable sensor inputs.

Data Engineering

  • Constructing mathematical "Digital Twins" using NumPy to simulate physical-world phenomena (diurnal cycles, desiccation).
  • Generating structured datasets (CSV/JSON) for downstream ETL consumption.

Frontend Architecture

  • Developing component-based SPAs using React 18 and Vite.
  • Visualizing complex, multi-axis timeseries data effectively using Recharts.

๐Ÿ”ฎ Future Improvements

  • MQTT Orchestration: Decouple the simulation engine from the frontend by introducing an MQTT broker (e.g., Mosquitto) for true real-time WebSockets streaming.
  • Predictive Machine Learning: Ingest historical CSV logs into an XGBoost model to forecast soil desiccation rates and predict irrigation schedules 48 hours in advance.
  • Weather API Integration: Fetch local meteorological data (OpenWeatherMap) to preemptively halt irrigation if heavy rain is forecasted.
  • Cloud Persistence: Migrate local CSV generation to an AWS RDS (PostgreSQL) instance or TimescaleDB.
  • Mobile Operations: Port the React dashboard to React Native for field-technician mobile access.

๐Ÿ“„ License

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.

Commercial usage, SaaS redistribution, monetization, or proprietary deployment is prohibited without explicit written permission from the author.

Full License: https://creativecommons.org/licenses/by-nc/4.0/


๐Ÿ‘จโ€๐Ÿ’ป Author

CH S K CHAITANYA

LinkedIn

GitHub

GitHub stars


โญ If you found this Agritech and Data Engineering architecture useful, consider starring the repository.

About

Enterprise-grade IoT Smart Agriculture platform. Features ESP32 hardware logic, Python-based mathematical digital twin simulations, hysteresis-controlled automated irrigation loops, and a premium React dashboard for real-time telemetry, visual analytics, and event-driven environmental alerts.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages