IAQ with Grafana
This tutorial will guide you to create a Grafana installation on a Raspberry Pi which logs temperature, humidity, air pressure and indoor air quality (IAQ) from a card10 badge. It will look similar to this:
This guide does not try to secure the installation of all the software packages involved. There might be default passwords still active which are not accounted for here.
The individual steps are:
-
Prepare card10
- Turn on Bluetooth
- Turn on BSEC in BME680 app
-
Prepare Raspberry Pi 3/4
- Install latest “Raspberry Pi OS Lite” onto an SD card
- Boot Raspberry Pi
- Login
- Change the password via
passwd
- Configure any network interfaces as needed using
rpi-config
sudo apt update
sudo apt upgrade
sudo reboot
sudo apt install git
-
Install IOTstack
git clone https://github.com/SensorsIot/IOTstack.git IOTstack
cd ~/IOTstack
./menu.sh
- Let it install dependencies
- Restart when asked
- Edit
/etc/group
and addpi
to thedocker
group:docker:x:995:root,pi
- Logout
- Login again, run
menu.sh
again - Ignore error message because of docker version
- Select “Build Stack”
- Select grafana, influxdb, nodered using space
- Enter the nodered menu to build addons list with the right arrow key
- Press enter
- Add
node-red-contrib-generic-ble
using space
- Hit enter to build
addons_list.yml
- Hit escape to go back
- Hit enter to start the build
- Go to “Docker Commands”
- Select “Start stack”
- Wait for containers being built
- Press enter
- Press escape
-
Pair card10 to system
- Run
bluetoothctl
scan on
- Enter Bluetooth menu on card10
- Wait until something like
[NEW] Device CA:4D:10:XX:XX:XX card10-xxxxxx
appears pair CA:4D:10:XX:XX:XX
(replace with MAC that is shown in bluetooth menu)- Type
yes
, hit yes on card10 - Try again if the pairing fails
disconnect
exit
- Run
-
Create influx database
docker exec -it influxdb influx
create database card10
- (use card10)
create user "nodered" with password 'supersecure'
create user "grafana" with password 'supersecure'
grant all on card10 to nodered
grant all on card10 to grafana
exit
-
Configure grafana
- Go to
<IP of your Raspberry Pi>:3000
- User
admin
, Passwordadmin
- Select a new password
- Add new data source influxdb
- Url:
http://influxdb:8086
- Database:
card10
- User:
grafana
- Password:
supersecure
- Method: GET
- Press “Save & test”
- Import Air-1641131410916.json
- Select the InfluxDB data source you created before
- Press Import
- Go to
-
Add card10 in nodered
- Go to
<IP of your Raspberry Pi>:1880
- Import card10-iaq-flow.json
- Change mac of device to
CA:4D:10:XX:XX:XX
(same as above)
- Set user of influxdb to
nodered
- Set password of influxdb to
supersecure
- Deploy flow
- Reboot (takes some time)
- Check that card10 BLE connection goes to “Active”
- Go to
You should now see data coming in in the grafana dashboard that you created before under http://<IP of your Raspberry Pi>:3000