*aqi_monitor.ino* is the arduino script running on the **nodeMCU ESP8266** microcontroller. The microcontroller posts data to the flask backend on a regular interval. This is a legacy option, not in use any more now due to it's limitations.
## aqi_monitor_py
Rewritten sensor script in Python, runs on a raspberry pi instead.
A [flask](https://pypi.org/project/Flask/) based application that takes the data from the ESP8266 for processing and storage and renders a HTML/CSS/JavaScript frontend from template.
[Postgres](https://www.postgresql.org/) handles the storage of the measurements. The data is split up into two different tables, one for aqi related data and one for the weather data.
Python interacts with Postgres with the help of the [psycopg](https://www.psycopg.org/) library.
The flask app is recreating the graphs to visualize the aqi, PM 2.5 and PM 10 values on an interval. Aggregating is done with the [Pandas](https://pandas.pydata.org/) Python library and the graphs are created with [matplotlib](https://matplotlib.org/).
New data is pulled from the backend on a interval with JavaScript and XMLHttpRequest library.