Poseidon is an an irrigation controller built using Modulo, Raspberry Pi, and Flutter!
(earlier version, before I added Flutter to the project)
Poseidon has three parts
- Modulo hardware that controls sprinkler valves and provides a visual display of the system’s status
- A raspberry pi running the “Open Sprinkler Pi” software
- Flutter Wireless boards to control remote sprinkler valves.
The hardware is straightforward: A Raspberry Pi connects to a Modulo Controller via USB. Each valve is then connected to a pair of outputs on a Modulo Motor Driver so we can power the valve with positive polarity (to turn it on) or negative polarity (to turn it off).
I used Galcon 3652 valves, but any DC latching solenoid valve should work. (for AC valves, you’d need to connect relays between the motor driver and valves).
Here it is, minus the sprinkler valves and outdoor enclosure. As you can see, the “Back Yard” zone is currently running.
You can download Open Sprinkler Pi software from github. After installing it, you’ll be able to connect to its handy and attractive web interface. It shows you the various zones that you have configured, lets you set schedules, manually run the sprinklers, and even delay watering based on weather forecasts!
We need a way for Open Sprinkler Pi to control the Modulo hardware. Fortunately, it comes with a handy python-based plugin interface. I wrote a plugin using the Modulo python API to control the outputs. Here’s the code:
# Open the Modulo Port port = modulo.Port() # Create objects for the Display and Motor Drivers display = modulo.Display(port) driver0 = modulo.Motor(port) driver1 = modulo.Motor(port) # Create lists of functions to set the speed and enable/disable each zone setSpeedFuncs = [driver0.set_speed_a, driver0.set_speed_b, driver1.set_speed_a, driver1.set_speed_b] setEnableFuncs = [driver0.enable_a, driver0.enable_b, driver1.enable_a, driver1.enable_b] # This function gets called every time a zone turns on or off # gv.srvals is a list containing the new state of each zone def updateModulo(name="", **kw) : global display global setSpeedFuncs global setEnableFuncs useDCValves = True # Update the display display.clear() display.setCursor(0,0) for i in range(len(setSpeedFuncs)) : setSpeedFuncs[i](int(gv.srvals[i])) if (gv.srvals[i]) : display.setTextColor((0,255,0,255)) display.write('On') else : display.setTextColor((255,0,0,255)) display.write('Off') display.setTextColor((255,255,255,255)) display.writeln(' ' + gv.snames[i] + "\n") display.refresh() # Enable the motor drivers with the correct polarity for each zone for i in range(len(setEnableFuncs)) : if gv.srvals[i] : setSpeedFuncs[i](1) elif useDCValves : setSpeedFuncs[i](-1) else : setEnableFuncs[i](False) # Wait 100ms for the valves to change position, then disable the drivers if useDCValves : time.sleep(.1) for setEnableFunc in setEnableFuncs : setEnableFunc(False)
There’s also a bit of boilerplate code to make it into a valid Open Sprinkler Pi plugin. You can download the full version here, which you just need to drop into your OSPi’s “plugins” directory and then enable in the settings.
I have a vegetable garden in my back yard that’s too far from the house for wifi access, but I wanted it to be on the sprinkler system too. I decided to connect it using the amazing flutter wireless microcontrollers. They’re easy to use and have really incredible (1km!) wireless range.
On the controller end, a flutter controller connects via USB to the raspberry pi. The pi can send commands to the flutter board, which then transmits them wirelessly to the remote station.
Out in the vegetable garden, a second flutter controller is connected to a Modulo Base with another Motor Driver and Color Display. This secondary flutter setup controls the vegetable garden’s sprinkler valve and also show’s the system’s status. It’s a simple setup that works great!
DC sprinkler valves like these don’t require very much power so you can even run the remote station off a solar panel and battery!
Thanks to Taylor Alexander for providing early access flutter wireless boards. They’re super cool, so go pre-order them on flutterwireless.com! Also thanks to the Open Sprinkler Pi folks for the awesome software.