Enterprise-grade Agritech telemetry platform featuring real-time environmental sensing, automated irrigation control loops, Python-based digital twin simulation, and a premium React dashboard
- Overview
- Problem Statement
- Core Features
- Industry Relevance & Business Insights
- System Architecture
- Hardware & Telemetry Schema
- Digital Twin & Processing Engine
- Dashboard Layer
- Project Structure
- Installation
- How to Run
- Dashboard Overview
- Screenshots & Outputs
- Verification Performed
- Learning Outcomes
- Future Improvements
- License
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:
- Physical Edge Deployment: Utilizing Arduino/ESP32 microcontrollers for real-world hardware actuation.
- 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.
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.
- 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.
- 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.
- 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).
- 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.
| 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.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| 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 |
To enable enterprise software development without hardware dependencies, the Python backend acts as a highly accurate physics simulator (python_simulation/sensor_simulator.py).
- 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.
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").
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
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-Systempython -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txtcd dashboard
npm install
cd ..To generate the 24-hour synthetic telemetry dataset, process the control logic, and compile analytical charts:
python main.pyExpected Output: The script will populate the data/ folder with CSV/JSON logs and the outputs/ folder with analytical PNG charts.
cd dashboard
npm run devNavigate to the local Vite port (usually http://localhost:5173) to view the interactive web 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.
- 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.jsonfile without blocking the main browser thread. - Data Engineering: Ensured Pandas correctly handles timestamps and interpolates synthetic environmental noise.
- Implementing robust closed-loop control systems (Hysteresis) to protect mechanical relays.
- Designing fail-safe logic (Pump Interlocks) based on multi-variable sensor inputs.
- Constructing mathematical "Digital Twins" using NumPy to simulate physical-world phenomena (diurnal cycles, desiccation).
- Generating structured datasets (CSV/JSON) for downstream ETL consumption.
- Developing component-based SPAs using React 18 and Vite.
- Visualizing complex, multi-axis timeseries data effectively using Recharts.
- 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.
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/




