I’ve been using my Raspberry Pi as an inexpensive sprinkler controller using the “Direct I/O” mode of the sprinklers_pi software. In this mode, the GPIO lines control the switching hardware directly (i.e. 1-to-1 GPIO lines to relays) instead of using the more sophisiticated (and much nicer) shift register approach of OpenSprinkler. If I was doing it all over again, I would have just bought the OpenSprinkler hardware as it’s much cleaner and better than my hacked together solution. 🙂 In fact, I’m sure I’ll update my hardware at some point.
That said, as I have my hardware already setup, I thought it would be nice to be able to use this hardware with OpenSprinkler’s fantastic open source firmware. As the OpenSprinkler firmware is fairly “shift register centric”, I’ve patched (hacked?) it to support direct I/O by intercepting the shift register API calls, emulating the hardware shift register in software, and mapping the emulated shift register outputs back to the real GPIO lines. It’s not pretty, but it does seem to work. 🙂
The patched version maps zones to I/O lines using the GPIO pin numbering of WiringPI, where Zone #1 -> WiringPi Pin #0, Zone #2 -> WiringPi Pin #1, Zone #3 -> WiringPi Pin#2, etc), and pulls the GPIO output low when a zone should be turned on. Note that the mapping is currently “hard coded” for V2+ versions of the Pi. V1 version of the Pi had slightly different pin numberings. (This could be fixed easily, but I didn’t do so yet)
In case anyone’s interested, the patched version is here:
https://github.com/hugheaves/OpenSprinklerGen2
It can be built using the same process as the normal OSPI firmware, but instead of “build.sh ospi” use “build.sh ospi_direct”.
Hugh