Harsh environment
Portland, Oregon-based Mark has an urban garden that needs to be irrigated each summer. Judging from the description of his irrigation system, the garden is a little larger than the 30-foot back lawns often attached to suburban UK homes. Commercially available timers provide reliable irrigation, but Mark found they don’t last: “If you forget to bring them in during the winter, they freeze and break. After a few years, the plastic valves wear out and they jam closed (bad for plants) or jam open (bad for water bills). They don’t adjust to rain or hot weather.” Pricier, more robust timers plus web connectivity to check the weather forecast work better but still fail. Mark had several Raspberry Pi boards at home, and decided to put them to good use. Having written extensively about Raspberry Pi as well as coding using R (see his blog at niemannross.com), the combination seemed obvious, although R is a less common choice of programming language. “My preferred language is R, which I can run from a Linux operating system, but not from MicroPython or C. Irrigation only happens once a day, so I don’t need speed. What I need is the most convenient way to express my logic to Raspberry Pi.” Using Raspberry Pi Zero WH as the controller “makes it easy to connect to the internet and the headers provide a convenient way to connect relays and buttons,” he explains.
Bits and pieces
Creating his irrigation system involved assembling lots of fairly standard components and a certain amount of planning. Prior knowledge of plumbing and electronics is helpful, Mark observes. The planning aspect required Mark to work out how much rainfall was likely to offset the total number of gallons of water his garden would need and how long the valves would need to be open at a time. He calculated the rate at which his house pipes could pump water to the irrigation valves (and the putative number of gallons per hour) as well as the voltage required for the relays to deliver it.
To see whether his idea would work Mark began by screwing irrigation valves, two servos and Raspberry Pi needed to power the system, as well as a Raspberry Pi Zero, on to a piece of wood. “There isn’t any water connected to the system at this point – I’m only trying to test the electronics and develop and test the code.”
After writing and testing the code on Raspberry Pi he “ran it with the relays for days without any valves connected, then tested the plumbing in a sink before I attached it to the board”.
The US Environmental Protection Agency estimates 28 million US homes have an automated watering system, and that households can reduce their water usage by roughly 7,600 gallons a year using a weather-based system to gauge requirements. Mark wanted to see whether he got realistic readings, and how well the system performed, before deciding to risk linking it up with his water meter for billing. He continues to tweak and update it and is delighted with just how well his $75 irrigation system is performing.