Create Arduino Sprinkler Controller Code
Create Arduino Sprinkler Controller Code

In its most basic form, the controller manages a queue and turns on/off switches. That’s it.  Nothing else.  All other features should be in the cloud!

Managing the queue only needs a few basic functions:

1) add or remove one or all irrigation zones to the queue
2) ensure only one zone is on at a time (need a traffic cop)
3) report out the status of the queue

The irrigation controller also has two basic protections
1) Before turning on a zone, it requires knowing when to turn off, even if communication with the cloud is lost.
2) If power goes out, the controller reverts to offThis code turns your Arduino Uno with a Connected 8 channel relay into a 8 zone sprinkler controller.  

Some features of the code:
1) Creates a queue to turn on or off a specific zone or all zones
2) Performs the queue in numerical order from Zone 1 to Zone 8
3) Works with up to 8 zones, although you can use less
4) Allows zone times to be communicated as a string which is decomposed
5) Once a zone is turned on, the Arduino knows when to turn it off (no additional communication needed)
6) The system turns off if power is lost and stays off when power is returned, unless new commands are sent
7) Utilizes timer functions to maintain communication with the Ardunino while zones are running
8) A Traffic Cop feature ensures only one zone is running at once.
9) Designed to work with SmartThings ecosystem. Please see compatable device manager code in this repository.  For a full description of the project see: http://build.smartthings.com/projects/smartsprinkler/
anienhuis/smart_sprinkler,d8adrvn/smart_sprinkler