Introduction: OpenSprinkler

This instructable was published in 2015. I updated it JUL2021 to use latest build and newer hardware.

OpenSprinkler Pi (OSPi) is an open-source sprinkler / irrigation extension board for the Raspberry Pi. It is an easy and low-cost solution to transform a Raspberry Pi into a capable sprinkler controller with 8 zones for lawn and garden watering.

OpenSprinkler doesn't need an instructable. This instructable simply documents my progress in Home Automation. OpenSprinkler's documentation is great. The end result is amazing. This is the perfect home automation project. If you are looking for a first project, do this one.

The goals of this project are to:

  • Don’t lose any functionality from current Rainbird irrigation system
  • Control the irrigation system from the web
  • Add functionality to the irrigation system
  • Integrate with weather reports (built in to OpenSprinkler)
  • Add rain sensor
  • Add soil sensors (I haven't done this yet – not supported by Open Sprinkler as of publish date)
  • Use WiFi instead of a wired connection
  • Use a Raspberry Pi

The OpenSprinkler v1.4+ User Manual (updated May 31, 2015) is the basis for this document. This is a great source for the latest OpenSprkler documents.

I changed the order of some OpenSprinkler steps. For example, when following the OSPi User Manual steps, I connected the Raspberry Pi to the OSPI (Step 2) and then many steps later imaged the micro SD card (step 8 = 7 hardware steps plus 1 software step). However, once the Raspberry Pi and OSPI are connected, the micro SD slot is not accessible. So, I had to take the RPi and OSPi apart, insert the micro SD card. Also, the parts list in the OSpi Manual is not complete.

I used a MacBook to communicate with the Raspberry Pi, but any computer can be used.

For the last ten years, Central Texas has been in a severe drought. My neighborhood is under severe watering restrictions. If I water on the wrong day, during the wrong hours (after 10pm and before 7am), or if water runs into the street, then I get a $50 fine. In general, I try to water as little as possible, but because it runs in the middle of the night I forget about it.

My house came with a Rainbird ESP-M controller, which is not WiFi enabled and cannot be accessed from the web. At a minimum, I would need to upgrade the Rainbird controller.

Notes:

  • text enclosed in spades, like this ♣replace-this♣ should be replaced with an actual value
  • I’ve attempted to credit every source used. My apologies for any omissions.
  • $ indicates a command executed in a terminal window on the MacBook and usually is being executed on the Raspberry Pi

The OSPi user interface is very intuitive. OSPi integrates with a weather system and rain sensor, which means no watering when it isn’t required. Hopefully, the savings on water bills justifies the project.

Step 1: Gather Parts

    I bought these:

    • Open Sprinkler parts:
    • Raspberry Pi parts:
      • FTDI TTL-232R-RPI Serial to USB cable from Mouser $15
      • Raspberry Pi 2 Model B Element14 $35
      • Panda 300n WiFi Adapter Amazon $16.99
      • Micro USB to USB cable 3ft from Amazon $4.69
      • SanDisk Ultra 16GB Ultra Micro SDHC UHS-I/Class 10 Card with Adapter (SDSQUNC-016G-GN6MA) from Amazon $8.49
    • Orbit rain sensor

    In other Raspberry Pi applications, I have measured and found the above configuration performs better than a starter kit. However, a Raspberry Pi starter kit will work fine. A case and power supply for the Raspberry are not needed.

    I had these:

    • Rainbird irrigation system with 7 zones and 24V AC sprinkler valves (OSPi can handle more zones with additional parts)
    • Tapered machine screws to attach back to front of OpenSprinkler housing (screw head must fit into OSPi slot)
    • 8x 8 inch solid wire (same gauge as Rainbird wire)
    • Mounting kit: 4 screws and pop toggles
    • MacBook with SD Card slot
    • Drill with 5/8 inch drillbit
    • 8x Wire nuts
    • Small flathead screwdriver, Phillips head screwdriver, and needle nose electronics plier

    The OSPi v1.4 kit includes the enclosure (with a clear acrylic window), assembled and tested OSPi circuit board and terminal blocks. The built-in components include 24V AC to 5V DC switching regulator, solenoid drivers, rain sensor terminal, DS1307 RTC and battery, PCF8591T 8-bit A/D D/A converter (4 input and 1 output), fuse, per-station transient voltage protector.

    Step 2: Gather Rainbird Documentation

    If the project fails or I want to reinstall the Rainbird controller, I need the Rainbird documentation for my model, which included:

    • Rainbird ESP-M Watering Cycle (aka, programming sheet)
    • Rainbird Product Sheet ESP-M
    • Rainbird ESP-M Modular Controller Manual

    Page 42 of the Rainbird ESP-M Modular Controller Manual shows how the zones are wired.

    Step 3: Take Photographs of Everything

    Again, in case I want to revert to the Railbird controller, I took pictures of everything.

    The white wire in the center of the image is COM.

    And the seven wires below the white wire are the zone wires

    Step 4: Download OSPi Pre-configured SD Image

    A pre-configured OSPi SD card image is available on-line. The latest version is available here: OSPi SD Card Image 2 (with Unified Firmware, update 05/31/15)

    I tend to purge my download directory. Anything I want to save is moved to a different directory. I keep my Raspberry Pi images in the directory: ♣macbook-image-directory♣. So, download the image and move to a directory.

    I used unarchiver to decompress the image file (.7z) on the MacBook.

    Step 5: Burn OSPi Image to Micro SD Card

    IMPORTANT: make sure you type in the correct disk number – if you enter the wrong disk number, you will wipe out your MacBook's hard disk!

    The process to burn the OSPi image onto an SD card is the same as burning a Raspbian image.

    Insert a micro SD card into SD Adapter, and then insert the SD adapter into MacBook.

    On MacBook use these instructions from Raspberry Pi.org, which are summarized here:

    Open MacBook terminal window

    Change to directory containing OSPi image

    $ cd ♣macbook-image-directory♣

    Identify the disk number (not partition) of your SD card In this case, disk4 (not disk4s1) and = 4

    In the following steps, the disk number is ♣micro-SD-card-disk#♣

    To identify your micro SD card, run the command:

    $ diskutil list

    Unmount your SD card by using:

    $ diskutil unmountDisk /dev/disk♣micro-SD-card-disk#♣

    Copy the OSPi image to your SD card. Ensure the image name and are correct.

    $ sudo dd bs=4M if=ospi2new.img of=/dev/rdisk♣micro-SD-card-disk#♣<br>

    CTRL-t to see the status of the copying.

    If there are errors, try different values for bs option, such as, 1m, 4m, or 1M. Larger Block Sizes (bs) are required for larger drives.

    When complete, unmount the SD Card:

    $ diskutil unmountDisk /dev/disk♣micro-SD-card-disk#♣

    Remove SD adapter from MacBook and remove micro SD card from adapter

    Insert micro SD Card in Raspberry Pi

    Step 6: Setup OSPi Power Supply

    The OSPi power supply has two wires: one is marked 300V the other is not. It does not matter which wire goes into which slot on the 24V AC clip.

    The OpenSprinkler clips are removable.

    • Remove the clip for 24V AC input.
    • On the orange clip, loosen screws.
    • Insert one wire from the power supply into each slot in the 24V AC clip as shown in the image.
    • Tighten the screws

    Step 7: Test Power Supply

    Read carefully before doing these steps:

    • Insert the transformer clip in to the matching terminal on OSPi.
    • Plug in the transformer.
    • The transformer will power both the OpenSprinkler board and the Raspberry Pi.
    • The Raspberry Pi power supply should not be used. Put it away.
    • The green LED should light up, indicating power is on. See image in previous step.
    • If the LED doesn’t light up, unplug the power immediately
    • If you can’t figure out the problem, send an email to support@opensprinkler.com

    Remove the power supply clip from the OSPi board

    Step 8: Setup Raspberry Pi

    Since this project uses the OSPi image and not a raspbian image, start with Step 4 in the following instructable:

    Setup Raspberry Pi without Monitor or Keyboard

    Disconnect power and USB serial cable. These won’t be needed any more.

    Step 9: Attach Raspberry Pi (RPi) to OpenSprinkler (OSPi)

    OSPi has two support pillars that match the screw holes on Raspberry Pi.

    With the micro SD card inserted into Raspberry Pi:

    • Remove the two top screws from the support pillars
    • Plug Raspberry Pi into OSPi through the 2x20 pin headers
    • Double check orientation and ensure all pins are aligned. The two screw holes must align with the support pillars.
    • Gently, insert Raspberry Pi all the way to the end. The USB and Ethernet connector should go through the cutouts on the PCB.
    • Insert screws for posts and gently tighten the two screws.

    The left image shows the connectors, and Raspberry Pi mapped out pins. The right image shows the locations of the USB WiFi dongle and SD card.

    Step 10: ​OSPI Web Interface

    The OSPi image contains a built in website.

      Next, open a browser, and type in http://♣ospi-ip-address♣, which is the Raspberry Pi's IP address (such as http://♣ospi-ip-address♣,

      A welcome page with further OSPI instructions appears. If this page appears, congratulations! The image is successfully burned on the micro SD card and WiFi is working.

      The actual OSPi User Interface is accessible via http://♣ospi-ip-address♣:8080

        password = opendoor

        If all is okay, then shutdown the raspberry:

        $ sudo shutdown

        Step 11: Install OSPi

        My home's Rainbird system has seven zones and is installed on the garage wall. So, move OpenSprinkler to the garage and mount OSPi on the wall.

          • Disconnect electricity from both Rainbird and Open Sprinkler.
          • If necessary, I want to be able to setup my Rainbird system again. So, I am leaving the Rainbird controller in place, as well as, its wiring. I run wires from the OSPi through a hole in the Rainbird controller case
          • The Rainbird control panel swings out. Grab the notch on the upper left and swing out the control panel
          • Drill 3/5in hole in the lower left side of Rainbird case
          • Connect the front and back of the OSPi enclosure using tapered screws. Do not over tighten.
          • Find a suitable location for the OSPi and mount to the wall on left side of Rainbird controller.
          • I used toggle mounts for the OSPi

          Step 12: Wiring Sprinkler Zones

          To connect sprinkler zones:

          • Remove COM (common) wire from Rainbird Controller and insert it into OSPi's COM terminal
            • On my system the COM wire is white (shown in image as yellow)
            • The COM terminal has two ports – they are internally connected so you can connect to either port
          • Cut 8 pieces of wire to the same length (measure and leave some extra - each wire must be long enough to run from Rainbird controller to OSPI
          • Run wires 8 wires from OSPi into Rainbird case
          • For each wire in Rainbird case do the following (do one at a time):
            • Loosen Phillips’ head screw on zone wire in Rainbird case
            • Remove the loose wire from the connector
            • Use wire nut to connect loosened wire to one of the cut wires
              • The cut wire runs from the Rainbird controller, through the hole, and to the OSPi controller
            • Loosen flathead screw on OSPi connector that corresponds to Rainbird (both are numbered right to left)
            • Insert wire into OSPi connector

          Step 13: Setup Zones and Programs

          The OSPi can be expanded to handle additional zones. I only need 7 zones. If you need more refer to the OSPi Manual.

          OSPi’s GUI is easy to use.

          • Setup Zones and Edit Programs.
          • Test to make sure everything works.

          You are done!

          Step 14: Appendix: Updates

          01JUL2016:

          • Export and backup settings before update
          • Updated OpenSprinkler firmware to 2.1.6 only do step B
          cd OpenSprinklerGen2
          git pull
          sudo ./build.sh ospisudo 
          /etc/init.d/OpenSprinkler.sh restart
          • Import settings