Smart Irrigation
Connected irrigation with an AI decision step
ESP32, C/C++, MQTT, Firebase, Android (Java), n8n, Ollama
- ESP32 board with a calibrated soil-moisture sensor, a DHT22 for temperature and humidity, a light sensor, and a relay-driven pump.
- Firmware sends readings to Firebase every hour over HTTPS and takes pump commands in real time over MQTT.
- A native Android app shows live readings and starts watering remotely.
- A daily n8n workflow asks a local Mistral model whether to irrigate and publishes the answer to the device.
How a watering command travels
Every morning an n8n workflow asks a local language model whether the soil needs water. Press the button to replay that decision.
- n8n + MistralReads sensor data, decides at 08:00
- MQTT brokerHiveMQ, topic irrigation/command
- ESP32C/C++ firmware, subscribed to the topic
- Pump relaySwitches on for 30 seconds
Waiting for a command.
- 1Soil sensorCapacitive, calibrated with dry (2615) and wet (926) readings
- 2DHT22Temperature and humidity
- 3ESP32Wi-Fi, MQTT subscribe, HTTPS uploads to Firebase
- 4Relay2-channel, active LOW, held off at boot
- 5PumpMini submersible, runs 30 s per command
See it work
App → MQTT → ESP32 → relay → pump. The captions in the video are in English.
Pin by pin
Every wired signal and power pin on the ESP32, and where it goes.
Code and docs
Firmware, Android app, n8n workflow and setup guide.
What I would fix
- Private MQTT broker with credentials and TLS
- On-device moisture rule as an offline fallback
- Authenticated Firebase access
Tested end to end
App tap, MQTT message, relay, pump. The serial log confirms it: command received, pump on, watering done.