Irrigation Automation (with Home Assistant)
With a garden, irrigation is key if you care about the survival of what you plant. For a while we watered the garden manually, but of cause that doesn't work when you go on vacation. And it's also a chore.
So we started to automate it. At first we simply used a cheap watering timer. That works fine if you're okay with not having any remote control or programming options.
A couple of years ago, I replaced that solution with two magnetic valves, that I power from an ESP2866 using ESPHome. The controller looks like this:
It's powered by a 12V power supply. A buck converter powers the ESP which controls two relays to send 12V to the valves.
However at the other end of the valves we still had garden hoses that connected to movable sprinklers. Not ideal as it looks shitty and you have to move the hose regularly for mowing the lawn.
Last year Kaddi's mum gave us a whole bunch of Gardena Sprinkler System components she had bought years ago but never got installed. Then this year, Kaddi bought a Gardena Micro Drip line on sale for the new beds around the shed.
So it was finally time to at least start with proper irrigation installation. I found it pretty difficult to properly plan this stuff. Gardena's online planner isn't super helpful either. Especially figuring out what your water pressure can actually power1) seems to be mostly a question of trial and error.
In the end we decided to lay three lines for the front garden and ignore the back garden for now. One line connects to the drip irrigation(1), one powers a rectangle sprinkler(2) and one provides a connector to connect whatever we want(3) – eg. another mobile sprinkler. The latter is mostly meant as an endpoint to extend the system at a later point.
Laying the “pipes” is relatively straight forward with the Gardena system. The trench should be about 25 to 30cm deep. The pipes are pushed into the connectors2) then the locking ring is rotated and the thing is tight. The pipe is a bit unwieldy – they recommend to have it lying in the sun to unwind. Too bad it was cloudy when we did it.
I marked each pipe with colored electrical tape at the ends, so that I will know which pipe goes where when I have to dig it up again.
The next question was how to connect the whole shebang to our outdoor faucet? And how to automate it?
At one point in the future, we want to bury a cistern behind the house and power the irrigation from rain water. But for now we needed a quick and “simple” solution.
Among the things we got from Kaddi's mum, was a Gardena water distributor. This thing is weird and it took us a while to figure out how it works: It has one input and six outputs. 1 and 2 are always on, the rest can be toggled by little switches on the back.
The thing is completely mechanical and automatically cycles through the enabled exits using water pressure3). So when it's on exit 1 and you turn on the faucet, it loads a spring mechanism and when you turn off the faucet the spring will make it switch to the next exit.
It's kinda cool, but I wish it actually came with a bit more smarts. Like a magnetic valve and an electronic sensor telling you which exit is currently open. It's also quite big, but the exits are still so close together that you can't use all six exits when using the Gardena 25mm sprinkler pipe connectors…
Anyway, I decided to use this thing and power it by one of my magnetic valves from the old solution.
I bought a big box by RainBird to bury. It barely fits the thing. For now I simply fit the faucet hose through the finger hole. I think at one point I want to replace the mechanical distributor by individual magnetic valves4).
To control the valve and make it cycle through the exits, I use the following ESPHome device config:
switch: - platform: gpio id: lawn_sprinkler_valve_sw0 internal: True pin: number: GPIO14 #D5 - platform: gpio id: lawn_sprinkler_valve_sw1 # currently unused internal: True pin: number: GPIO12 #D6 sprinkler: - id: sprinkler_ctrlr name: "Garden Sprinkler" main_switch: "Sprinklers" auto_advance_switch: "Sprinklers Auto Advance" valve_open_delay: 2min # let the pressure sink between uses valves: - valve_switch: "Exit 1" # Drip enable_switch: "Enable Exit 1" run_duration: 60min valve_switch_id: lawn_sprinkler_valve_sw0 - valve_switch: "Exit 2" enable_switch: "Enable Exit 2" # Lawn run_duration: 30min valve_switch_id: lawn_sprinkler_valve_sw0 - valve_switch: "Exit 4" enable_switch: "Enable Exit 4" # Plug run_duration: 3min valve_switch_id: lawn_sprinkler_valve_sw0
Triggering the “Sprinklers” switch will start the sequence. I use NodeRed to schedule this.