Feed on

OpenSprinkler Pi (OSPi)

An Open-Source Sprinkler / Irrigation Extension Board for RPi

NOTE: the video below is based on OSPi v1.0. The current version, OSPi v1.4, uses a considerably different enclosure. Please check the OSPi v1.4 User Manual for details. Thanks.


OpenSprinkler Pi is available for purchase at Rayshobby Shop.


  • We’ve started shipping OSPi v1.4. Please check the OSPi v1.4 User Manual for details.
  • OpenSprinkler new mobile app (native version) is now available on all platforms. Search ‘opensprinkler’ in iOS App Store, Android Play Store, or Windows Phone Store, then install the app. Additional details can be found in this blog post.
  • OSPi software setup just became easier: download the pre-configured SD card image for OSPi, burn it to an SD card, pop it in to your RPi, and you are ready to go! The SD card image contains Dan’s interval_program, Rich’s sprinklers_pi program, Samer’s mobile web app, and the Google Calendar-based scheduling program.
  • The sprinklers_pi program is released, courtesy of Rich Zimmerman. This program has an integrated mobile web page, weather-control feature, and the source code can be cross-compiled with AVR/Arduino platform. Ongoing discussion can be found at this blog post.
  • Please check the Online User Manual for instructions.
  • To receive updates, you can sign up to the Rayshobby RSS Feed, Google+, Twitter, or OpenSprinkler Email List, .


OpenSprinkler Pi (OSPi) is an open-source sprinkler / irrigation extension board for Raspberry Pi (RPi). It is based on the design of OpenSprinkler, but its ‘brain’ is an RPi instead of an AVR microcontroller.

The idea of OSPi first came when I noticed that many users were setting up RPi to work with OpenSprinkler. There are good reasons to do so, for example, to enable logging, to customize the default Javascript files, and to allow more advanced features such as weather-based and learning-based control. OSPi is designed as an extension board that makes use of RPi’s GPIO pins to directly control sprinkler valves, without an additional layer of microcontorller and Ethernet controller. In other words, it is a circuit board that allows an RPi to directly interface with sprinkler valves.


Circuit Design. The circuit of OSPi is a subset of the OpenSprinkler and consists of a 24VAC to 5VDC switching converter, a shift register, triacs, DS1307 RTC and backup battery, and PCF8591T A/D D/A converter. OSPi makes use of four of RPi’s GPIO pins to control the shift register, and two I2C pins (SDA, SCL) to interface with the built-in RTC and ADC converter. It can provide regulated 5V power to RPi with up to 800mA output current, which is sufficient to drive RPi with an USB WiFi dongle. Connection from RPi to OSPi is done through a 3-pin cable (providing 5V to RPi) and a 8-pin cable (connecting GPIO pins and 3.3V power from RPi).

Enclosure. OSPi uses the same enclosure as OpenSprinkler. To do so, you first secure the RPi to OSPi by leveraging the onboard copper separation pillars and screws, then fit the two of them together into an existing OpenSprinkler enclosure. The RPi’s SD card will stick out of the case, but everything else (including the WiFi USB dongle) will be fully enclosed.


Zone Expansion. Similar to OpenSprinkler, a single OSPi controls 8 stations, but there is a built-in shift register connector which allows it to be linked to zone expansion boards to enable more stations. Unlike OpenSprinkler (which has a limited amount of non-volatile memory), OSPi does not limit the number of stations — you can go up to a large number of stations, limited only by your SD card size. For instructions on how to connect OSPi to zone expansion boards, please check the online user manual.


Difference with OpenSprinkler

You may be choosing between OSPi and OpenSprinkler, and curious about their differences. Here is a detailed comparison. OSPi is based on Raspberry Pi (RPi). In order to use it, you must have an existing RPi and install the necessary software. There are three proof-of-concept demo programs as shown in the video above. In addition, the full-featured Interval Program firmware that runs on standard OpenSprinklers has now been ported to OSPi, thanks to the generous contributions by Dan Kimberling.

Note that we do not sell RPi directly — you need to purchase it separately (due to its popularity, it’s often out of stock). So OSPi is currently targeted towards users who have an RPi, and have prior experience with it.

