Water depth measurement uses an analog pressure sensor connected to pin A0. The sensor sits at the bottom of the water tank and outputs a voltage proportional to the water column height above it, with the relationship calibrated such that 3.3 volts represents 3.2 meters of water depth. The Arduino's 10-bit analog-to-digital converter reads this voltage, and a simple linear mapping converts it to depth in meters: depth = (voltage / 3.3) × 3.2. This measurement is critical for water conservation decisions—the autonomous algorithm must know precisely how much water remains to determine whether aggressive fire defence is sustainable or whether conservation measures must take priority. The sensor's bottom-mounting position means that any water in the tank will be detected, even as levels fall to the minimum safe pump intake height.
Flow measurement employs two Hall-effect pulse sensors, one on the DN15 mains water feed line and one on the DN50 pump output line. Each sensor contains a small turbine that rotates in the water stream, with a magnet attached to the turbine and a Hall-effect sensor detecting each magnet passage, generating one pulse per rotation. The pulse rate is proportional to volumetric flow rate, with the proportionality constant depending on pipe diameter and turbine geometry. The DN15 sensor provides approximately 450 pulses per liter, calibrated by the manufacturer, while the DN50 sensor provides approximately 60 pulses per liter though this value requires field calibration by running the pump at a known flow rate and counting pulses over a timed interval.
These sensors connect to interrupt-capable pins on Arduino AR2 (pins 2 and 3), allowing pulse counting to occur asynchronously in interrupt service routines without requiring the main program loop to poll them. The interrupt service routines implement 8-millisecond debouncing by checking the time since the last pulse and only incrementing the counter if sufficient time has elapsed, preventing switch bounce or electrical noise from causing erroneous counts. Every 100 milliseconds, the main loop reads the accumulated pulse counts from the previous 100-millisecond interval, clears the counters to begin the next interval, and converts pulses to flow rate in liters per minute. The conversion first calculates pulse frequency in Hertz by multiplying the pulse count by 10 (since we're counting over 100-millisecond intervals, 10 intervals per second), then divides by the pulses-per-liter constant and multiplies by 60 to convert from liters per second to liters per minute.
<< | | >> |Table of Contents>
