in Photo 1 and Photo 2. This sensor is essentially a small
‘fan’ with magnetic tips that spin past the Hall effect
device when water flows through the sensor body. The
sensor is provided an operating voltage of 5 VDC and
returns a square wave signal that corresponds to the water
flow. This signal in connected to RA2 which is configured
to act as an external interrupt.
The first step in developing the software was getting
real world values for the water flow in all the zones of my
irrigation system. This was accomplished by writing code
that just counted the number of pulses in one second and
displayed the result on the LCD. These results were
verified by an oscilloscope as shown in Photo 3.
The values from zone 1 were a ‘normal’ reading of 71
cps, and 89 cps when an unused port of a two-port
manifold was opened. This represents a typical problem of
a drip tube leaking or being blown off a manifold
connection with the resultant increase in water flow.
The Irrigation Watch is configured to remember the
‘normal’ cycles per second value, plus a few extra cps in
EEPROM. This limit is then compared with the flow when
that zone is
activated by the
controller and — if
exceeded — will
trigger an alarm
will also trigger an
alarm condition if
there is water flow
without a zone
pipe before the irrigation valves or an irrigation valve that
is not shutting off (causing that high water bill).
In order to develop the software for the Irrigation
Watch without running water through the irrigation
system, I developed a simulator for the X-Core unit and
the water flow sensor. This simulator used another
PIC16F1829; the schematic is shown in Figure 2. It
features four outputs that provide the zone inputs to the
Irrigation Watch PIC and a square wave output to simulate
the flow sensor.
The flow sensor frequency is controlled by the voltage
from a pot connected to a simulator PIC input configured
as an ADC (Analog-to-Digital Converter). The simulator
also has five weak pull-up inputs used to start the four
zones and one to start water flow simulation without a
zone input to the Irrigation Watch. The prototype circuit is
shown in Photo 4; the Irrigation Watch PIC is on the left,
while the simulator PIC is on the right.
Power input to the Irrigation Watch is five volts at 50
■ FIGURE 2.
■ PHOTO 3. Reading real world values for one of the
irrigation zones. An oscilloscope verifies what is on
the LCD display.
■ PHOTO 4. The prototyped circuit with the Irrigation
Watch PIC on the left, simulator PIC at right, reset
switch, and testing key pad on the left. Flow rate is
converted from counts per second to gallons per
minute in software.
September 2017 21