↓ Skip to main content
  1. Home projects/

Garden of Eden: ESPHome garden automation

··Index: 5·
Table of Contents

This is a private project that automates watering in my garden. Several ESP32 boards running ESPHome firmware measure, decide and switch on their own, and all of them report to Home Assistant, which shows me the state and lets me override it from the phone.

There are five boards:

  • a rain-barrel monitor: water level from a float switch and two capacitive probes, and a pump;
  • a greenhouse soil-moisture and temperature monitor;
  • a 3-zone sprinkler controller;
  • two 4-channel switch boards, one of them also measuring temperature.

The boards are configured separately, but the shared parts (Wi-Fi, OTA updates, web server, logging, and diagnostics such as signal strength and uptime) are ESPHome packages that all of them include. Passwords stay in per-board secret files outside git.

Five ESP32 boards running ESPHome, built from shared packages, report to Home AssistantRain barrelfloat switch, 2 probes, pumpGreenhousesoil moisture, temperatureSprinkler controller3 zonesSwitch board 14 channelsSwitch board 24 channels, temperatureHome Assistantstate, phone overrideShared ESPHome packagesWi-FiOTA updatesweb serverloggingsignal strength, uptimeeach board includes them;secrets stay in per-board filesoutside git
Five boards share ESPHome packages and report to Home Assistant

Details
#

Template sensors make the barrel levels agree with one another: if water reaches a higher sensor, every lower level reads as wet too, whatever a noisy probe says. The analog probes also use hysteresis.

To calibrate the soil sensors I measured 20 capacitive moisture sensors, dry and in water, and derived a linear formula from the raw ADC value to a moisture percentage.

To build and flash the boards I wrote a small script, board.py (run with uv). It lists the boards and serial ports, compiles, uploads over USB or over the network and shows logs, for one board or all of them, on Windows and macOS.

Source on GitHub.

Related