IoT-Based System for Real-Time Monitoring and Management of Soil Characteristics to Improve Crop Health
and Yield
Precision Agriculture with ESP32, Soil Moisture Sensing, Automated Irrigation, Email Alerts, and
Firebase Cloud Monitoring
Category: IoT, Embedded Systems, Agriculture, Precision Farming
Tools & Technologies: ESP32, Soil Moisture Sensor, GXHTC3 Temperature/Humidity Sensor (I2C), 20x4 LCD
Display, Water Pump Relay, LED Indicators, Buzzer, Firebase Realtime Database, Mailjet API, Arduino IDE
Status: Completed
Introduction
This precision agriculture project tackles the challenge of optimizing crop health through
intelligent soil monitoring and automated irrigation. The system uses an ESP32 microcontroller to
continuously monitor soil moisture levels and environmental conditions (temperature and humidity)
using dedicated sensors. When soil moisture drops below a configurable threshold (~25%), the system
automatically activates the irrigation pump to maintain optimal growing conditions. Real-time data
is logged to Firebase for remote monitoring, and email alerts are sent via Mailjet API for critical
conditions, enabling farmers to make data-driven decisions for improved crop yield.
System Overview
Aim and Objectives
Aim:
Design and develop an IoT-based soil monitoring and management system for
real-time crop health optimization and automated irrigation.
Objectives:
- Monitor real-time soil moisture levels using analog soil moisture sensors.
- Measure ambient temperature and humidity with the GXHTC3 sensor for environmental context.
- Automate irrigation pump control based on configurable soil moisture thresholds.
- Send email notifications via Mailjet API for critical soil condition alerts.
- Log all sensor data to Firebase Realtime Database for remote monitoring and historical analysis.
- Display real-time system status on a 20x4 LCD for local field monitoring.
Features & Deliverables
- Automated Irrigation: Water pump activates automatically when soil moisture
drops below threshold (~25%).
- Real-Time Soil Monitoring: Continuous analog soil moisture measurement for
accurate readings.
- Environmental Sensing: GXHTC3 sensor tracks temperature and humidity for
holistic crop environment data.
- Email Alerts: Mailjet API integration sends email notifications for critical
soil conditions.
- Cloud Dashboard: Firebase Realtime Database enables remote monitoring from any
internet-connected device.
- Visual Indicators: LED indicators for moisture status, temperature alerts, pump
status, and WiFi connectivity.
- LCD Display: 20x4 LCD shows real-time soil moisture, temperature, humidity, and
pump status.
- Buzzer Alerts: Audible notifications for critical conditions requiring
attention.
Process / Methodology
Hardware Assembly
Components: ESP32, Soil Moisture Sensor, GXHTC3 Temperature/Humidity Sensor, 20x4 LCD (I2C), Water
Pump Relay, LEDs (Moisture, Temperature, Pump, WiFi), Buzzer, Power Supply.
- Connected soil moisture sensor to ESP32 analog input (GPIO 36) for moisture level reading.
- Integrated GXHTC3 sensor via I2C for temperature and humidity measurement.
- Configured relay module for automated water pump control.
Software Development
- Developed firmware in Arduino IDE with WiFi connectivity and Firebase integration.
- Implemented soil moisture threshold logic for automated pump activation and deactivation.
- Programmed Mailjet API integration for email alert notifications.
- Created LCD display routines for real-time data visualization.
Testing & Calibration
- Calibrated soil moisture sensor readings against known moisture levels.
- Tested pump activation/deactivation at various moisture thresholds.
- Validated email delivery and Firebase data synchronization.
Challenges & Solutions
- Challenge: Soil moisture sensor readings varying with soil type and
compaction.
Solution: Implemented calibration routines and configurable thresholds to adapt
to different soil conditions.
- Challenge: Maintaining reliable WiFi connectivity in outdoor agricultural
settings.
Solution: Implemented WiFi reconnection logic and local data buffering for
intermittent connectivity.
- Challenge: Power management for outdoor deployment.
Solution: Optimized code for low power consumption with sleep modes between
sensor readings.
Results & Impact
- Automated Irrigation: Reduced water waste by activating pump only when soil
moisture is genuinely low.
- Data-Driven Farming: Historical data from Firebase enabled informed decisions
about watering schedules.
- Remote Monitoring: Farmers could monitor field conditions from anywhere via the
cloud dashboard.
- Crop Health Improvement: Consistent soil moisture maintenance led to healthier
plant growth patterns.
Future Enhancements
- Add soil pH and nutrient sensors for comprehensive soil health monitoring.
- Integrate weather API data for predictive irrigation scheduling.
- Implement solar-powered operation for fully autonomous field deployment.
- Develop mobile app with push notifications and historical analytics.
Demonstration / Access
- GitHub Repository: Coming
soon
- Live Demonstration Video: Coming
soon