mode for remote control or firmware update. Moreover, most
configuration parameters can also be remotely changed during
normal operation through remote procedure calls (RPC).
Fig. 8 shows the layers of the full custom software structure of
the gateway. The top-level operation is controlled by an appli-
cation coordinator. On the one hand, it accepts service requests
from various gateway tasks (e.g., as reaction to internal or ex-
ternal events, such as message queue nearly full or alert message
received from field sensors, respectively). On the other hand, the
coordinator triggers the execution of the tasks needed to satisfy
the service request currently served. Also, the coordinator im-
plements a priority-based service preemption allowing higher
priority service requests to interrupt and take over the gateway
control from any lower priority service requests currently being
served. This improves the gateway forwarding time of alert mes-
sages, for instance.
The application tasks implement specific functionalities for
the application, such as the message queue, field message han-
dling, sensor node status, field message postprocessing, RPC,
etc. They are implemented as round-robin scheduled co-routines
to spare data memory (to save space and costs the gateway uses
only the microcontroller internal RAM).
Manual configuration during sensor node deployment is not
necessary because the field node IDs are mapped to the state
structure using a memory-efficient associative array. The node
IDs are added as they become active in gateway range up to
1000 sensor nodes and 10 peer gateways, while obsolete or old
entries are automatically reused when needed.
The gateway average current consumption in normal opera-
tion is 1.6–1.8 mA, depending on sensor node and peer traffic.
It can rise to almost 500 mA during GPRS traffic in worst con-
nection conditions. Nevertheless, the gateway can operate for
about one year on a D-size lithium battery in some applica-
tions, e.g., when it receives field data from only one sensor
node and without peer gateways. In such cases, the average cur-
rent decreases to 1.2 mA with the peer radio turned off, which
amounts to h days in a year
time. From the 19 Ah charge of a D-size lithium battery (e.g.,
Tadiran TL-5930) this leaves for
GPRS traffic per year. At the maximum rate of 480 mA this
means more than 2’50” of GPRS data transfer daily, more than
enough to upload the data collected from one sensor.
In fact, gateways deployed inside sewages for level moni-
toring applications receiving data from one sensor node and no
peers operate for one year on 19 Ah batteries, which is con-
sistent with the theoretical calculations above. It is also worth