Software apps and online services
Living in Almaty, Kazakhstan, it is obvious that clean air is a scarcity. Looking over a balcony you could see a large cloud of smog hovering over the city. The discomfort from walking in such a polluted city urged me to create a compact device that can measure the air quality of a region. This device became the MeteoStation. The device works by collecting data from four different sensors and then saving it to an SQLite database.
The MeteoStation can be attached in your home, in your office, or anywhere in particular where you can find a power source. The data that it is collected can easily be monitored and analyzed.
This is a small website that I built to visualize the data. I used Chart.js to graph the charts below.
You can also use various bot APIs to output the data. I built a simple Telegram bot that posts weather data to a chat on queue.
One problem that I encountered whilst working on this project was that the HM3301 and SHT20 share the same I2C address. This was a problem because, out of the box, Raspberry Pi 3 has only one accessible I2C bus (i2c-1). To fix this issue, I needed to access the hidden I2C bus that is used for the built-in video controller (i2c-0). This can be achieved by adding this line in /boot/config.txt:
Another problem that I stumbled on was that the CCS811 sensor can only read data if the I2C bus is configured to a certain baud rate. To fix this problem I added this line in /boot/config.txt:
Lastly, I discovered that the CCS811 sensor needs to be periodically reset in order for it to collect the most accurate data. To address this issue, I programmed a method in the ccs811_linux repository that resets the sensor, and I also added a command line option that would reset the sensor before executing which can be found attached below in runner.cpp.
Since the device is intended to be mounted somewhere, it is strongly advised that your Raspberry Pi is also connected to the internet. A good tutorial on how to setup Wi-Fi on the Raspberry Pi 3 can be found here: