brth.tznvy.eu

Indoor air quality monitor

Last updated: 2019-08-07
Started: 2019-01-13
Tech stack: HTML5, Vue.js, Typescript, bootstrap, Python, Flask, Sqlite, C, Arduino

A simple dashboard showing temperature, humidity, CO2, and TVOC charts at my home. An interactive demo with historic data can be browsed at tznvy.eu/airqualitydemo (pl language only).

Indoor air quality monitor mk3
The current setup
The dashboard page as of June 2019

Technical details

This was my very first Arduino project. As I have had very limited exposure to microcontrollers before, which mostly involved programming an emulated 6502 in assembly language in an undergraduate embedded systems course back in 2005, the circuit and the software have been evolving constantly since January as I learned and tried out new things.

The current architecture
The current architecture

First prototype consisted of a single temperature/humidity sensor hooked up directly to an Arduino Uno. As you can see, there were no connectors soldered to the sensor (I didn’t even have a soldering iron at that time), it was just floating in the air.

Indoor air quality monitor mk1
This setup turned out to be, as expected, extremely volatile. Every time Arduino was moved, the sensor would get disconnected and stop working.
The dashboard page as of March 2019
The earliest screenshot of the dashboard from March 2019

The netbook you can see in the photo is actually a part of the system. As Arduino doesn’t have network capabilities by itself, to post the readings online I needed to first push them to a machine that had. So the Arduino reads the sensor, formats the readings as CSV, and writes it on the serial port. The netbook have a Python script running 24/7 which listens on the port, parses the values, and posts it over Internet to a REST webservice, which in turn saves them to an SQLite database.

Between January and April, I’ve bought a soldering station and finally attached connectors to the sensor. I’ve also added a CO2/TVOC sensor, and migrated the dashboard to Vue.js and Typescript.

Indoor air quality monitor mk2

Sometime in June I was experimenting with running ATmega controllers without the Arduino board, and by August I felt confident enough to migrate the project. Not being dependent on Arduino Uno meant I could lower the clock rate to 8MHz and the input voltage to 3.3V, which was nice. I don’t feel much eco-friendlier though, as posting the readings online still requires a PC.

Indoor air quality monitor mk3

In the future, I would like to replace the serial modem with an ESP8266 wireless module, and finally retire the netbook. This should decrease the average room temperature, and lower the electricity bills as well. Also a cool thing about ESPs is that they can be flashed with the regular Arduino toolchain, which means that eventually I will be able to put the sensor interfacing program directly on ESP and drop the ATmega for even lower power consumption.