This article is part of the DIY LabVIEW Crew Online Group. Join Today!
When I moved in, I was fortunate enough to already have an existing sprinkler system installed at my house. Unfortunately, the system had not been used in years and nearly everything was either broken or severely outdated. The property has nine zones that were run from manual on/off valves. The valves were old and rusted and most of the sprinkler heads needed cleaning, repair, or replacement. Discovering where the pipes lead was a matter of turning on the valve and listening for the gurgling in the yard. At that point, I began replacing sprinkler heads where necessary, fixing all the leaks, making sure I had good water coverage, and generally fixing the plumbing so that it would work well as a manual system.
Figure 1 - Many sprinkler heads needed cleaning or replacing in most cases
After the plumbing is good to go, the automation process begins with obtaining electronic valves to replace the manual ones. These electronic valves are fairly inexpensive from any home improvement store (~$12/valve). You need one valve per controlled zone
Figure 2 - The anatomy of the electronic anti-siphon valve
You want to always buy anti-siphon valves, which prevent backflow, basically, so that the water from the ground or in the pipes in the yard can not get back up into the water supply. Valves also include a flow control knob as well as a 24VAC-activated solenoid valve.
Figure 3 - Manifold of multiple zones from one source pipe
The main idea of wiring the system is to get one control line and a common ground from each electronic solenoid routed to a good location in the house for a controller. The central location for me was the garage. For wiring, it pays to buy the nice multi-conductor sprinkler wire. This type of wire is larger gauge and solid core. It is typically rated to run in outdoor environments and can be buried if needed. I ran mine along eves of the house and other out-of-sight places using screw-in wire hangers.
Figure 4 - Wiring using multi conductor wire and plastic screw-in hangers
I certainly could have gone at this point and picked up a nice sprinkler controller for around 50 dollars. However, working at National Instruments does have its perks. I was able to get a traditional Fieldpoint controller that was literally thrown away, because it was heavily used and the compact flash was corrupted. After getting some new flash from an internet store, I had it up and running, saving it from being tossed in a landfill somewhere. Although I did not replace the flash with industrial-grade solid state memory (like it originally came with) everything is working great (this is of course not recommended by NI in any way, so please do not call in and say that the flash you bought from Ebay is not workig right. And then quote this blog as proof that you can use consumer grade flash... anyway.....). In addition to the NI controller, I got two 8-channel relay modules to fully control my 9-zone system, a wireless access point so that it would be on my home network, a 24V AC Rainbird plug-in power supply for solenoid activation, and a "Powered by LabVIEW" sign to fly the flag of coolness.
Figure 5 - Complete controller setup
The basic system uses the relay modules to energize the control line of each solenoid with the 24VAC signal. This opens the corresponding water valve and turns on the appropriate sprinkler zone.
Figure 6 - Closeup view controller system
The basic software design of this system is a state machine created in LabVIEW with a while loop and a case structure. Unfortunately, when I created the control system, the NI Statechart Module had not yet been released, but I have since mocked up the system as a LabVIEW Statechart, even though statechart is not actually running on the controller (this is a possible future improvement).
Figure 7 - Statechart of the Sprinkler control system
The main mode of the system is the time check state where it is polling the current time/date and comparing it to the start time configured for the system. When the start time is reached the program enters the "Sprinkler Sequence" state where it flips the relay for each zone and keeps it on for the specified number of minutes. One it has finished with the sequence the program returns to polling the time. I also have a web-enabled user interface using remote front panels. With this feature I can log onto the system from a laptop from anywhere in my home network and potentially anywhere with an internet connection. On the UI, clicking the configure tab gives me the choice of setting start times and duratoins for each zone on each day of the week. In this tab, the user can also set the time and date, reinitialize, and disable the sprinklers. Disabling the sprinklers is easy way to shut it down temporarily when it rains.
Figure 8 - Main user interface to the system running on the LV Web Server
Using a hyperlink in a browser I see this interface which has LEDs for each sprinkler zone and a chart of the zones and rough coverage areas overlaid onto a satellite picture of the property. This way I can get a quick picture of what zones exist, where they are covering, and when controlling manually which sprinkler I am turning on and off.
Figure 9 - Configuration tab of the User Interface
Moving to the tab configuration you can see the user interface for setting the times a durations for each zone on each day along with buttons for setting time/date of the system, reinitialize, and system disable. The configuration tab still show the sprinkler map for reference.
The first day that I set the sprinkler to turn on in the morning by themselves, I got up, made coffee, and woke up my wife to come to the window and watch as our clock hit 6AM. Right on cue, the Zone 1 sprinkler popped up and spread water beautifully across the lawn. My wife went directly back to sleep while I went outside and watched the whole show.
Figure 10 - Zone 1 on and working
As of now the system functions very well and has been running non-stop without downtime for nearly a year. I have been extremely impressed with the reliability of my Fieldpoint dumpster diving. It also makes a great "demo" when friends come to visit. It is safe to say that most people have not seen anyone turn on their home sprinklers wirelessly from a laptop web browser. For my NI friends, they completely understand the system but are just impressed/embarrassed-for-me that I spent my own time creating such a system. Many people ask, "Can't you get a sprinkler controller at Home Depot for 30 bucks that will do the same thing?" to which I respond, "Can those controllers do this?" - as I pop open my laptop and step out on the back porch.
Another thing about my system has that you do not get from pre-done solution is the complete configurability and openness you get with LabVIEW. Some future improvements that I plan to implement include:
Feedback to the system from a rain gauge.
Feedback to the system from other sensors like soil moisture, humidity, temperature, etc.
Feedback to the system from online forecasts (ex. weather.com)
Use an online time server to automatically set the time and date correctly (this feature keeps it perfectly up-to-date but more importantly resets it in case of a power outage).
Ability to control my sprinklers from any internet connection anywhere in the world (requires some security).
Ability to control my sprinklers from my phone.
Datalogging and better error reporting.
Piece this system in as just one part of my bigger home automation system.