- About Air Insight
- Hardware
- Features
- Used frameworks
- Installation manual
- Instructables
Air insight is an air quality monitor that monitors co2, particulate matter, indoor air quality, temperature, humidity and atmospheric pressure
It is made for people that want to know more about the air quality in their rooms or home.
- Raspberry Pi 4B
- SD card
- Winsen MH-Z19B
- Sensiron PMS5003
- Bosch BME680
- Noctua nf-a4x10 5V PWM fan (with tachometer)
- 5V USB-C power supply 3A or more
- Displaying Realtime Air quality
- Viewing historical data
- Setting the fan speed to manual or smart mode
- viewing device IP address and fan speed
- Flask
- Socketio
- Apexcharts
- Apache
- install Raspbian with desktop gui
- Install apache2:
apt install apache2 -y
- Install MariaDB
apt install mariadb-server mariadb-client -y
- Secure MariaDB
mysql_secure_installation
- root password: press Enter
- enter password
- remove anonymous users [Y/n] : y
- Dissalow root login remotely? [Y/n] n
- Remove test database and access to it? [Y/n] y
- Create MySql user
mysql -u root -p
grant all on *.* to 'student'@'localhost' identified by 'password'; grant grant option on *.* to 'student'@'localhost';
flush privileges
exit
- configure MySql Workbench
- Open mysql workbench
- make new connection - choose Connection Method over Standard TCP/IP over SSH
- SSH Hostname:
<RPi ip adrress>
- SSH Username:
<username>
- SSH Password: the mysql user password
- save to vault.
- MySQL Hostname: 127.0.0.1
- MySQL Server Port: 3306
- Username: user
- Password: password
- Save password to vault
- connect to the raspberry pi via ssh
- install extention remote-ssh
- connect to ssh
username@ip_address
- Clone the repo:
git clone https://github.com/howest-mct/2021-2022-projectone-JarneDel
- Make python ready
- install packages (do not use venv)
- pip install flask-cors
- pip install flask-socketio
- pip install mysql-connector-python
- pip install gevent
- pip install gevent-websocket
- pip install selenium
- install the BME68X python library from pip3g
- install packages (do not use venv)
- import database
- use the mySQL dump file to import the database
- install chrome kiosk
sudo apt install chromium-chromedriver
- run backend -> app.py
- Display front-end in apache
- browse in your webbrowser, on the same network to the ip address of the raspberry pi
- You should see the Apache2 Debian Default Page
Sudo nano /etc/apache2/sites-availible/000-default.conf
- change
DocumentRoot /var/www/html
to/DocumentRoot/home/user/2021-2022-projectone-JarneDel/front-end
- Save with Ctrl+x followed by y followed by Enter
- open
sudo nano /etc/apache2/apache2.conf
- replace
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
- with
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
- save
- restart apache:
sudo service apache2 restart
- check apache status:
sudo service apach2 status
- expected output:
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) \ Active: active (running) since ...
- Create a file airInsight.service
- Paste the following code in the file
[Unit]
Description=ProjectOne Project
After=network.target
[Service]
ExecStart=/usr/bin/python3 -u /home/<user>/2021-2022-projectone-JarneDel/backend/app.py
WorkingDirectory=/home/<user>/2021-2022-projectone-JarneDel/backend
StandardOutput=inherit
StandardError=inherit
Restart=always
User=student
[Install]
WantedBy=multi-user.target
- copy the file to /etc/systemd/system/ with
sudo cp airInsight.service /etc/systemd/system/airInsight.service
- Test by running
sudo systemctl start airInsight.service
- To stop the test:
sudo systemctl stop airInsight.service
- Run service on boot:
sudo systemctl enable airInsight.service
On instructables I documented this project on Instuctables https://www.instructables.com/Air-Insight-Air-Quality-Monitor-With-Raspberry-Pi/ This way you can recreate the project. The schematics are also available here