Earlier this year I forked the software used to control the AirPi, a small board which fits a Raspberry Pi to monitor environmental phenomena such as temperature, humidity and air pressure along with air quality measures including Carbon Monoxide, Nitrogen Dioxide and VOCs. Having made quite a lot of changes, I’ve just tagged a v1.0 release on GitHub, so thought it might be prudent to take a look at what’s been added and/or amended.
The original software was released by one of the projects instigators, Tom Hartley. This was forked by Fred Sonnenwald as part of the pi.gate.ac.uk project – he added a number of useful features, not least of which was the web server to display figures and pretty charts. I forked from his work because I needed to make a couple of tweaks, but they turned into a fairly major update.
The original release of the software would read from sensors and either print the results to screen or send to a Xively feed. At the end of 2013 the code was updated so that sensors and outputs became modular. Fred Sonnenwald’s update added support for a number of new sensors (including the TGS2600 air quality sensor), output to CSV files, the aforementioned HTTP output, and the ability to dial in calibration functions for individual sensors. The latter is particularly important, as the cheap nature of the sensors used by the AirPi mean there is great variability between individual instances of the same model even from the same production run. Fred did a great post giving an initial look at interpreting readings from the AirPi.
I stood on Tom and Fred’s shoulders, and added a number of other features, including:
- A host of ‘UI’ improvements, either clarifying existing output or adding more information for users.
- Output plugins for Thingspeak, dweet, JSON, RRD and ASCII graphs.
- A ‘notification’ system to send SMS, email or Tweet if an error occurs.
- Ability to start sampling automatically with no user interaction when the system boots.
- Record metadata with results.
- Control script to standardise different ways of running the software (and stopping it).
- Averaging, i.e. take readings every 10 seconds then average each set of six readings for a minute average.
- Full documentation and code templates.
Full details of all the changes can be found in the README.md file in the root of the repository, and there are now full usage instructions in the `docs` folder – see the file `usage.md` to get started.
This commit was tagged as v1.0 because it’s now got in all of the features I need to support some ongoing work I’m doing with the Atmospheric Chemistry group at the University of Leicester. There are also some additional features which came about as a result of a thread on the AirPi forum – thanks to participants there for ideas and bug reports. I won’t be adding any more new features at this point, but will be doing bug fixes and a bit of tidying, and probably updating the code to Python3 at some point too.
The next major piece of work is calibrating each of the three AirPis we have under standard conditions, so that we can create the custom calibration functions needed to convert the resistance readings into standard units such as ppm. It’s absolutely my intention to keep updating the software and this blog with the results of that work, particularly as it reveals more about the responses of the individual sensors. For now, any questions or queries can be raised in the AirPi forum, or by questions and bug reports on GitHub too.