This is a simple sketch to measure the air quality with the CCS811 Air Quality Sensor. It get's compensated with an Bosch BME280.
I'm using the Adafruit CCS811 library which worked after I used the correct I2C address of 0x5A for my sensor.
Currently I'm testing if my setup works and the values are reliable - so please see this as a work in progress. Any Feedback and help is appreciated!
Used here are the Sparkfun CCS811 and the Adaferuit BME280 breakout.
Before compiling, you must implement your config by copying the file config.example.h
to config.h
in directory esp-ccs811-bme280-mqtt
. After that you have to fill or change the values in config.h
.
The read data get's dropped to the following topics using <mqtt-topic-prefix>
. All values are retained, the online state is set to offline
using mqtt's last-will.
<mqttTopicPrefix>status online/offline (last will)
<mqttTopicPrefix>ip system ip
<mqttTopicPrefix>temperature temperature in °C
<mqttTopicPrefix>humidity relative humidity in %
<mqttTopicPrefix>pressure pressure in hPa
<mqttTopicPrefix>altitude altitude in m
<mqttTopicPrefix>co2 CO2 concentration in ppm
<mqttTopicPrefix>tvoc total volatile compound in ppb
- Check Sparkfuns CCS811 lib
- better configuration
- Arduino 1.8.1 (https://www.arduino.cc/)
- ESP8266 board definition 2.4.0 (https://github.com/esp8266/Arduino)
- Tasker (https://github.com/sticilface/Tasker)
- PubSubClient 2.6.0 by Nick O'Leary (https://github.com/knolleary/pubsubclient)
- Adafruit CCS811 Library (https://github.com/adafruit/Adafruit_CCS811)
- Sparkfun BME280 Library (https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library)
Patrik Mayer, 2018 Tobias Schmitt, 2018
MIT