Chapter 8 Implementing new sensors
New sensors should be implemented as new Debian packages, and submitted via GitHub. Packages have a standard format, and should be named sensor-<sensor-name>
where <sensor-name>
is short, descriptive of the sensor (e.g. model number), and unique within the WildlifeSystems ecosystem.
As many people implement various sensors on the Raspberry Pi, it is likely that some sort of solution is already available, that can be tweaked to output readings in the standard format required. However, you must ensure that any licensing conditions are met. In particular, an open license is required if submitting your sensor package to WildlifeSystems for inclusion in the ecosystem.
8.1 Reading the sensor
File sensor-<sensor-name>
provides the functionality to read the protoype JSON, populate the JSON with sensor readings, and print the output.
The file can be written in any programming or scripting language, but to prevent overhead consideration should be given to minimising the number of new packages installed.
8.1.2 In Python
#!/
import os
import json
# Read the prototype JSON
stream = os.popen('sc-prototype')
output = stream.read()
# Pre-populate with sensor metadata
temperature = json.loads(output)
temperature["sensor"] = "bme680_temperature"
temperature["measures"] = "temperature"
temperature["unit"] = "Celsius"
# Code to read sensor and output in variable `sensor_reading`
temperature["value"] = sensor_reading
# Output the JSON in an array
print("[",json.dumps(temperature),"]")
8.2 Submitting packages to WildlifeSystems
Submitting packages (where licensing allows) to WildlifeSystems allows the ecosystem to be developed and sustained collaboratively by the user community.
Packages can be sent to the administrators as a compressed file, or a request can be sent to fork an existing GitHub repository. Contact details can be found at https://wildlife.systems/contact.html.