This was submitted by Karl Denninger

Application note for using Sprinkler control with both X10 and
Applied Digital RLY8-XA interfaces.


1. Compile and install the HOME DAEMON software available from
 http://www.mcs.net/~karl.  Make sure the Applied Digital driver
 is installed ("x10-appdig").  This package requires a BRIDGE
 and DOES NOT use the CPU-XA.  Wire power and communication per
 the standard APPDIG diagrams.

2. Before starting the package, configure at least one APPDIG RLY8XA.
 READ the documentation in the HOME DAEMON software for this
 procedure; its a bit tricky and must be followed exactly or
 you'll get odd (or no) results.

 In the example that follows, you have a MASTER water valve (from
 your water source) and several ZONE VALVES.  The rules for
 operating the system are:

 1. You MUST open the master valve when you open any zone
 valve, otherwise you get no water.  There is no pump
 relay; this system sources water from municipal.
 If you had a pump (ie: you draw from a lake or well)
 then you would want to either substitute the master
 valve drive for the relay drive to enable the pump
 (CAUTION - the RLY8 will NOT safely drive most pump
 motors!  Use a contactor and drive the contactor coil
 from the RLY8 or you'll fry the contacts on the RLY8
 module!)

 2. You MAY NOT open more than one zone valve at a time;
 if you do the system will get insufficient pressure to
 the zones and the sprinklers will malfunction.  One
 exception to this is that we have an x10 event that
 trips both back yard zones if we get motion while the
 alarm is armed; this "sprinkles" the potential intruder
 (or cat, as the case may be) for a couple of minutes :-).
 While the rotors on those zones aren't "full force" when
 this happens, its more than enough to soak the intruding
 animal (whether human or rodent)

 3. The "pre-programming" of the RLY8 module sets a watchdog
 timer for 30 seconds; if we do not talk to the module
 for a half-minute, all relays are turned off.  This is a
 failsafe to prevent watering your lawn all night (or all
 month if you're gone on vacation!)

 4. The event code sets a SECOND watchdog on each zone through
 an event that turns off the zone(s) after a maximum time
 is reached.  This event should NEVER fire; its there for
 the case where you screwed up the programming of the other
 event chains and accidentally left the sprinklers on!

 A FINAL failsafe is that we shut off all sprinkler zones
 each day at 12:00 noon.  We do this because in our area
 it is prohibited to sprinkle from noon to 6:00 PM, and
 violating that ordinance can lead to stiff fines.

3. The relays are wired with all COMMON terminals connected together
 on a bus with this leading to one of the transformer terminals
 (24VAC; standard sprinkler system issue stuff).  Each ZONE valve
 wire is connected to a relay output's NO contact.  The common ZONE
 VALVE wire is connected to the other transformer terminal.  This
 causes a VALVE to be actuated when the relay is turned ON, and
 disabled when turned OFF.

The event code which manages this process is as follows (note that this
is a partial file; the other events and declarations are omitted, and in
particular there are a couple of X10 devices missing from the first
declaration section that are necessary for a working file - the back
yard floodlights!)  See the HOME DAEMON documentation for the format of this
file; it contains four declaration sections followed by event listings.

This is an ACTUAL working code snippet with these exceptions (it was cut
directly out of my current operating sprinkler configuration).......


      BEGIN event file

B15 T Backyard-Motion
H1 T Alarm-Armed_Away
*
Unused - Old Exit Illumination
Outdoor-Dark
Evening-Lights
Sprinkle-Lawn
Sprinkle-Garden
Sprinkle-Intruder
*
Button-Sprinkle_Garden
*
Sprinkler-Master_Valve
Sprinkler-East_Front
Sprinkler-Center_Front(Garden)
Sprinkler-West_Front
Sprinkler-West_Back
Sprinkler-East_Back
*
Back Yard Motion - Alarm Armed
Night
J Backyard-Motion ON
X Alarm-Armed_Away ON
+
x Backyard-Floods ON
x Backyard-Porch_Light ON
x Backyard-Motion OFF
O Sprinkler-Master_Valve ON
O Sprinkler-West_Back ON
O Sprinkler-East_Back ON
V Sprinkle-Intruder 1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sprinklers - Zone 1
o Sprinkler-Master_Valve = 0
o Sprinkler-East_Front = 0
o Sprinkler-Center_Front(Garden) = 0
o Sprinkler-West_Front = 0
o Sprinkler-West_Back = 0
o Sprinkler-East_Back = 0
V Sprinkle-Lawn = 1
V Sprinkle-Garden = 0
+
V Sprinkle-Lawn 1
O Sprinkler-Master_Valve ON
O Sprinkler-East_Front ON
O Sprinkler-Center_Front(Garden) OFF
O Sprinkler-West_Front OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back OFF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sprinklers - Zone 2
o Sprinkler-East_Front = 1 0:40
V Sprinkle-Lawn = 1
+
V Sprinkle-Lawn 1
O Sprinkler-Master_Valve ON
O Sprinkler-East_Front OFF
O Sprinkler-Center_Front(Garden) ON
O Sprinkler-West_Front OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back OFF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Sprinklers - Zone 3
o Sprinkler-Center_Front(Garden) = 1 0:30
V Sprinkle-Lawn = 1
+
V Sprinkle-Lawn 1
O Sprinkler-Master_Valve ON
O Sprinkler-East_Front OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back ON
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Water Garden Off
V Sprinkle-Garden = 1
o Sprinkler-East_Back = 1 0:30
+
V Sprinkle-Garden 0
O Sprinkler-Master_Valve OFF
O Sprinkler-Center_Front(Garden) OFF
O Sprinkler-East_Front OFF
O Sprinkler-West_Front OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back OFF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Turn Off Sprinklers (at noon every day)
T11:55
+
V Sprinkle-Lawn 0
V Sprinkle-Garden 0
O Sprinkler-Master_Valve OFF
O Sprinkler-East_Front OFF
O Sprinkler-Center_Front(Garden) OFF
O Sprinkler-West_Front OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back OFF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Shut off Sprinkler - Intruder
V Sprinkle-Intruder = 1 0:02
+
V Sprinkle-Intruder 0
O Sprinkler-Master_Valve OFF
O Sprinkler-West_Back OFF
O Sprinkler-East_Back OFF
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


         End file


How this all works:

1. At 4:00 AM on even days and weekends  ("Water Lawn" event) the
 "Sprinkle-Lawn" variable is set.

2. When this variable is seen to be turned on AND all zones are off,
 the first zone is watered.  Each zone "falls through" from there,
 looking for the amount of time the previous was enabled and carring
 through until all five zones have been watered.

3. Likewise, Wednesday and Thursday (but again, only on even days)
 we do the same but only for the "Garden" (Zone 2) and the east
 back yard section (Zone 5).  This is to "even out" the "rainfall"
 that these areas receive.

 Note that in both cases if you are already watering something
 when this process is supposed to initiate it will be ignored (this
 is accomplished by testing ALL zones for OFF before turning
 anything on).  This allows you to manually start a cycle which
 would otherwise "run into" another and not have them interfere
 with each other (the first will run to completion and the regular
 timed event will be ignored).

4. If motion is detected in the back yard AND the alarm is armed
 (this is an X10 state) then we turn on the back yard zones for
 two minutes to make sure the cat (or cat burgler) gets nice
 and wet.  This timer is re-tripped on each activation, so
 the water keeps going until the motion stops (the sprinklers
 don't trip the MS10s that I am using - thank God!).  It is trivial
 to put X10 triggers into this event file; you could have a Leviton
 6400 button, for example, that enables watering if you want (a
 manual "water the garden" button, for example).  The motion example
 shows how you can "cross the bridge" between X10 (or SECU16) inputs
 and the RLY8 outputs.

5. We safeguard against overwatering with zone protection (watchdog)
 events along with the RLY8's internal watchdog.  We try to prevent
 manual overrides from running over the noon hour by shutting off
 the zones at noon every day (even if they're already off; that
 does no harm; we actually do this five minutes before noon in
 case the idiot cop in the neighborhood's watch is off by a few
 minutes).

6. Note that from the HOME DAEMON web interface you CAN manually trip
 any event.  This allows you to enable watering of either the lawn
 or garden on command with the click of a mouse.  NOTE THAT IF YOU
 DO THIS YOU CAN OVERRIDE THE DAY AND TIME RESTRICTIONS, SINCE
 MANUAL ACTIVATION OF AN EVENT DOES NOT CHECK ANY OF THE TESTS!!
 There is no current "lockout" provision to prevent you from getting
 fined (by the local gendarme) in this case if you do something
 stupid.  HOME DAEMON's web interface is a CGI program which is
 typically run with authentication enabled under APACHE or another
 web server; note that it is a VERY BAD IDEA to enable this
 capability without installing authentication around it (as doing so
 will allow anyone to both see the state of your system and execute
 any event you have defined)


What can be added to this:

1. A rain gauge.  Current code (using a SECU16) will trivially support
 a simple "wet/not wet" rain gauge (ie: the cork disk models) with
 nothing more than a test to see if the switch is open or closed on
 the activation of the first "enable" trip.  The next revision of
 the code will support arithmatic computation of "rainfall" for
 tipping-bucket gauges, allowing VERY precise watering control.
 NOTE THAT THE CURRENT CODE CANNOT SUPPORT THESE DUE TO LACK OF
 SCALING SUPPORT IN THE SOFTWARE - this is planned for the next
 release of HOME DAEMON (that release will also support temperature
 sensors on the SECU16 if I can find a suitable probe for this
 purpose).

         END OF FILE