The problem
Small farms, kitchen gardens and campus lawns are still irrigated by hand or by fixed timers. Timers water on schedule even after rain; manual watering depends on someone remembering, and both waste water or stress plants. The engineering fix is a closed loop: measure soil moisture continuously and open the valve only when the soil actually dries below a threshold. The ESP32 fits this job naturally — Wi-Fi on board for a dashboard, a 12-bit ADC for the moisture sensor, and deep-sleep modes that make battery or solar operation practical. This project builds the complete controller: a capacitive soil-moisture probe read by the ESP32 ADC with a documented two-point calibration the buyer runs in their own soil, an opto-isolated relay driving a 12 V normally-closed solenoid valve, threshold logic with hysteresis plus daily schedule slots, and an MQTT dashboard with gauge, 24-hour chart, schedule editor and event log. The valve needs its own 12 V supply — the report's wiring section makes the power architecture explicit.
Capacitive probe read by the ESP32 ADC, averaged over samples and mapped with dry/wet calibration.
Follow the working sequence
How it works
- The capacitive probe's analog output is read by the ESP32 ADC and averaged over multiple samples to reject noise.
- The averaged reading is mapped to a moisture percentage using the buyer's own dry-point and wet-point calibration values.
- Control logic compares moisture against the threshold: below 35% the GPIO energizes the relay and the 12 V solenoid opens.
- When moisture recovers past approximately 55% (hysteresis band), the relay releases and the valve closes.
- Schedule slots are evaluated at their configured times but skipped if moisture is already above the threshold.
- Every reading, valve transition and schedule decision is published over MQTT to the dashboard's gauge, chart and event log.
- Between 15-minute wake cycles the ESP32 enters deep sleep; on wake it re-reads, re-evaluates and republishes.
Tech stack:
- ESP32 DevKit (Arduino core firmware)
- Capacitive soil-moisture sensor (analog output)
- Single-channel 5 V relay module, opto-isolated, with flyback protection
- 12 V normally-closed solenoid water valve
- MQTT broker (e.g. Mosquitto) + web dashboard (MQTT over WebSockets)
- Separate 12 V 2 A supply for the valve; 5 V for ESP32 and relay logic
| Parameter | Value |
|---|---|
| Controller | ESP32 DevKit, Arduino-core firmware |
| Sensor | Capacitive soil-moisture probe, analog, ESP32 ADC with averaging |
| Calibration | Two-point (dry/wet) procedure run in the buyer's own soil |
| Valve | 12 V normally-closed solenoid, relay-switched (own 12 V 2 A supply) |
| Threshold | Open below 35% moisture, close above approximately 55% (hysteresis) |
| Schedules | Up to 4 daily slots, skipped when soil is already wet |
| Connectivity | MQTT over Wi-Fi; dashboard via WebSockets |
| Power | 5 V for logic, separate 12 V 2 A for valve; deep sleep between 15-min wakes |
| Dashboard | Moisture gauge, 24-h chart, valve control, event log, schedule editor |
| Water usage | Estimated per cycle from valve rated flow at your measured supply pressure |
Project features
- [Moisture-driven watering] The valve opens when soil moisture falls below the threshold (default 35%) and closes on recovery (approximately 55%), with hysteresis to prevent relay chatter.
- [Capacitive soil-moisture sensing] Corrosion-resistant capacitive probe read by the ESP32 ADC with software averaging; a two-point dry/wet calibration maps readings to your soil.
- [Relay-driven 12 V solenoid valve] Opto-isolated relay module with flyback protection switches the valve's separate 12 V supply — the ESP32 never carries valve current.
- [Auto + schedule modes] Daily schedule slots water at fixed times, but a slot is skipped when the soil is already wet enough; manual override from the dashboard anytime.
- [MQTT dashboard] Live moisture gauge, valve state, today's water usage and cycle count, 24-hour moisture chart with threshold line, schedule editor and timestamped event log.
- [Deep-sleep operation] The ESP32 sleeps between 15-minute wake cycles, keeping average current low for battery or solar-backed field use.
- [Offline resilience] Auto mode keeps running on the last configuration if Wi-Fi drops; telemetry resumes when the link returns.
- [Complete build docs] Wiring diagram, power architecture notes, calibration guide, firmware with commented threshold and schedule logic.
What is included
- Complete ESP32 firmware (sensing, threshold logic, schedules, MQTT, deep sleep)
- Wiring diagram and power architecture notes (why the valve gets its own 12 V supply)
- Calibration guide (two-point dry/wet procedure for your soil)
- MQTT dashboard web app (gauge, chart, controls, event log, schedule editor)
- Project report PDF (background, control design, power budget, evaluation method)
- PPT presentation for final review
- Viva Q&A preparation document (ADC, relays, hysteresis, MQTT, deep sleep, calibration)
- Setup guide (broker setup, Wi-Fi provisioning, first calibration run)
Advantages
- Waters only when the soil actually needs it: the valve opens below the configured threshold (default 35%) and closes on recovery (approximately 55%), with hysteresis to prevent relay chatter.
- A corrosion-resistant capacitive probe read by the ESP32 ADC with software averaging, plus a two-point dry/wet calibration, maps readings to the student's own soil.
- An opto-isolated relay module with flyback protection switches the valve's separate 12 V supply, so the ESP32 never carries valve current.
- Auto and schedule modes combine: daily schedule slots are skipped when the soil is already wet, and manual override is available from the dashboard anytime.
- The MQTT dashboard shows a live moisture gauge, valve state, today's water usage and cycle count, a 24-hour moisture chart with threshold line, a schedule editor and a timestamped event log.
- Deep sleep between 15-minute wake cycles keeps average current low for battery or solar-backed field use, and auto mode keeps running on the last configuration if Wi-Fi drops.
Disadvantages
- The solenoid needs its own 12 V 2 A supply; it cannot be powered from the ESP32 or USB, and the valve will not open without it.
- Water flow depends on the supply pressure and pipework; usage figures are estimates from the valve's rated flow at the measured pressure, not measured volumes.
- The moisture sensor must be calibrated in the student's own soil; factory defaults are starting points, and recalibration every few months is documented as probes drift over seasons.
- Wi-Fi range limits placement; the controller works standalone in auto mode if the link drops, but the dashboard goes stale until it reconnects.
- One zone per build; multi-zone irrigation needs one relay channel and valve per zone, documented as the extension path.
Limitations & prerequisites
- The solenoid needs its own 12 V 2 A supply — it cannot be powered from the ESP32 or USB; the wiring guide makes this explicit and the valve will not open without it.
- Water flow depends on your supply pressure and pipework; usage figures are estimates from the valve's rated flow at your measured pressure, not measured volumes.
- The moisture sensor must be calibrated in your own soil — factory defaults are starting points, and the report documents the calibration procedure you run.
- Capacitive probes resist corrosion far better than resistive ones, but they still drift over seasons; recalibration every few months is documented.
- Wi-Fi range limits placement; the controller works standalone in auto mode if the link drops, but the dashboard goes stale until it reconnects.
- One zone per build — multi-zone irrigation needs one relay channel and valve per zone (documented as the extension path).
Frequently Asked Questions
How does it decide when to water?
The ESP32 reads soil moisture continuously and compares it against a threshold (default 35%). Below it, the relay opens the 12 V solenoid valve; above the recovery band (about 55%) it closes. Hysteresis prevents the relay chattering at the boundary.
Why does the valve need a separate power supply?
A 12 V solenoid draws far more current than the ESP32's pins or a USB port can provide. The relay module switches a dedicated 12 V 2 A supply; the ESP32 only drives the relay's opto-isolated input.
How is the moisture sensor calibrated?
With a two-point procedure you run in your own soil: record the ADC reading in fully dry soil and in saturated soil, and the firmware maps between them to a percentage. The calibration guide walks through it step by step.
What happens if Wi-Fi goes down?
Auto mode keeps running on the last stored configuration — watering decisions never depend on the cloud. Telemetry and remote control pause until the link returns.
How much water does it use?
Per-cycle usage is estimated from the valve's rated flow at your measured supply pressure; the report documents the estimation method. A flow sensor for measured volumes is a documented extension.
Is this project suitable for a final-year project?
Yes — for Electronics, Electrical and IoT programs. It demonstrates ADC interfacing, relay driving, control logic with hysteresis, MQTT telemetry, deep sleep and calibration discipline, all strong viva material. Suitable for B.E./B.Tech final-year projects in Electronics, Electrical and IoT.
Components & software requirements
- ESP32 DevKit (Arduino core firmware)
- Capacitive soil-moisture sensor (analog output)
- Single-channel 5 V relay module, opto-isolated, with flyback protection
- 12 V normally-closed solenoid water valve
- MQTT broker (e.g. Mosquitto) + web dashboard (MQTT over WebSockets)
- Separate 12 V 2 A supply for the valve; 5 V for ESP32 and relay logic
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.