OpenSprinkler, on the other hand, is based on an AVR microcontroller. It is pre-flashed with a full-featured firmware and works out of the box. It does not require any additional board or software setup. It has a built-in LCD display and push-buttons. We also provide a DIY version of OpenSprinkler, allowing you to build the controller from scratch. Another advantage of microcontroller is that it comes with analog pins. So if you are thinking of interfacing with external sensors, you may find it easier to use the microcontroller-based OpenSprinkler. In contrast, Raspberry Pi does not have built-in analog pins (although it’s possible to get ADC extension board to extend its capability).

If you are interested in modifying the programs yourself, OSPi would give a lot more flexibility. Since OSPi is based on RPi, you can use any of your favorite programming language, be it Python, PHP, Ruby, C++, Java, etc.; OpenSprinkler, on the other hand, is based on Arduino, or you can directly use avr-gcc to compile the program.

The other features are pretty much similar: both have a 24VAC to 5VDC conversion circuit, RTC and backup battery, Ethernet jack, zone expansion board connection, and both use the same OpenSprinkler enclosure. To enable WiFi, on OSPi you can use a WiFi USB dongle, on OpenSprinkler, you can use a portable WiFi adapter / repeater.

Online User Manual

Please check the Online User Manual for detailed instructions.


OSPi is an open-source product. The design, including schematic, PCB, and parts list can be found in the download section. Content on this site is published under the Creative Commons Attribution-ShareAlike 3.0 license.

Buy OSPi from Rayshobby Shop.

