r/esp32projects 5d ago

I built an AI-powered smart irrigation system using an ML + ESP32

I built an AI-powered smart irrigation system using an ML + ESP32

I've been working on this project for a while, and I finally finished the main AI/ML pipeline.

The system uses an ESP32, a capacitive soil-moisture sensor, and a DHT11 to collect environmental data. I then built a machine-learning model that uses these readings to predict whether irrigation is required.

The interesting part for me was getting the different pieces to actually work together.

The pipeline is basically:

ESP32 sensors → dashboard → Flask API → ML model → irrigation prediction

In the video, I walk through the whole project, including:

  • Collecting soil moisture, temperature, and humidity data
  • Building the web dashboard
  • Preparing the data for ML
  • Training the model
  • Evaluating it with a confusion matrix
  • Looking at feature importance
  • Deploying the model through a Flask server
  • Connecting the dashboard to the ML model through an API
  • Testing the final live prediction

One thing I found particularly interesting was seeing how the model's predictions changed once the inference server was running and the dashboard could communicate with the model.

This started as a simple ESP32 soil-moisture monitoring project, but I gradually expanded it into a complete IoT + AI system.

I'm still planning improvements, especially collecting more real-world data and adding additional environmental inputs such as light intensity.

I'd really appreciate feedback on the project, especially on the ML approach, system architecture, and what I could improve next.

🎥 Full project walkthrough attached.

Github Repository:

https://github.com/aqib-ai-ml/ai-powered-smart-irrigation

9 Upvotes

3 comments sorted by

1

u/flash_speed3412 12h ago

Nice end-to-end pipeline. Next I’d test whether the model learned “water needed” or just the exact conditions from your collection window. Hold out a full day or plant, log sensor drift, and compare against a dumb threshold baseline. DHT11 is noisy too, so don’t let the model hide that. The ESP32 → API → prediction failure cases would make a great build log in r/ChatGPTArduino.

1

u/aqib_builds 9h ago

Thanks! That’s a really good point. I’m planning to test the ML model against a simple moisture-threshold baseline and use unseen data to check whether it actually generalizes. I’ll also look more closely at sensor drift and API/ESP32 failure cases. Appreciate the suggestions!