Skip to content

About

ESP32 smart irrigation system: soil moisture sensing, hysteresis pump control, MQTT telemetry and a live remote-control dashboard. Built and tested in Wokwi.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smart Irrigation System — ESP32 · MQTT · Live Dashboard

Live demo Project page MIT

ESP32 MQTT Wokwi Dashboard

🌱 Smart Irrigation System

What if the soil could talk? An ESP32 reads soil moisture, temperature and humidity, decides when to water using hysteresis control, publishes everything over MQTT, and a live browser dashboard lets you watch — and switch the pump from anywhere.

Built and tested entirely in the Wokwi simulator — no hardware needed to try it. By Ajay Chowdary Uppalapati, B.Sc. Horticulture.

Project walkthrough

✨ Features

📡 Live telemetry Moisture, temperature, humidity and pump state every 2 s over MQTT
🧮 Smart averaging 10 ADC samples per reading smooth out sensor noise
🎯 Hysteresis control ON below 30 %, OFF above 45 % — the pump never flickers
🛡️ Safety first 10 s maximum run + 5 s cool-down in every mode
🎛️ Remote control Switch auto/manual, run the pump, change thresholds from the dashboard
🖥️ Dashboard Gauges, history chart, event log, animated field scene, built-in demo mode

🧭 How it works

flowchart LR
    S["🌱 Soil sensor<br/>GPIO34"] --> E
    D["🌡️ DHT22<br/>GPIO4"] --> E
    E{{"ESP32<br/>average · decide"}} -->|GPIO26| P["💧 Relay + pump"]
    E -- "…/data (JSON, 2 s)" --> B(("HiveMQ<br/>MQTT broker"))
    B -- "…/cmd" --> E
    B <-->|WebSocket| W["🖥️ Live dashboard"]
Loading

Architecture

Hysteresis in one picture

Hysteresis

📁 Repository structure

smart-irrigation-esp32/
├── firmware/
│   └── smart_irrigation_v2.ino        # ESP32 firmware (Arduino C++)
├── dashboard/
│   └── irrigation_dashboard_v3.html   # Single-file live dashboard
├── docs/
│   ├── setup-guide.md                 # Run it in 5 minutes
│   ├── how-it-works.md                # Control loop explained
│   ├── mqtt-topics.md                 # Topics, JSON, commands
│   ├── hardware.md                    # Wiring & parts list
│   └── assets/                        # Animated SVGs, GIF, screenshots
├── wokwi/
│   ├── diagram.json                   # Simulator circuit
│   └── libraries.txt
├── index.html                         # Animated project page (GitHub Pages)
├── LICENSE                            # MIT
└── README.md

🚀 Quick start

  1. Simulate — follow the setup guide: paste the firmware into a new Wokwi ESP32 project and press ▶.
  2. Watch — open the dashboard (add ?demo=1 to try it without a device).
  3. Control — switch to manual and run the pump from the dashboard, or from a terminal:
mosquitto_pub -h broker.hivemq.com -t smartirrigation/ajay4821/cmd -m "pump:on"

🔌 Wiring

Wiring

Part GPIO
Soil moisture sensor (analog) — potentiometer in Wokwi 34
DHT22 temperature + humidity 4
Relay → pump — LED in Wokwi 26

📸 Screenshots

One reading's journey Firmware logic
System overview Dashboard

⚠️ Security note

The default setup uses the public HiveMQ broker with no authentication. Anyone who knows the topic can read the data and send pump commands. Change the ajay4821 topic id to something unique before sharing, and use a private broker with TLS + credentials for real hardware. Details in the setup guide.

🗺️ Roadmap

  • FreeRTOS tasks for sensing / control / networking
  • Real hardware build with capacitive sensor and relay
  • Solar power with battery monitoring
  • Private broker with TLS and authentication
  • Rain forecast integration

📄 License

MIT © 2026 Ajay Chowdary Uppalapati


If this helped you, drop a ⭐ — and tell me what you'd build next.

About

ESP32 smart irrigation system: soil moisture sensing, hysteresis pump control, MQTT telemetry and a live remote-control dashboard. Built and tested in Wokwi.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages