Saturday, August 17, 2013

Sprinkler System

Kara and I will be installing a sprinkler system this fall. I am using this as an opportunity to actually do a useful programming, computer interface control project where I can use an Arduino/Raspberry Pi in a useful and productive manor. This project will contain the following elements. RainBird has some great education videos here:


The interface will be the only way in which the user will interact with the sprinkler system (other than the possible 'emergency shut off' which will be physical valves and/or a programmatic way to also replicate this behavior.

The interface will be web-based. This web functionality will run on a Raspberry Pi using Apache and be local-access only. That is, I will limit the ability to the LAN in order to impose some security on the system. Either password protected or MAC-address restricted.

I plan on including screen shots of various control sites as I develop them here.

Somewhere between the interface and the controller (though mostly interface) is the code needed to get the Arduino talking on the network. I found a little guide which talks about running a web server on the Arduino itself. This is must more simple than my original though of having the Arduino behave as a mindless drone that just takes commands over the network. As I develop this concept into more home automated things, it will likely be the better option as I can have everything centrally controlled and monitored on the Raspberry Pi and just have slave units that do the home automation over the network.


The controller will be how the user requests will be processed into the 24VAC signals needed by the sprinkler hardware in order to turn the water on and off. This will be comprised of an Arduino connected to a number of relays and an Ethernet controller. This will allow for the web access to the controller and for the signals to be processed and to fire the relays needed. I still have not decided if I will build a custom board containing the ATmega chip and other componants or just use three shields (would be more expensive but would require less building on my part).
The proposed pre-fabed parts are as follows:
Relay Shield -
Ethernet Shield -
Arduino Uno R3 (already have)-

An all-in-one unit like this would be nice too.

These components will be ideally contained in a housing located near the valve manifold (likely under the crawl space)

Relay Board:

Edit 5:
Did a mock up of the circuit for my relay board using the java circuit simulator from
Paul Falstad's page at

Based this on the arduino playground suggestion for relays and the posting at glacial wanderer.


 The valves will be 24VAC triggered. I will build a manifold using whatever ones are most convenient, including a back-flow (anti siphon?) mechanism or simply anti siphon valves. I will discuss these ideas with Chris. I plan on running these off of the existing water supply in the back yard to avoid the need of tapping into the main water supply for the house as the water in the back will only be needed for this purpose. If putting anti-siphon valves, it was suggested to paint them with outdoor paint to avoid having the plastic getting brittle due to UV exposure.


I have to build a manifold for the four Orbit valves I purchased. I will be hooking this up to the main water with a hose that connects to a second "manifold" which will allow access to a spigot at the house, a connector to the sprinkler system (which will have the anti-siphon), and a third connector to a valve located at the other end of the yard. I will secure this to the house

added a "fail-safe" off button. Basically, I will wire a button into the Arduino according to this site and I created an If statement which will turn all relays off if the button is pressed (I plan on wiring this into a big red easy-button or something and mounting it to the house)


The zones are supposed to all use the same type of sprinkler. It is recommended by Rain Bird to get the sprinklers to be able to reach each other for maximum coverage. The type of head will depend on the zone. Measurements of water pressure, flow rate must be determined to calculate maximum number of heads and other things. I plan on using the Vinyl tubing rather than PVC as it will not require digging a trench and destroying the yard.

Zone 1

This will be the front yard, normal sprinklers, trenched from the back.

Zone 2

Back yard, normal sprinklers

Zone 3

 Garden area, types of sprinklers will depend on what works best for a vegetable garden. Drip, or sprayers of various styles.

Zone 4

Drip zone. Since these are low flow systems, I assume we can use one system for the two beds on the front, the side and the small bed in the back.


 Since I do not want to let the world have control of my valves controlling my water, or my home theatre setup, I will create this in a secure way. Obviously I dont want it to be inconvenient for Kara to access but do not want it to be open to the outside world. There will need to be a happy middle ground between these two things. Obviously, local access only would be important. This will allow me to access it via an OpenVPN or SSH tunnel when away from the house. Perhaps a login page in order to secure it from visitors to the house. Another option (though obviously spoofable) is to restrict to specific IP addresses based on MAC address rules on the Router. This is simple, invisible to authorized users and the scope of the allowable IP addresses (on the right side of the firewall) is such that even if it were compromised, I would know who is doing it since I would have physically handed them access to my home network and realized they did something malicious.