November
2005, Issue 184
Water
Pressure Sensor
ZigBee-Based
NozzleMon Aids Firefighters
SOFTWARE
DEVELOPMENT
The
software for this project is based on the lighting demonstration
software that comes with Freescale’s SMAC package. The
pump panel unit’s code simply sends out a polling message
for the nozzle unit to respond and then waits for a
response or a timeout. The only possible responses from
the nozzle unit are either a nozzle pressure to report
or a “nozzle out of control” message, which is encoded
as a nozzle pressure of 255 psi (an otherwise impossible
reading).
Managing
the front panel switches and displays is a straightforward
process, especially because the LCD assembly contains
a Hitachi HD44780U controller that’s compatible with
the routines included in the LCD interface in the SMAC
package. More sophisticated communication and display
management will be required with multiple nozzles to
monitor.
Multiple
nozzles can be accommodated in the same software structure
by polling to see how many nozzles are enabled and adjusting
the front panel to display the pressure and state of
the nozzles. Polling each of the nozzles enables the
pump panel unit to control the flow of the data and
manage the available bandwidth as opposed to having
the nozzle units broadcast continuously. This should
keep enough bandwidth available for other 802.15.4 applications
to be used on the fire scene.
The
only computations performed by the pump panel unit are
the current average pressure and the status of the set
pressure warning. The average pressure is the sum of
the last 16 valid readings right-shifted four places.
The set pressure is determined by storing the current
average when you depress the red button. After it’s
set, the current average is compared with the stored
pressure upon each valid pressure reading. If the current
average is more than 10 psi above or below the set pressure,
the LED lights up and a message appears.
The
nozzle unit code is also simple. It waits for a polling
request from the pump panel unit and takes readings
from its sensors when a request is received. The response
is a single byte that’s either the current pressure
or a flag that the nozzle is out of control. The pressure
value returned is derived from using the actual reading
from the sensor to index into a look-up table of values
that was collected during the device’s calibration (using
the pressure gauge mounted on the brass nipple).
Listing
1 shows the code to read the pressure sensor and
index into the look-up table. Keeping the response payload
to a single byte reduces the required bandwidth and
pump panel unit’s computational requirements.