- Raspberry pi zero
- PMSA003I (particle sensor)
- SI1145 (UV-Visible-IR sensor)
- BME680
- Local DB PostgreSQL
- Remote DB PostgreSQL
- Vizualization Grafana
- Find the proper device holding the SDCard:
lsblk
- FAT format an sdcard:
sudo mkfs.fat -F 32 /dev/mmcblk0p1
- Copy the image to the device (not partition)
sudo dd bs=1M if=2020-08-20-raspios-buster-armhf-lite.img of=/dev/mmcblk0 conv=fsync
- Mount the card and access the
boot
partition - Add an empty file named
ssh
to enable ssh at start up:touch ssh
- Use wpa_passphrase to generate the wpa_supplicant.conf to put in the same location:
wpa_passphrase <SSID> <passphrase>
- The file looks like this:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid=*** #psk=*** psk=*** }
- Secure raspberry https://www.raspberrypi.org/documentation/configuration/security.md
- run
passwd
- change hostname in
/etc/hostname
- install
ufw
firewall:sudo apt install ufw
- allow
ssh
and enable:sudo ufw allow 22 && sudo ufw enable
- run
- Update software:
sudo apt update && sudo apt upgrade
- Allow I2C module via
sudo raspi-config
- Load tools for i2c debugging:
sudo apt install i2c-tools
- list your buses:
i2cdetect -l
- list connected hardware:
i2cdetect 1
(1 is my i2c bus number)
- list your buses:
- Install virtualenv:
sudo apt install python3-virtualenv
- Create project folder and environemnt:
mkdir aqm && cd aqm && python3 -m virtualenv .aqm_env
https://learn.adafruit.com/pmsa003i/python-circuitpython
- Install the python module for the corresponding hardware in the project’s library:
source .aqm_env/bin/activate && pip3 install adafruit-circuitpython-pm25
- Run test code
test_pm.py
- Install the proper library:
pip3 install SI1145
- Run
test_uv.py
- Install library:
pip3 install bme680
- Run =test_air_qual.py
- ? install smbus=
- install git
sudo apt install git
- install sqlite3
sudo apt install sqlite3
docker run -it –rm –link some-postgres:postgres postgres psql -h postgres -U postgres
docker run –name some-postgres -e POSTGRES_PASSWORD=test -d postgres
create database aqm;
\c aqm
docker run –name my-grafana -p 3000:3000 -d grafana/grafana