by StatiX Electromechanics, a subsidiary company of StatiX Industries
This is the open source version of the AQILITY, the free, crowd-sourced software and hardware platform for air quality detection and the upload of data to the cloud. We were simply people who thought we could do something about the Singapore/Indonesian transboundary haze, and this is what we've made. Enjoy!
Live data which is processed by the MATLAB program included in this repo can be accessed on ThingSpeak here. NOTE: The picture below is NOT the actual live data.
Raw data (which may have errors) can be accessed here, below is a sample of what to expect (this data is unprocessed and flawed, so please do not use this as official readings).
The AVR subsysem of this system uses a forked version of the DustDuino code base (licensed under the CC BY-SA 3.0 license) for an Arduino-compatible particulate sensing system. Big props to them for doing the best work in the world.
This system collects real time data from the air with several onboard sensors and relays the data from the microcontroller to the Raspberry Pi which caches all the data collected. This data is periodically uploaded onto the ThingSpeak platform, which is then analysed by the MATLAB code and the new data inserted into another ThingSpeak channel to display the actual values.
The calculation from ug/m3 to official AQI is a piecewise linear function provided by the EPA (research paper here). The system provides an LCD screen to display live unprocessed values for easy monitoring.
A full flowchart of the system can be seen as below:
- Raspberry Pi sends a single unique character (a single dot, ".", ASCII code 46) to the microcontroller
- Microcontroller has a cached copy of all the recent data taken over a certain timeframe and sends the cached data to the Pi. This data is already formatted in the CSV format.
- Pi saves the data from the microcontroller into a CSV database.
- The CSV database is read by another program and the data fed into the LCD driver on the GPIO to display air quality parameters on the LCD
- Simultaneously, this data is sent by a HTTP POST request to the first ThingSpeak channel, which contains unprocessed data.
- Data crunching takes place on the ThingSpeak platform with the MATLAB language, which calculates the correct AQI value using a piecewise linear function defined by the EPA.
- The processed data is sent to the second ThingSpeak channel which houses all the processed data.
- Has an LCD to display the air quality parameters dynamically on the sensor board itself
- Automatically uploads air quality data to the cloud (ThingSpeak.com)
- Relies on a Arduino-Raspberry Pi hybrid to achieve both long term data storage and better data transfer options such as through a cellular/3G USB dongle
- Detects some of the most common airborne pollutants and chemicals (PM10, PM2.5, H2S, CO, VOCs) for the computation of the overall pollutant indices
- The system has an initial waiting time, to wait for the AVR and the sensors to initialize and self-calibrate before taking readings.
This system is only tested on Raspberry Pis and the ATmega328P chip. There will be no guarentees that the same code (built on the Arduino platform) will run properly on other Arduino platforms or even on other AVRs such as the XMega series. The ribbon cable connector on the offical board is customized for Raspberry Pi + series ONLY, but you can manually pinout the connector for the old 28-pin GPIO.
- Chief Designer; Programmer: Pan Ziyue
- R&D/Scientific Inquiry: Chow Zi Jie & Rachit Agrwal
- The awesome open source folks at Adafruit and the DustDuino Development Team
- Requires for the Raspberry Pi's UART port on the GPIO to be freed. More info here
- The code on the AVR seems to have a discrepancy of a factor of 10 for the PM2.5 concentration, which is then manually rectified by the MATLAB code. There may be a serious underlying problem with the original DustDuino code for the calculation of concentration, or lack of calibration of the sensor (which is supposed to be factory calibrated)
- The use of a Raspberry Pi enforces the use of a 5V/3.3V logic level shifter to avoid damaging the Pi.
- The gas sensors have NO calibration, which means that there is currently no logic implemented for the equation of output voltage of gas sensors to corresponding concentrations of gases.
- The Python code on the Raspberry Pi does not automatically archive or delete old data, and requires manual work to clear old data. This is a possible area of improvement and we welcome you to submit a pull request to implement such a feature.
- Dependencies must be manually installed and the GPIO port manually configured, which reduces code reusability and portability. Suggest making a single shell script to accomplish all of that.
- Python scripts must be pre-specified in
/etc/rc.local
for it to automatically start when the Raspberry Pi is booted up.
- Adafruit_Python_CharLCD
- DHT11 Library
- PySerial (install with
sudo pip3 install pyserial
) - httplib2
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Copyright (C) StatiX Industries 2014-2016