Inspiration

Most AI-based IoT projects rely heavily on frameworks and cloud services. While powerful, these abstractions often hide how decisions are made and are difficult to deploy on low-cost hardware.

We were inspired to build something simpler and more transparent—an AI system that runs on the edge, is explainable, and can work in real-world agricultural conditions. The goal was not just to use AI but to build it from first principles and understand it deeply.

What it does

The system automatically controls irrigation by deciding whether to turn a water motor ON or OFF based on environmental and crop-related data such as

Soil moisture

Weather conditions

Temperature and humidity

Rain forecast

Crop stage and soil type

Time of day

A neural network running on the ESP32 performs real-time inference and controls the motor. A web and mobile web dashboard displays live motor status, sensor inputs, and control mode, with support for manual override when needed.

How we built it

We designed a lightweight neural network using pure mathematics, without using any machine learning libraries.

Neural Network Design The model is a single-layer neural network (logistic regression)

Training is done offline on a computer, and the learned parameters are transferred to the ESP32 over Wi-Fi using JSON.

System Architecture

Training: Offline (Python, pure math)

Inference: On-device (ESP32)

Communication: HTTP + JSON

Control: Direct motor control via GPIO

Monitoring: Web and mobile web dashboard

This approach keeps the device lightweight, reliable, and independent of cloud services.

Challenges we ran into

One of the main challenges was implementing the neural network entirely from scratch while ensuring numerical stability on a microcontroller.

Another challenge was handling communication between Python and the ESP32 without using high-level networking frameworks, especially ensuring reliable JSON-based messaging.

Designing safe fallback behavior when sensors are missing or return unexpected values was also critical to prevent incorrect irrigation decisions.

Accomplishments that we're proud of

Successfully deployed a neural network written completely from scratch onto an ESP32

Achieved real-time edge inference without ML frameworks or cloud dependency

Built a working web and mobile web dashboard for monitoring and control

Designed a system that is explainable, deterministic, and resource-efficient

What we learned

We gained a deep understanding of how neural networks work at a fundamental level, including normalization, weighted sums, and activation functions.

We learned how to deploy AI models on constrained hardware and how important explainability and safety are in real-world IoT systems.

This project also reinforced the value of building systems from first principles rather than relying solely on abstractions.

What's next for NN + IoT-Based Irrigation Monitoring System

Next, we plan to integrate real soil moisture sensors and add sensor health validation.

We want to improve decision-making by adding confidence-based thresholds and adaptive behavior based on historical data.

In the future, this system can be extended to support more crops, larger deployments, and fully decentralized edge-AI irrigation networks.

Built With

Share this project:

Updates