This simple, fancy looking, ESP8266 based sensor measures values of CO2 and TVOC air pollutants. As output there is addressable RGB led strip, and/or optional OLED display which can show real time levels.
And of course some soldering iron and generic tools.
You can download latest version of case on thingiverse. There will be updated side cover with hole for display soon.
There is source code attached, I am using WiFi Manager, so after burning firmware, there will be WiFi hotspot, you can connect with password "config123". After that you should open address 192.168.4.1 and there will be configuration manager where you can enter details about your SSID, password, MQTT broker address, port, username and password, as well as MQTT topic where should sensor publish the data.
I connected 4 pieces of WS2812b LEDS, if you have different number, you should edit following line in main.cpp and compile project in platformio.
#define NUMPIXELS 4
I don't know it I received bad piece of CCS811 sensor, but I spent few nights discovering why it stops reading data after few hours of operation, and only thing that helped to recover it was to unplug power source and plug it back. I realized that in default it takes reading every second. So I found out how to set to take reading every 10 seconds with line
ccs.setDriveMode(CCS811_DRIVE_MODE_10SEC);
I am taking 6 readings, calculate average and then print and publish data, so sensor sends data every minute.
I precompiled firmware for Wemos D1 mini you can download it here
You can use attached burner from easy esp, you just have to select COM port of ESP and select burn.
This example shows sensor configuration for reading ppm values, and it shows other values as json attributes so it can be viewed after opening sensor details.
# CO2 sensor
- platform: mqtt
state_topic: 'stat/air-quality-monitor'
name: 'CO2 sensor'
unit_of_measurement: 'ppm'
value_template: '{{ value_json.eCO2 }}'
json_attributes:
- TVOC
- temperature