Chapter 4 Sensors in WildlifeSystems
The WildlifeSystems platform comes with support for some popular existing environmental sensors, although there are many on the market and the range available is subject to constant change. The modular nature of WildlifeSystems allows for new sensors to be easily integrated if the need arises.
4.1 Sensors included in the base system
The Raspberry Pi does not come with environmental sensors, however there are several onboard sensors that are used to monitor the operation of the hardware, to prevent crucial components from overheating, including the temperature of the CPU and GPU chips. WildlifeSystems provides access to these sensors through the
sensor-onboard package, as well as providing some software sensors that report the free memory and free SD storage available. These can be useful for detecting and resolving possible issues on a sensor node before a serious problem arises.
4.2 Installing sensor support
Support for sensors is installed as part of the node installation process, however it is possible to install the
sensor-control abstraction layer onto any Raspberry Pi system using the command below.
wget -O - https://raw.githubusercontent.com/Wildlife-Systems/sensor-control/main/install | sudo bash
This will install the
sensor-onboard scripts into the system, as well as installing a small of number of supporting packages if they are not already installed.
4.3 Reading data from a sensor
The sensor read command,
sr, can be used to read sensor data.
This will give a JSON string listing information about each sensor, and the current reading. This information can be presented in a more human readable form by piping the output to the program
jq, a command line JSON processor.
4.4 The sensor reading process
The sensor reading process in WildlifeSystems has five steps.
srcommand identifies which sensor script to route the request to.
The sensor script calls the
sc-prototypescript to obtain a template (“prototype”) of the JSON request.
The sensor script access the relevant sensor(s) and populates the values in a template for each sensor reading, before returning a JSON array of populated readings to
srscript populates additional information for each reading, providing the
srreturns the finalised JSON array to the user.