🌱 Inspiration
Agriculture faces two interconnected challenges: inefficient water utilization and fertilizer losses caused by inappropriate irrigation and rainfall. Conventional automated irrigation systems primarily focus on soil moisture, while existing fertigation solutions predominantly operate in controlled hydroponic or indoor environments.
We wanted to develop an intelligent fertigation platform specifically designed for open-field agriculture, where unpredictable rainfall, changing soil conditions and nutrient leaching make automated fertilizer management more challenging.
During our research, we identified another critical problem: many low-cost NPK soil sensors do not independently measure nitrogen, phosphorus and potassium. Instead, their readings are strongly influenced by soil electrical conductivity (EC) and salinity.
This discovery motivated us to develop AgriRain, an AI-powered, weather-aware fertigation system that prioritizes reliable measurements over misleading sensor readings.
💡 What It Does
AgriRain is an intelligent IoT-based fertigation platform that integrates soil sensing, weather forecasting, machine learning and automated fertilizer delivery.
Its major capabilities include:
1. Intelligent Soil Monitoring
- Monitors soil electrical conductivity (EC), pH and moisture.
- Records NPK sensor readings for trend analysis rather than blindly trusting them for fertilizer decisions.
- Uses sensor calibration and correction models to improve measurement reliability.
2. Weather-Aware Irrigation and Fertigation
- Integrates weather forecast information into irrigation and fertilizer decisions.
- Implements a 40% rainfall-probability threshold for fertilizer suppression.
- Prevents fertilizer dosing during anticipated rainfall conditions to reduce potential nutrient leaching.
3. Deferred Fertilizer Release
- Stores suppressed fertilizer demand in an intelligent deferred-release queue.
- Releases accumulated demand during suitable dry windows.
- Applies daily dosing limits, conductivity constraints and safety interlocks to prevent excessive fertilizer application.
4. AI-Powered Decision Support
Six machine-learning model instances perform four major functions:
- Soil EC, pH and moisture correction.
- Irrigation demand classification.
- Target EC prediction.
- Nutrient leaching-risk estimation.
5. Automated Fertilizer Delivery
Four independently controlled peristaltic pumps manage nitrogen, phosphorus, potassium and pH/calcium-magnesium balancing solutions.
⚙️ How We Built It
We developed AgriRain using a combination of embedded hardware, IoT sensing, machine learning and automated control.
Hardware Architecture:
- Raspberry Pi Zero W – Main processing and control unit.
- ADS1115 – 16-bit analog-to-digital conversion.
- TDS/EC sensor – Soil solution conductivity monitoring.
- Glass pH electrode – Soil solution pH monitoring.
- Capacitive soil moisture sensor – Irrigation monitoring.
- RS485 Modbus interface – Digital sensor communication.
- Four peristaltic pumps – Independent fertilizer and balancing-solution delivery.
- Relay modules – Automated pump switching and safety interlocks.
Software and Intelligence:
We implemented a Python-based control architecture integrating sensor acquisition, data processing, machine-learning inference and automated dosing.
The AI layer incorporates:
- Random Forest Regression for sensor correction.
- Random Forest Classification for irrigation decisions.
- Gradient Boosting for target EC estimation and leaching-risk assessment.
The control architecture combines real-time sensor measurements with weather forecast information.
When the predicted rainfall probability exceeds 40%, fertilizer dosing is temporarily suppressed. The corresponding nutrient demand is stored and subsequently released under controlled conditions.
Hardware relay interlocks ensure that fertilizer pumps operate only when irrigation is active.
🚧 Challenges We Ran Into
1. Low-Cost NPK Sensor Reliability
Our biggest challenge was determining whether inexpensive NPK probes actually measured individual nutrient concentrations.
We conducted a controlled falsification experiment using sodium chloride, which contains none of the three reported nutrients.
Despite adding no nitrogen, phosphorus or potassium, all three displayed nutrient channels increased substantially.
The experiment demonstrated that the channels were strongly dependent on bulk electrical conductivity rather than representing independent nutrient measurements.
2. Unpredictable Rainfall
Conventional fertigation systems do not adequately address rainfall-related fertilizer losses in open-field environments.
We developed a weather-based fertilizer rain-lock mechanism with deferred nutrient recovery.
3. Safe Automated Dosing
We implemented multiple control constraints, including conductivity limits, pH boundaries, daily dosing caps, minimum dosing intervals and irrigation-dependent relay interlocks.
4. Sensor Calibration and Data Reliability
We encountered challenges associated with sensor variability, measurement noise and the difference between laboratory calibration and actual field conditions.
We addressed these challenges through calibration experiments and machine-learning-based correction models.
🏆 Accomplishments That We're Proud Of
Our research and experimental evaluation produced several important findings.
- 118.9% increase in EC: Adding sodium chloride to the soil increased bulk electrical conductivity by 118.9% across the full experimental sweep, despite adding none of the reported NPK nutrients.
- NPK sensor falsification: Regression analysis demonstrated strong conductivity dependence across all three displayed nutrient channels, with R² values of at least 0.996.
- Pump calibration: All four peristaltic dosing channels achieved linear delivery characteristics with R² values of at least 0.998.
- 96.2% conductivity target-band residency: Achieved by the proposed configuration in a 31-day software replay, compared with 88.5% for the conductivity-only control and 98.0% for the perfect-knowledge oracle.
- 25% deferred nutrient recovery: The proposed control configuration recovered 25% of deferred nutrient demand during the replay.
- Weather-aware water management: Water consumption decreased from 420 L to 75 L in the replay, an 82.14% reduction shared by all weather-gated configurations.
These results helped us establish a more reliable approach to automated fertigation by distinguishing measurable soil conditions from potentially misleading nutrient-sensor readings.
📚 What We Learned
This project taught us that developing an intelligent agricultural system requires more than integrating sensors, microcontrollers and machine-learning algorithms.
Our most important learning was that sensor reliability must come before AI-based decision-making.
We learned:
- Why electrical conductivity cannot independently determine individual NPK concentrations.
- How rainfall forecasting can influence fertilizer application decisions.
- How to integrate embedded hardware, sensor interfaces and automated dosing mechanisms.
- How machine-learning models can support agricultural control systems.
- Why experimental validation and honest reporting of limitations are essential in engineering research.
We also identified the importance of validating software-replay results through parallel instrumented field experiments.
🚀 What's Next for AgriRain?
We aim to transform AgriRain into a more comprehensive and field-ready precision agriculture platform.
Our future development roadmap includes:
- Conducting parallel instrumented field trials across different soil textures and agricultural conditions.
- Integrating more reliable nutrient-specific sensing technologies.
- Improving AI models using larger datasets collected under real agricultural conditions.
- Installing drainage collection and measurement systems to quantify actual nutrient leaching.
- Improving deferred fertilizer recovery under consecutive rainfall events.
- Developing a farmer-friendly monitoring dashboard for real-time soil monitoring, weather information and fertigation management.
- Extending the platform towards crop-specific fertilizer recommendations and precision nutrient management.
Our ultimate vision is to make intelligent, affordable and reliable precision fertigation accessible to open-field farmers.
AgriRain – Smarter Irrigation. Reliable Nutrient Management. Sustainable Agriculture.