🌱 Smart Soil Health Diagnostic System
IoT-Enabled Soil Monitoring with Heuristic NPK Prediction
A low-cost hardware–software integrated soil monitoring system that measures soil temperature, moisture, and pH, processes the data using object-oriented Arduino firmware, and provides real-time diagnostics, NPK estimation, data logging, and automated reporting through a Python dashboard.
This project is designed as an educational and practical precision-agriculture solution that avoids expensive chemical sensors while still providing meaningful soil health insights.
📌 Project Overview
Traditional soil testing is slow, expensive, and inaccessible for many farmers. This project addresses that gap by building an in-situ, real-time soil health diagnostic system using:
Embedded sensors
Robust firmware logic
Local data processing (no cloud dependency)
A desktop visualization & reporting application
Instead of directly measuring Nitrogen, Phosphorus, and Potassium (NPK) using costly probes, the system applies a heuristic correlation-based algorithm that estimates nutrient availability using soil moisture, pH, and temperature.
🔧 Hardware Components
Arduino UNO R3
DS18B20 digital temperature sensor (1-Wire)
Capacitive Soil Moisture Sensor v1.2
Analog pH sensor + signal conditioning module
4.7kΩ pull-up resistor (for DS18B20)
Breadboard, jumper wires, USB power
📐 Circuit wiring is provided in circuit_diagram.png.
🧠 Software Architecture 1️⃣ Firmware (Arduino – C++)
Object-Oriented design for sensor abstraction
Noise reduction using multi-sample averaging
Calibration-aware sensor processing
JSON serialization over Serial communication
Fault-tolerant temperature fallback logic
2️⃣ Application Layer (Python)
Desktop dashboard for live monitoring
SQLite database for historical storage
Heuristic NPK prediction engine
Automated PDF soil health report generation
🏗️ System Architecture Sensors ↓ Arduino UNO (OOP Firmware) ↓ JSON over Serial Python Dashboard ├── Live Visualization ├── NPK Heuristic Analysis ├── SQLite Logging └── PDF Report Generation
📊 NPK Prediction Logic (Heuristic)
Instead of chemical probes, the system infers nutrient availability using validated soil science correlations:
Nitrogen (N)
Low → Moisture < 40% or > 80%
High → Ideal moisture, pH (6.0–7.2), temperature (20–28°C)
Else → Moderate
Phosphorus (P)
Low → pH < 5.5 or > 7.5 (fixation)
Else → Moderate
Potassium (K)
Low → Moisture < 40%
Reduced → pH < 5.5
Else → Moderate
🚀 How to Run 1️⃣ Upload Arduino Firmware
Open SoilMonitorOOP/SoilMonitorOOP.ino
Select Arduino UNO and correct COM port
Upload firmware
2️⃣ Run Python Dashboard python soil_dashboard.py
The dashboard will:
Display live sensor readings
Estimate NPK levels
Store data in SQLite
Generate PDF soil health reports
📈 Experimental Results
Moisture stability: < ±0.5%
pH accuracy: ±0.1 after calibration
Temperature fault handling: Safe fallback at 28.5 °C
Reliable long-term logging with SQLite
The system remains operational even during sensor disconnect events.
📂 Repository Contents SoilMonitorOOP/ → Arduino firmware soil_dashboard.py → Python dashboard soil.db → SQLite database circuit_diagram.png → Hardware wiring soil_report.pdf → Sample generated report OOP_research_paper.docx → Detailed research documentation
🔮 Future Improvements
Wi-Fi / ESP32 integration
Mobile or web dashboard
Cloud synchronization
ML-based nutrient estimation
Automated irrigation control
🎓 Academic Context
This project was developed as part of an undergraduate Computer Engineering capstone, combining:
Embedded Systems
Object-Oriented Programming
IoT
Databases
Applied Agricultural Science
👤 Authors
Ananya Choudhari Arya Bharat Patil Aryan Bhat Ankush Kumar
Department of Computer Engineering Vishwakarma Institute of Technology, Pune