This is a place to show off what went into building my AQI measuring station. https://www.lpb-air.com/
Go to file
simon 1ec5023c53 some example postgresql commands in use 2021-03-13 19:13:50 +07:00
aqi_monitor wifi keeps droping, trying some wifi reconnect logic. 2021-02-23 18:49:36 +07:00
backend backend creating bar chart for hourly avg aqi values 2021-03-08 12:40:16 +07:00
env added postgres to docker for later integration 2021-02-16 17:57:25 +07:00
frontend restructured to allow preloader to run async, for now with timeout... 2021-03-13 19:11:25 +07:00
helper_scripts helper scripts for import, testing and backup 2021-03-05 18:35:53 +07:00
postgres some example postgresql commands in use 2021-03-13 19:13:50 +07:00
.gitignore newest updates notification via php incl into colorbox on top 2021-03-07 22:03:35 +07:00
LICENSE.md minimum viable product 2021-02-16 10:40:22 +07:00
README.md context about pandas and matplotlib in the backend 2021-03-08 11:14:38 +07:00
deploy.sh adding helper files to sync up to deploy and update automatically 2021-03-11 18:10:19 +07:00
docker-compose.yml restructured how data subdomain serves air.json to main domain by mounting the dyn folder directly into the main docker container, by that avoiding any CORS complications. 2021-02-22 10:33:24 +07:00

README.md

AQI sensor project

This is a place to show off what went into building my AQI measuring station currently publishing to:

lpb-air.com

This is under constant development. The main purpose is educational.

The webserver is a simple VPS, provisioned with docker-compose.yml.

aqi_monitor

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. Connected to that is:

  • SDS011: pm2.5 and pm10 sensor from Nova Fitness.
  • BME280: Pressure Humidity Temperature Sensor Module.

backend

A flask based application that takes the data from the ESP8266 for processing and storage.
Postgres 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 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 Python library and the graphs are created with matplotlib.
The backend runs on a separate subdomain so it could easily be scaled horizontaly onto a separate server in the future.

frontend

A simple web site that gets AQI values from the backend to publish it nicely to see. Mostly build with HTML/CSS/JS and a little bit of PHP.
New data is pulled from the backend on a interval with JavaScript and XMLHttpRequest library.
The Lightbox to take a closer look at the graphs is curtesy of Lokesh Dhakar.