Building a 4-Zone Irrigation Controller with ESPHome - Part 1

Building a 4-Zone Irrigation Controller with ESPHome - Part 1

Home Automation, ESPHome

Automating irrigation is one of those home automation projects that’s both practical and fun.

Instead of manually turning sprinklers or valves on and off, you can control watering schedules through your smart home — or even trigger watering based on weather or soil moisture sensors.

In this series, I’ll walk through building a 4-zone irrigation controller using ESPHome, some off-the-shelf components, and Home Assistant integration.


Series Overview

As I publish parts of this series I will update the links between each part for easier navigation.

Part 1 – Planning the Build & Hardware Setup
→ Components, software, wiring concept, safety.

Part 2 – Prototype, Flashing ESPHome & Writing the YAML
→ ESPHome config, relay control, and testing each zone.

Part 3 – Creating a custom PCB
→ Walking through PCB design and ordering process

Part 4 – Integrating with Home Assistant
→ Adding all entities, automations, scheduling, and dashboard.

Part 5 – Adding Sensors & Smart Features
→ Soil moisture, rain delay, weather data, and refinement.

Part 6 – Final thoughts and future improvements
→ Closing thoughts what I like, what I dislike and would do better next time.


Why Build a Custom Controller?

Off-the-shelf irrigation systems work fine for simple setups — but they’re often limited, closed, and inflexible. By building your own controller with ESPHome and Home Assistant, you get:

  • Full control and customisation – tailor schedules, sensor logic, and automations exactly how you want.
  • Local operation – no reliance on vendor cloud services or app subscriptions.
  • Easy integration – connect with weather data, soil sensors, and other smart home devices.
  • Expandability – add more zones, relays, or features later without replacing the hardware.
  • Lower cost – use inexpensive components you can maintain or upgrade yourself.

In short, a DIY controller gives you flexibility and transparency that commercial units rarely offer — and it’s far more satisfying to build something that perfectly fits your garden and your system.


Why ESPHome?

ESPHome is a framework for programming ESP8266/ESP32 microcontrollers with simple YAML configuration. Instead of writing C++ code, you declare sensors, switches, and automations in YAML, then flash them to your device. Benefits include:

  • Tight Home Assistant integration (auto discovery).
  • Easy configuration and updates via Wi-Fi.
  • Support for a huge range of sensors and relays.
  • Community-friendly with lots of real-world examples.

Perfect for a project like irrigation control.


Hardware Needed

For a 4-zone controller, you’ll need at a minimum the following:

Electrical Components

Component Example Purpose
Microcontroller ESP8266 (NodeMCU) or ESP32 Brain of the system
Relay module (4-channel) 5 V or 12 V logic Controls solenoid valves
Solenoid valves 12 VAC garden valves Open/close water flow
Power supply 12 VAC transformer (for valves) + 5 V DC (for ESP) Powers everything
Jumper wires & terminals Dupont / screw connectors Clean wiring
Enclosure Weather-resistant box Keeps electronics dry
(optional) Manual override switch or button Run a zone manually

Water/Hose Components

Component Example Purpose
Hose Manifold Used to split the cold water supply to each zone
Hose to G-thread adapters G3/4 to Hose Used to connect various hose pipes to solenoid valves, depending on the valve depends on which connectors/adapters are required.
G-thread to irrigation adapters Dependant on the irrigation system you use, you may need a specific adapter to go from the solenoid to pipe
Irrigation kit/drip feeders Claber Dripper Irrigation Set for Ten Plants Provides the irrigation part of the solution with suitable pipe and drip feeders, this solution can be adapted to use any brand of irrigation kits
Standard hose pipe Misc. lengths of hose pipe to connect everything up

⚠️ Safety First

Even though this project mostly uses low voltage, it still involves water! Electrical safety still matters:

  • Double-check power ratings of relays and valves.
  • Keep low-voltage and mains-voltage circuits physically separate.
  • If you’re not confident with wiring, get help from someone experienced.
  • Always test with the water supply off the first time you power it up.
  • Always test the water fittings without the controller being connected to mains power!

A small amount of planning here avoids fried boards (or flooded flowerbeds) later.


Wiring Overview

  • The core idea is simple:
  • Each relay controls one irrigation zone (valve).
  • When the relay energizes, it completes the 24 VAC circuit to that valve.
  • The ESP sends a HIGH or LOW signal to trigger the relay.
[ESP32] ---> [Relay1] ---> Zone 1 Valve  
        ---> [Relay2] ---> Zone 2 Valve  
        ---> [Relay3] ---> Zone 3 Valve  
        ---> [Relay4] ---> Zone 4 Valve

Diagram (simplified)

ESP8266 GPIO → Relay Input → Relay Output → Solenoid Valve → 24 VAC Transformer

Basic flow for controlling a zone

Label each zone clearly (Zone 1 – Front Garden, Zone 2 – Lawn, etc.). It makes automation easier down the road.


Planning the Zones

Think through how you want to divide watering areas:

  • Zone 1 – Front garden
  • Zone 2 – Back lawn
  • Zone 3 – Vegetable bed
  • Zone 4 – Pots / greenhouse

The beauty of this project is you can add/remove zones as required at anytime, you can even expand this further to include even more zones should it be required.

Even if you wanted another controller in another part of the garden, its easy and cheap to replicate, compared to commercial offerings.

I started with one zone and build out the system at a later date to accommodate four zones.

If you plan ahead, you can also size your transformer and relay contacts properly for the total potential current draw.


Next Up

In Part 2, we’ll:

  • Build a prototype solution using one zone
  • Flash ESPHome onto the board
  • Write a simple YAML config for up to four relays
  • Expose each zone as a switch in Home Assistant

By the end of Part 2, you’ll be able to toggle each valve manually from your Home Assistant dashboard.