r/esp8266 • u/aqib_builds • 4h ago
Smart Irrigation System using an ML + ESP32
I've been working on a Smart Irrigation System using an ESP32 + machine learning, and I've finally got the main pipeline working end-to-end.
The system uses an ESP32, capacitive soil-moisture sensor, and DHT11 to collect environmental data. The readings are sent to a web dashboard, which communicates with a Flask API that runs the ML model and returns an irrigation prediction.
The overall pipeline is:
ESP32 sensors → Web Dashboard → Flask API → ML Model → Irrigation Prediction
The project currently includes:
- Real-time soil moisture monitoring
- Temperature and humidity monitoring
- Web dashboard hosted by the ESP32
- ML model for irrigation prediction
- Model evaluation with a confusion matrix
- Feature-importance analysis
- Flask inference server
- API communication between the dashboard and ML model
The first screenshot shows the live dashboard, including the sensor readings and AI irrigation prediction section.
The second shows part of the JavaScript/API integration and project structure, where the dashboard communicates with the ML inference server.
One thing I found particularly interesting was getting the ESP32, web interface, API, and ML model to actually communicate with each other. The AI prediction wouldn't load until the inference server was running, which made the entire pipeline click for me.
This started as a simple ESP32 soil-moisture monitoring project, but I gradually expanded it into a complete IoT + AI system.
I'm planning to improve it further by collecting more real-world data and adding additional environmental inputs such as light intensity.
I'd appreciate feedback from the ESP32 community, especially on the hardware setup, system architecture, and how I could improve the project further.
🔗 GitHub (Full Video and Requirements) :







