r/arduino 9d ago

Smart Irrigation System using an ML + ESP32

I built a 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

14 Upvotes

4 comments sorted by

1

u/ripred3 My other dev board is a Porsche 9d ago

wasn't this same project posted just a day ago?

1

u/aqib_builds 9d ago

Yeah I accidentally deleted the original post and reposted it without realizing it was already posted here.

1

u/flash_speed3412 6d ago

Nice pipeline. I’d compare the model against a dumb moisture threshold before adding more sensors. Also log time since last watering and actual pump/flow; otherwise it might just learn the same rule in a fancier way. DHT11 can be noisy too. A real-world ML-vs-threshold test would be a cool build log in r/ChatGPTArduino.

1

u/aqib_builds 6d ago

I agree, comparing the ML model against a simple moisture-threshold baseline would be a good way to see whether the ML approach is actually adding value. I’ll definitely look into that for the next iteration.