Open design: a sprinkler controller from first principles
Every smart sprinkler controller you can buy at a hardware store needs its maker's cloud to run. So take one apart, see what it actually does, and build that from parts you can name. This design wires to the valves already in your yard, costs about what the cloud unit costs, and runs on your own network with Opichy.
Step one: dissect
A cloud sprinkler controller is a small box with a row of screw terminals: one per zone, a common, a master valve, two sensor inputs, and a barrel jack for a 24 VAC wall transformer. Inside, each zone terminal is a triac. That is the whole product. The rest is firmware and a service.
| Function | How the cloud unit does it | What it really needs |
|---|---|---|
| Switch a zone valve | A triac per zone switching 24 VAC | Any contact rated for 24 VAC at half an amp |
| Power the valves | A 24 VAC, 750 to 1,000 mA wall transformer | The same transformer |
| Master valve or pump start | One more triac | One more contact |
| Rain sensor | A normally‑closed contact on a sensor terminal | A GPIO input |
| Flow meter | A pulse input on the second sensor terminal | A GPIO input that counts edges |
| Schedule, weather skip, seasonal adjust | Firmware plus the maker's cloud | Rules on the controller; a forecast it fetches itself |
| Phone app | The maker's cloud | The controller's own UI, over your private network |
Everything that touches water is a 24 VAC contact and two inputs. Everything the subscription adds is software, and software is what Opichy is for.
Step two: redesign from first principles
- Valve switching. An 8‑channel relay HAT on the Pi's GPIO header. Its contacts are rated 5 A at 250 VAC; a solenoid holds at about 0.3 A on 24 VAC. Seven zones plus a master valve, or eight zones.
- Valve power. The same 24 VAC 750 mA transformer the cloud units ship with, through a 1 A fuse. It never touches the Pi, which has its own USB‑C supply. Two separate power domains, so a shorted yard wire cannot reach the logic.
- Inputs. A 4‑channel optocoupler module. Channel 1 is the rain sensor's contact, channel 2 the flow meter's pulses. A lightning‑induced spike on yard wiring hits an optocoupler, not a GPIO pin.
- Soil moisture, optional. Ecowitt WH51 probes through a gateway that posts every reading to the controller on your LAN.
-
Software. Opichy. Each relay is a
Switchwith a declared maximum on‑time and an interlock of at most two zones plus the master at once, which is the transformer's limit. The flow meter is aFlowRatederived from pulses. The rain sensor is a measuredBinaryInput. The rules from the irrigation article run against those capabilities.
Wiring
Bill of materials
Sixteen line items, about $210 for the core build. The flow meter adds $15; three soil probes and a gateway add about $100. An 8‑zone cloud controller is $180 to $230 and cannot run without its service. Download as CSV.
| Qty | Item | Example part | ≈ USD | Why |
|---|---|---|---|---|
| 1 | Raspberry Pi 5, 4 GB | Raspberry Pi 5 | 60 | Runs Opichy. Any Pi with the 40‑pin header works. |
| 1 | 27 W USB‑C power supply | Official Pi 27 W PSU | 12 | Powers the Pi separately from the valve transformer. |
| 1 | microSD card, 32 GB, A2 | SanDisk Extreme A2 | 10 | Holds the Opichy image. |
| 1 | 8‑channel relay HAT, optocoupled | Waveshare RPi Relay Board (B) | 30 | Eight 5 A relays on GPIO 5, 6, 13, 16, 19, 20, 21, 26. |
| 1 | 24 VAC 750 mA transformer | Orbit 57040 | 20 | Class 2 plug‑in. Runs two valves plus a master at once. |
| 1 | In‑line fuse holder, 1 A slow‑blow | Blade fuse holder | 5 | A shorted yard wire blows a fuse, not a transformer. |
| 1 | 4‑channel optocoupler input module | PC817 4‑ch, 3.3/5 V | 6 | Rain contact and flow pulses into GPIO, isolated. |
| 1 | Wired rain sensor, NC contact | Rain Bird RSD‑BEx | 30 | Opens when its discs swell. The controller sees it. |
| 1 | Hall‑effect pulse flow meter, ¾ in or 1 in brass | YF‑B series, DIGITEN G¾ | 15 | Open‑collector pulses; K‑factor on the datasheet. |
| 3 | Wireless soil moisture probes (optional) | Ecowitt WH51 | 60 | One per zone you care about; eight per gateway. |
| 1 | Soil probe gateway with local push (optional) | Ecowitt GW1100 or GW2000 | 40 | Posts readings to the controller on your LAN. |
| 1 | Outdoor‑rated ABS enclosure, 8×6×4 in | IP65 hinged box, clear lid | 20 | Indoor garage installs can use any vented box. |
| 1 | DIN rail and screw terminal blocks | 35 mm rail + 12 blocks | 15 | One terminal per zone, common, master and sensors. |
| 1 | Ferrule kit, 18 to 22 AWG | Bootlace ferrules + crimper | 12 | Stranded wire into screw terminals, no stray strands. |
| 1 | 18 AWG multi‑strand sprinkler wire, as needed | Orbit 5‑strand | 15 | Only if extending runs. Reuse what is in the wall. |
| 1 | 39 V metal‑oxide varistor (optional) | MOV across the 24 VAC output | 2 | Clamps solenoid spikes. Cheap insurance for contacts. |
Prefer not to wire relays? The OpenSprinkler Pi (OSPi) is a purpose‑built HAT with triacs, a 24 VAC input that also powers the Pi, and sensor terminals, for about $90. Fit it, run Opichy on the Pi, and skip the relay HAT, transformer fuse and input module rows above. The rest of this design still applies.
Build steps
- Photograph the old controller's terminals before unplugging anything. Tape‑label each zone wire. Note the common, and whether a master valve exists.
- Mount the DIN rail and terminals: one per zone, one common, one master, two for the rain sensor, three for the flow meter.
- Seat the relay HAT on the Pi and mount the Pi on standoffs at the far side of the box from the 24 VAC wiring.
- Wire the 24 VAC side. Transformer hot leg → fuse → a short bus wire to every relay's COM. Transformer other leg → COMMON terminal. Each relay's NO → its zone terminal. Relay 8 NO → master.
- Wire the inputs. Rain contact across input CH1. Flow signal to CH2, its 5 V and GND to the Pi. Module outputs to GPIO 23 and 24.
- Land the yard wires on the terminals, ferruled. Common to COMMON.
- Flash the Opichy image, boot, and open the controller's UI over Tailscale.
-
Declare the hardware. Eight
Switchcapabilities on the relay pins with a 30‑minute maximum on‑time and an interlock of two zones plus master. Rain sensor on GPIO 23, measured, active when open. Flow meter on GPIO 24 with the K‑factor from its datasheet. - Test each zone from the UI with the master on. Each zone has a normal gallons per minute. Write it down: that number is the stuck‑valve alarm.
- Calibrate soil probes if fitted: one reading after a soak, one when the grass wilts. Those set the watering band.
- Turn on the rules from the irrigation article and let it run pre‑dawn.
Safety
- The only mains connection is the transformer's plug. Nothing in the box carries line voltage. Keep it that way: the transformer stays outside the enclosure.
- 24 VAC is a class 2 circuit. It will not hurt you, but a short can heat a wire. That is what the fuse is for.
- Never run more valves than the transformer supports. Two zones plus master is the limit for a 750 mA unit. Opichy enforces it as an interlock; write it on the lid anyway.
- Outdoor installs need a rated enclosure and a drip loop on every wire entering it.
What you keep, what you gain, what you give up
You keep the valves, the wire, the rain sensor, the pre‑dawn schedule and weather skip. You gain a flow meter, soil probes, local control with no account, and rules you can read. You give up the maker's app, replaced by the controller's own UI, and the maker's warranty, which covered a device you no longer own.
The design files, including this parts list, live in the designs/sprinkler-controller folder of the repository, released under the permissive CERN‑OHL‑P v2 licence. Build it, sell it, change it.