■ FIGURE 1. The Wi-Fi sprinkler schematic.
A Mere Matter
Figure A is what the Wi-Fi
sprinkler home page looks like
on the screen of the iPod.
When you click on the zone
number, the light above that
number illuminates and the
zone starts sprinkling. As you’ll
see from my HTML code, it
was all written by hand by an
HTML novice (me).
For example, if you click
on the number 6, you see the
screen in Figure B. The
automatic sprinkling page
looks like Figure C. The
schedule for which zone to
turn on, on what day, when,
and for how long is kept in a
Flash memory file on the
Rabbit module, and is edited
on the automatic page.
The “zone info” page is
just a list describing which
zone number corresponds to
which areas of the yard.
First, we disable the relays (relay_disable() just
sets the 4515 Inhibit bit). Then, we write the 4515
internal latch with the new zone number which is
1; it’s decremented because the zones are
numbered 1-16, while the 4515 outputs are
numbered 0-15. The “current_zone” and
“next_zone” code lets us remember that we’ve
now turned on a zone because we don’t want to
come through this code repeatedly, disabling the
relays only to turn the same one back on again.
Then, the relays are re-enabled. The
lcd_show_netclk call causes the LCD display to
show the zone being manually sprinkled, and the
Bit WrPortI call is Rabbit-ese for turning on one bit
of port D which turns on the LCD backlight. I
wrote the relay_* routines and put them into a
RPC_RELAYS.LIB library so that the C code would
be easy to understand. The next time through, we
follow a different path through the code, leaving
the relay/zone on until the user says to turn it off.
(This prevents the relays from chattering.)
Deciding when to turn on a zone for
automatic sprinkling, and how automatic and
manual sprinkling should interact with each other
was more difficult. My philosophy was that in case
of conflict, manual sprinkling should prevail, and it
should disable automatic sprinkling until auto is
later re-enabled. This is to prevent confusion while
standing out in the yard. Look at the C code for
February 2011 37