Save data from the AirGradient DIY Pro air quality monitor to a locally hosted Influx DB 2 instance.
AirGradient instructions (PCB < 3.7)
Arduino IDE instructions
- Install libraries
- ESP8266 by ESP8266 Community v2.7.4 (in Board Manager) *
- AirGradient Air Quality Sensor by AirGradient v2.2.0
- WifiManager by tzapu, tablatronix v2.0.11-beta
- U8g2 by oliver v2.32.15
- ESP8266 Influxdb by Tobias Schurg v3.13.1
mvor renamearduino_secrets.h.exampletoarduino_secrets.h- In Influx DB: create a new org and bucket for your AirGradient
- Go to Load Data > Sources > Arduino
- Copy
INFLUXDB_URL,INFLUXDB_TOKEN,INFLUXDB_ORG,INFLUXDB_BUCKETtoarduino_secrets.h - Find
TZ_INFOin the sketch file and set your timezone from this list. The default isGMT0 - Verify and upload
- In Influx DB: create a new read-only API token for Grafana
- Add a new data source in Grafana using the API token (Change Query Language to
Flux) - Create a new panel in your dashboard and select the AirGradient data source
- Use the InfluxDB Data Explorer to create the Flux queries for you
- Tested with PCB v3.3
- Use board
LOLIN(WEMOS) D1 R2 & Mini - OLED brightness can be adjusted by setting
u8g2.setContrast(value)insetup()- Default is
50 value: 0 to 255
- Default is
* I experienced frequent crashing using anything newer than ESP8266 v2.7.4, YMMV
default: This is based off the DIY_PRO example. Sensor readings are reported to an InfluxDB instanceno-pm2.5: Same as above, but with the PM2.5 sensor unplugged. Useful for quiet environments like a bedroom or studio.scheduled-oled: Based offno-pm2.5. The OLED display is turned off between 0 and 8(am). This can be adjusted (and expanded upon) by modifyingupdateOledBrightness(). The time check is performed every 5 minutes.