This turns your garden into a closed loop. It measures soil moisture and the local weather, works out what each bed needs, asks your permission by phone, and then waters or doses liquid fertilizer on its own once you tap yes. It bolts onto what you already have (the watering engine, the Open-Meteo feed, and the Phase-2 sensor contract in hardware/SENSOR-SPEC.md). No electronics background needed, and nothing here needs soldering.
01How the self-maintaining loop works
Five stages run on a timer (every 30 minutes) plus a daily “feeding check.” You stay in control because nothing actuates without your approval (you can later flip individual beds to fully automatic once you trust it).
scripts/watering.py.It already knows your plants’ needs (the dashboard has per-bed weekly_mm targets and feeding intervals), so a dry reading on a drought-tolerant bed won’t trigger the same alert as a dry reading on the squash.
02What it costs, the bill of materials
Prices are approximate CAD for the cheapest reliable sourcing (AliExpress). Buying the same parts on Amazon.ca for next-day delivery typically adds 30-45%. This is a 2-bed starter that waters two beds and doses fertilizer to the drip line.
| Part | What it does | Qty | ~CAD |
|---|---|---|---|
| ESP32 dev board (WROOM-32) | The brain, Wi-Fi built in, runs the whole thing | 1 | $10 |
| Capacitive soil moisture sensor v2.0 | One per bed. Capacitive, not resistive (resistive corrodes in a season) | 3 | $15 |
| BME280 temp/humidity/pressure | Local microclimate + a second frost signal | 1 | $6 |
| 4-channel relay module (5V, opto-isolated) | Switches the valves & pump. Inductive loads never touch the ESP32 directly | 1 | $8 |
| 12V solenoid valve ½″, normally-closed | One inline per watered bed; closed = no water if power fails | 2 | $26 |
| 12V peristaltic dosing pump | Draws diluted liquid feed from the tank into the drip line | 1 | $18 |
| 12V 3A power supply | Powers valves + pump | 1 | $15 |
| 12V→5V buck / USB converter | Powers the ESP32 from the same 12V supply | 1 | $4 |
| IP65 enclosure + cable glands | Keeps the electronics dry outdoors | 1 | $14 |
| Drip tubing, emitters, fittings | ½″ mainline + ¼″ to each plant | 1 kit | $30 |
| Flyback diodes, terminal blocks, wire | Protect relays from coil kickback; tidy connections | 1 | $8 |
| Fertilizer tank (reuse a 10-20 L jug/pail) | Holds the diluted liquid feed (e.g. your Miracle-Gro at ¼-½ strength) | 1 | $0 |
| Estimated total (AliExpress) | $154 | ||
Optional upgrades: swap bare sensors for DFRobot Gravity IP65 “waterproof” capacitive sensors (~$11 ea) for multi-season outdoor durability; add an 18650 + small solar panel (~$12) if you can’t run a power cable; a flow meter (~$8) to confirm water actually moved.
Where to buy (Edmonton)
| Channel | Best for | Trade-off |
|---|---|---|
| AliExpress | ESP32, sensors, relay, valves, dosing pump, cheapest by far | 2-4 week shipping |
| Amazon.ca | Same parts, fast; “capacitive soil moisture 5-pack”, “12V solenoid valve ½ inch”, “12V peristaltic pump” | ~30-45% more |
| RobotShop.ca / ABRA Electronics / DigiKey.ca | Canadian-stocked ESP32, BME280, quality connectors | Mid-price, reliable |
| Lee Valley (Edmonton) / Canadian Tire / Home Depot | Drip tubing, emitters, 12V supply, hose fittings, the tank/pail | In-person today |
03The two control options (software is free)
Path A, Home Assistant + ESPHome recommended
Best fit because your spec already assumes an always-on machine running an MQTT broker. Home Assistant (HA) is free and runs on a spare PC, a Raspberry Pi, or that always-on Mac.
- Flashing is codeless: ESPHome has a browser “web installer”, plug the ESP32 in by USB, click install.
- Approval notifications: the HA Companion app (iOS/Android, free) sends actionable notifications with real buttons, Water now / Skip. Tapping a button runs the automation.
- Weather built in: HA’s Open-Meteo/Met.no integration gives rain & frost; you gate watering on it exactly like the dashboard.
- Local & private: no cloud account required.
Cost if you already have an always-on computer: $0. A dedicated Raspberry Pi adds ~$60-110 (keeps you near budget only if you skip it / reuse hardware).
Path B, Blynk (no extra computer) cheapest
If you have no always-on machine, run the ESP32 with a small Arduino sketch and the free Blynk app.
- No host: the ESP32 talks to Blynk’s free cloud directly.
- Approval: Blynk push notification + a button widget you tap to confirm watering/feeding.
- Weather: the ESP32 fetches Open-Meteo over Wi-Fi itself (no key) and applies the same rain/frost skip.
- Trade-off: free tier limits datastreams/devices; less powerful dashboards than HA.
Cost: $0 software, nothing extra to buy.
04Build it, step by step
A · Bench-test indoors first (30 min)
- Plug the ESP32 into your computer by USB.
- Wire one capacitive sensor: VCC→3V3, GND→GND, signal→an ADC pin (e.g.
GPIO34). - Flash ESPHome via the web installer (Path A) or upload the Blynk sketch (Path B).
- Confirm a moisture number appears: dry in air = low %, finger-wet = high %.
B · Calibrate each sensor (10 min each)
- Hold the probe in air, record the raw reading = 0% VWC.
- Stand it in a glass of water to the line, record the raw reading = 100% VWC.
- Enter both numbers so the firmware maps linearly. The watering engine’s thresholds are <20% = water now, 20-30% = water soon, >30% = skip (loam; recalibrate against a finger-test on clay beds).
C · Wire the valves & pump through the relay
- Mount the relay board in the enclosure. ESP32 control pins → relay
IN1..IN4. - Run the 12V supply through each relay’s COM→NO to one valve or the pump. Never drive a valve or pump from an ESP32 pin, they pull amps and will fry it.
- Put a flyback diode across each valve/pump coil (stripe to +12V) to absorb the kickback when it switches off.
- Power the ESP32 from the 12V supply via the buck/USB converter, so it’s all one plug.
- Seal cable entries with the glands; keep the enclosure off the ground.
D · Plumb the water
- Tap a garden tap or rain barrel → a pressure regulator (drip kits include one) → ½″ mainline.
- Put one solenoid valve inline per bed, then ¼″ tubing with emitters to each plant.
- If you have no tap pressure (barrel only), add a small 12V diaphragm pump (~$18) on its own relay channel.
E · Add the liquid-fertilizer tank
- Fill the tank with pre-diluted liquid feed, e.g. your Miracle-Gro 24-8-16 mixed to ¼-½ the normal strength so the pump can run it straight.
- Peristaltic pump inlet hose → bottom of the tank; outlet → a tee into the drip mainline (after the valve).
- The pump is self-priming and only the silicone tube touches the fertilizer, so it tolerates the salts well.
- On a feeding day the loop opens a bed’s valve, runs the pump for N seconds (dose = your per-plant rate), then flushes with plain water.
Cheaper, non-electric alternative: a venturi injector ($10-20) draws fertilizer by suction from the tank using water flow, no pump, no power, but it isn’t precisely dose-controlled and needs a pressure drop. The peristaltic pump is the right call for software-controlled dosing.
F · Turn on the brain
- Path A: in Home Assistant, add an automation: if bed VWC < threshold and no rain in next 48 h and no frost tonight → send an actionable notification. The Water now button calls the valve switch for the computed seconds.
- Path B: the sketch posts the same decision to Blynk and waits for your button tap.
- Set a separate daily feeding check that proposes a dose when a plant’s feeding interval is due (the dashboard already tracks this).
05The decision logic (so it’s never dumb)
- Sensor wins over model: a live reading under 6 h old overrides the weather estimate for that bed (the
sensor:<id>contract already in your zones). - Rain skip: if Open-Meteo shows meaningful rain in the next 48 h, it proposes Skip.
- Frost lockout: if tonight’s low is near/under your frost threshold, no watering or feeding is proposed (wet soil + frost = damage).
- Per-plant smarts: drought-tolerant beds use a lower trigger; heavy drinkers (squash) use a higher one.
- Feeding stop dates: it won’t propose nitrogen feeds for perennials/woody plants after ~Aug 1 (hardening for winter), mirrors the dashboard rule.
- Caps: a max run-time per valve and a daily max so a stuck sensor can’t flood a bed.
06Safety & winterizing (Edmonton)
- Blow out the lines before freeze-up (late Oct): disconnect water, open valves, push the lines clear with low-pressure air. Frozen water splits valves and tubing.
- Bring the pump & fertilizer tank indoors for winter; empty and rinse the pump tube.
- GFCI outlet for the 12V adapter; keep all connections in the IP65 box, off the ground.
- Capacitive sensors only, conformal-coat the electronics end and keep the marked line above soil.
- Fail-safe valves: normally-closed means a power cut stops water rather than leaving it running.
07Scaling & staying in budget
The $154 starter covers 2 beds. Each additional bed is just +1 sensor (~$4) and +1 valve (~$13) on spare relay channels, roughly $17/bed. One ESP32 comfortably handles 3-4 sensors and a 4-channel relay; a second ESP32 (+$10) and an 8-channel relay (~$10) take you to a fully wired multi-bed garden still under $250.
08Sources
Current pricing, wiring practice, and the control/notification approach were drawn from:
- Botmonster, Home Assistant smart irrigation, $25-89 hardware
- Instructables, ESP32 soil-moisture DIY automatic watering
- SmartHomeScene, capacitive soil sensor with ESPHome
- Home Assistant Community, relay-connected peristaltic fertilizer dosing
- esp32io, automatic irrigation, relay/MOSFET wiring safety
- Instructables, soil-feedback drip irrigation with ESP32 + Blynk
- Drip Depot, fertilizer injector buying guide (peristaltic vs venturi)
- Home Assistant Community, actionable “plants need water” notification blueprint
- AliExpress, ESP32 / 8-channel relay pricing