
Five years of garden irrigation on a Wemos D1 mini: five sprinklers, one buried pipe, about 80 euros in parts
Every dry season the grass went yellow, so five years ago I put a Wemos D1 mini in a box on the outside wall and gave it the watering job. It is still doing it, power cuts included. I have been meaning to write this up for years, so here it finally is.
The part I would do again is the plumbing. Instead of a valve box near the tap and a pipe per zone, there is one master valve at the tap and a single pipe around the garden. At each sprinkler a clamp saddle taps the pipe (no cutting, it just bolts around it), feeds a 12 V solenoid in a small box in the ground, and the solenoid feeds the head. A drain valve at the far end empties the line for winter. One trench instead of five, and since I only run one head at a time, whichever head is open has the whole supply to itself. No pump, no tank. All the materials together, pipe included, came to about 80 euros.
Power is a 30 W mains-to-12 V DC LED driver: 12 V to the valves through the relays, and a small step-down to 5 V for the board and the relay logic. Everything lives in that one box and runs off a single wall socket.
Things five years of this taught me:
- The usual cheap relay boards switch on LOW, and an ESP8266's pins float while it boots, so the relays can chatter until the sketch takes over. Write each pin HIGH before pinMode(OUTPUT) so the handover itself adds no LOW pulse. The master valve sits on GPIO 0, which has to be high at boot anyway: the same pull-up that boots the board keeps the water shut through every reset.
- No valve opens without a time limit. A one-second watchdog closes any valve that has run past its limit and sends a push notification.
- After a power cut, tell the server the valve state instead of asking for the saved one. Replaying an ON from before the outage would open a valve with nobody home.
- OTA updates, because walking a laptop out to a wall box in the rain gets old fast. One warning: the ESP8266 updater has no fallback slot, so test every new binary on a desk board first.
Full disclosure: the phone side runs on Plynx, an iOS dashboard app I'm building, so make of that what you will. The write-up with the plumbing diagram and the complete sketch is here: https://www.plynx.cc/blog/esp8266-irrigation-controller-ota/
The buried wiring has been through five winters now and the splices have held so far. What I still have not solved is sensing: I would like the schedule to skip a run after real rain, but every cheap soil moisture probe I have read about seems to corrode within a season. If you have one that lasted outdoors, I want to hear about it.