52 Responses to “OpenSprinkler Pi (OSPi) — Sprinkler / Irrigation Extension Board for Raspberry Pi”

  1. […] project before — and now he has introduced a new Raspberry Pi version of his project that is well worth taking a look! From his new Pi.Opensprinkler […]

  2. Mike says:

    Any chance that you will be adding MOV capability to the OpenSprinkler Pi board?

  3. G. Paul Ziemba says:

    An idea for the next rev of OS Pi: a hardware watchdog that shuts off the valves unless it is poked every so often (maybe 1 minute intervals?) That might offer some water-bill and flooding protection against software problems on the RPi. Since the OS is much more complex than for the arduino, I think there is greater likelihood of the software going out to lunch sometimes.

    I guess expansion boards would complicate matters somewhat, but maybe if there were an added shift register bit that had to be toggled at, say, 1-minute intervals, that might do the trick.

    • ray says:

      That’s a good point, and it can be implemented by adding a timer unit and one more triac (between the source pins of the current triacs and GND). This would work with expansion boards as well, because the extra triac will serve as a master ‘sink’ control for all solenoids. It does require changing the pin assignment on the expansion board connector though.

      • ray says:

        Actually I take back: it may not be that simple as adding an extra triac (because of the way triacs work), but a small relay should do the trick.

      • mstormo says:

        Old post, I know, but figured I would chime in on this one, as it would probably be smart to have a watchdog enabled by default in the pre-configured SD image:

        The Raspberry Pi already has a hardware watchdog on-board (BCM2708), you just need to enable it. Be aware that the watchdog has a 15sec maximum timeout, and setting it higher than that will make it fail.

        See the following for more details:

      • ray says:

        Cool. Thanks for the note. Will definitely check it out.

      • Stefan says:

        This is actually the sort of feature I started thinking about when looking into a sprinkler project. I haven’t purchased opensprinkler yet and am not familiar with the electronics. However, it seems like a feature like this would be critical to help prevent a failure of the RPi to shut down the OSPi. It seems like a watchdog on OSPi would be a much better solution to protect against communication failure between the RPi and OSPi. I think this sort of feature would help me rest a lot easier.

  4. G. Paul Ziemba says:

    Would manipulating OE* do the trick? To avoid using an extra gpio pin, it might be possible to insert some kind of timed flip-flop circuit in series that starts the countdown on the falling edge of OE*, and ignored the first 500 milliseconds of a high OE*. Then software could just pulse OE* high every so often to keep the watchog from timing out.

    • ray says:

      Ah, that’s a clever idea. Yes, I believe the NOE will do the trick. Since it will be controlled by both the MCU and the deadman circuit, it probably requires an OR logic: it’s activated (i.e. set to low) only if both control lines are set to low, otherwise, it will be set to high (i.e. output disabled). Thanks for the suggestion.

  5. Horace says:


    Quick question: Do you ship to the Netherlands?



    • ray says:

      Yup, we ship internationally. You can check the shipping cost by adding product to cart and then selecting the country.

  6. Spa says:

    I appreciate the work you’ve done with the OpenSprinkler controllers. I was looking at interfacing off-the-shelf relay boards with either the Arduino or RPi, but your product fits the bill perfectly.
    A question for you: Is the Arduino controller on the OpenSprinkler capable of accepting a Bluetooth shield?

    • ray says:

      That won’t be straightforward because OpenSprinkler has ATmega328 integrated on-board, and it is not designed to accept standard Arduino shield.

  7. Mark says:

    Thank you for building this. Perfect fit for my hydroponics project. Ebay is full of 24 VAC valves and a relay can handle my pump needs. Any thoughts of building a little more universal version of this ?

    A 12 VDC version would be awesome. Build the outputs for 12VDC and the options really open up on what it could be used for. Pair with standard automotive relays and you have a great control for automotive use or home automation use. It would be awesome if you could create the add on board to run 12 VDC too.

    I would pre-pay to buy a main board and an add on board if your interested in doing it.

  8. danimal1228 says:


    Any updates on getting OpenSprinkler ported to the Pi? I noticed someone on the forum created their own web based interface but I haven’t had time to mess with it.



    • ray says:

      The same software that runs on microcontroller-based OpenSprinkler has now been ported to OSPi. I just came back from a vacation and haven’t had time to blog about it. But the source code is already available in GitHub, and instructions are in the README.txt file.

  9. danimal1228 says:

    Wow, excellent work Ray and Dan. Can’t wait to get it up and running.

    Thanks again

  10. Tom Gee says:

    I’m a Linux/Pi newbie. Tried to follow the instructions in the readme.txt for the interval demo program of Open Sprinkler Pi and received an error after this step: sudo python ospi.py
    The Pi is complaining about line 299 in ospi.py, the error: No Such file: ‘./data/sd.json’
    The file exists put without the dot in front of /data/sd.json ie ‘/data/sd.json’

    What will go wrong if I edit line 299?

  11. Tom Gee says:

    Update to the file not found error in the previous post. It actually was a permission error on the sd.json file. Changing the permission to 755 from 644 fixed the issue. The server then started running. One correction to the readme.txt, the server is actually at port 8080 in the OpenSprinkler default configuration. In order to access it on the LAN requires you to go to http://xx.xx.xx.xx:8080

  12. Spa says:

    Are there any restrictions on how we can use the OS/OSPi (is it limited to personal use, or is commercial use allowed)? Also, are there any restrictions on resale of these products?

    • ray says:

      There is no restriction, you can use for it either personal or commercial use. Resale is also allowed. If you are interested in buying a batch (like 5+) you can contact me directly for discounts.

  13. Ervin says:

    Hi Ray, I’m sure you have it documented somewhere, but for some reason I cannot find it. What kind of ports are the 8 stations? Are they relays?


  14. Russ says:

    I am in the process of setting up my Pi 2.0 in anticipation of the arrival of my Open Sprinkler Pi board. At present the right versions of whatever software that needs to be loaded is getting to be confusing. Would it be possible to provide an updated set of instructions on exactly what and how to load all the necessary software to get an operating Open Sprinkler Pi. I would like to take advantage of Sam’s latest Web App that is fully integrated with the latest version of Dan’s interval program.
    I am a bit rusty at Unix and am now on my third reload of the OS and software in an effort to get it all to work.

  15. […] looking at an AVR based controller, but now, from the same vendor, I have the option of an add-on card to the Raspbery Pi to fulfill the same […]

  16. […] Then I started thinking — wouldn’t it be cool if I could use my Raspberry Pi to control my sprinklers? After a little bit of googling I found this project: http://rayshobby.net/?page_id=5816 […]

  17. Anant Mistry says:


    Thanks for such a wonderful project … I have this working right now and its just amazing.

    So I’m looking to modify your OpenSprinkler code to integrate another project that controls the sprinkler schedule (just on or off) based on an internet web service that provides a weather/rain fall information for your local area (based on zip code).

    I almost have the code base running (launching two threads) and I would like to donate this back. So I wanted to know if you would like the code so that you could roll it into your GitHub repository, or would you prefer if I created my own one and hosted the code base there?

    • ray says:

      Hi Anant,

      Glad to hear you wrote your own code. I suggest that you make a post on the forum (http://rayshobby.net/phpBB3). Several users have announced and shared their code on the forum. Just describe the basic features, a download link, and some basic instructions to get the code running. Uploading the code to GitHub is a good idea as it allows other users to contribute to your code as well. You can provide a README file with the information I suggested above.

  18. Jakub says:


    Is there a pending new release of OS Pi? I noticed the Assembled official v2.0s just came out? I’m potentially looking to get this for next summer season (with some usage by end of year still) but wondering if you are just on the verge of releasing something updated or should I just dive in for the RPi version?


    • ray says:

      No plan to update OSPi design anytime soon. The current version 1.2 has most of the hardware features needed. The rest is in software design. The official 2.0s is microcontroller-based OpenSprinkler, not OSPi (which is based on RPi).

  19. […] his other expansion boards. Rather than running the OpenSprinkler WEB interface, the Raspberry Pi version utilizes Google Calendar to turn zones on and […]

  20. […] the part that I haven’t quite finished yet. Basically you have 2 options. You can buy the OpenSprinkler Pi board or you can buy a relay controller and assemble all the parts yourself. I didn’t know […]

  21. alex says:

    i’ve downloaded the sd card image: all was ok!
    i logged to http://Raspberryip:8080 and again all was ok

    i’ve changed the port from 8080 to 8888 (i can’t use 8080) but now is not accessible ;(

  22. […] OpenSprinkler Pi or, OSPi, is an open-source sprinkler/irrigation extension board for RPi from Ray Wang: […]

  23. Eugene Lambert says:

    Hello Ray,
    I have received my OpenSprinklerPi and extension board. Everything looks good and the instructions for software worked great and the assembly of the two system was quick and easy.
    My question relates to the 24 vac outputs to the individual sprinkler relays. These are the field wiring questions which I could not find fully on the web site.
    In the software, I noticed only one (non Pump) sprinkler zone works at a time. That is good. In the OpenSprinklerPI board, I see that the common (COM) is wired to one solenoid valve set and one Station output (STATIONS) goes to each individual valve.
    For the extension, there is a common (COM) and another set of 8 Station (STATIONS) valve outputs. Does the 24 vac to power up the extension zone set of Station output valves get passed from the OpenSprinklerPi board to the Extension Board via the v1.1 extension cable that came with the extension board for communications and board power?
    Thanks, Gene

    • ray says:

      1) only one sprinkler zone turns on at a time because the software is set by default in ‘sequential’ mode. it also gives you the flexibility of turning this option off so multiple zones can turn on at the same time.
      2) the typical set up is that one wire from each sprinkler valve is connected together and goes to the COM (common) terminal; the other wire goes to the individual station port. If you have zone expansion board, the connection is the same. There is no separate COM terminal on the expansion board, because all valves share one COM wire, and that’s on the main controller.

      Technically the extension cable (which connects the main controller and expansion board) only carries the shift register signals and ground (GND). 24VAC is not carried on the extension cable.

  24. Stefan says:

    Does anyone have experience running the OSPi outdoors in a hot climate? I live in Sacramento, CA and just purchased an OSPi. Summers here are typically above 90 degrees during the day and we often have a few weeks that are above 100 (high about 108 degrees). My current sprinkler unit (Rainbird) is mounted on the west side of my house and is exposed to direct sun for about 5 hours of the day. Even though the heat doesn’t seem to have damaged it, I am hesitant to install the OSPi in the same location. With a little work, I can install the OSPi where it can be in the shade all day. I have purchased an Orbit enclosure so at least the OSPi will not be exposed to the elements.

    So my questions are:
    1) How sensitive are the OSPi and Raspberry Pi to hot conditions? Will they operate OK in temperatures above 100 degrees Fahrenheit?
    2) If the OSPi is OK in hot weather conditions, should I go through the trouble of routing my electricity and sprinkler wiring to a shady location?


  25. Tejasvi says:

    We university students are working on a Soil Moisture Sensor based watering of crops using Raspberry Pi.
    I was extremely inspired by the quality of your work throughput.
    I need a small help in the point where we are pinging the server in regular intervals of time from the pi using HTTP for req’s and responses.
    We have a delay in between pressing the button in our Website and the time when it switches on nearly about 1min.
    I want to avoid that delay just like how yours is working…
    Could you please help me in this topic its the only thing that’s bothering me.

    Thank you,

    • ray says:

      You need to provide more information like what program do you use, what hardware / controller do you use.

  26. Adam W says:

    Where exactly on the Opensprinkler Pi board is the terminal for the rain sensor? I see it on the Opensprinkler Beagle and Opensprinkler boards but not the Pi board. I am electronics noob so I apologize for the dumb question….

    Thank you