Skip to content
Michael Strauss

OpenAurae - Low cost environment monitoring

TypeScript, Python, React3 min read

The pollution of the planet has recently attracted major attention to the quality of the air that we breath. The popular Air Quality Index provides a simple measure of the outdoor of environment quality, and allows people to easily understand whether the air they're breathing outdoors is clean and safe, or dangerously polluted by smog or other, less obvious, pollutants. However, little attention is paid to the air that we breath indoors - at times being worse than the air outside!

The OpenAurae project is a Monash University initiative to research the quality of indoor environment. The project uses a simple IoT solution with low cost air quality sensors to deploy devices across Monash's campuses in Clayton and Peninsula. This helps us to understand the environment conditions students face in the classroom and in their dormitories.

As the electrical engineering student on the project, I was responsible for the development of the device firmware and backend infrastructure of the project. This posts gives a brief rundown of the tools used and decisions made on the technical side of the Aurae project.

Unfortunately, I can't provide a link to the project dashboard for privacy reasons - there are currently devices deployed in students' dormitories. This screenshot will have to do.

Dashboard screenshot

Low-cost devices

The key element of the OpenAurae project was to use simple and cost-effective edge devices to transmit readings from a low-cost air sensor back to the central cloud.

The obvious choice for Internet-enabled edge computing is the Raspberry Pi Zero W, with it's support for Wi-Fi (even WPA2 Enterprise) and with ample analog and digital input pin. The Raspberry Pi's are programmed using Python to interface with two different air sensing modules from Plantower which together provide readings of: temperature, humidity, particulate matter (PM1 to PM50), total volatile organic compounds, carbon dioxide, among others. These readings are polled on the Pi's UART pins.

Plantower Sensor

These sensors transmit their readings every 30 seconds to the cloud servers over the MQTT protocol.

Additionally, we have recently begun experimenting with using Zigbee devices connected to the Pi. The Zigbee devices capture readings about other aspects of the indoor environment - such as whether the room is occupied, whether windows and doors are open or shut (contact sensors). Wireless temperature sensors can be placed in areas the Pi cannot be.

Cloud Infrastructure

The OpenAurae cloud infrastructure is hosted on AWS, using Kubernetes to coordinate microservices for the dashboard, API, MQTT receiver, and database.

Storing hundreds of millions of readings

The OpenAurae project has stored hundreds of millions of readings from over 50 devices deployed into the field. The storage of these readings is a large challenge, that we quickly found PostgreSQL is ill-prepared to deal with.

We quickly decided on Apache Cassandra to serve as our storage database. Cassandra enables simple partitioning of data across several physical servers using hash-keys, also allowing incredibly fast read performance for efficient queries to be run on the dashboard and for analytics purposes. The figure below (source: Instaclustr) provides a simplified view of how incoming readings assigned to different nodes using keys formed from identifying columns. This allows Cassandra to pinpoint the phsyical location of data and the location in storage for extremely efficient reads later.

Cassandra Data Partitioning

The use of Cassandra on Kubernetes has been greatly simplified by the use of the Rook project, which provides simple, out of the box configured Cassandra resources for Kubernetes. Using the fantastic tool Cain, backups are simple to administer using a Kubernetes cronjob. These backups have proved extremely helpful when migrating our hosting from our own AWS account to a university provided one - the keyspace and all data was restored in a matter of hours.

A live dashboard

One of the major goals of the project was to make data from the air quality devices easily accessible - rather than keeping data stored in a slow, tape-like archive, the data should be easily accessed with a simple interface.

For the project, I have developed a React application in TypeScript to provide a real-time view of the air-quality from our sensing devices. Using the excellent Apollo GraphQL client, the dashboard can in near real-time pull data from the API. The API is written in Python as a GraphQL server interfacing with Cassandra.

These results can be retrieved in under a second from over a hundred million readings.

Dashboard screenshot

Future Work

Currently, the project's readings are being used in a variety of research projects. Future work for the devices is to run the actual Python software on the device in a Docker container, so that the firmware can be updated over the air.

In addition, we hope to deploy our devices into areas where people are at risk of harm from dangerous air more commonly - such as in mine shafts, or even on public transport. Hopefully there is more progress to report in 2021!

© 2021 by Michael Strauss. All rights reserved.