When working from home I was curious about the air quality of the environment I was putting myself through for many hours of the day. I know the room I work in is relatively small so I thought about low oxygen potentially messing with my thought process.
The build was relatively simple. I wanted to use an older ESP8266 NodeMCU V2 I had spare and in retrospect think it was a great choice, I decided to try Home Assistant and ESPBuilder because the process seemed easy and it was.
Once I flashed ESPHome from my PC to the ESP and added it to Home Assistant it was fairly simple overall to iterate and test my design. I didn’t have home assistant either but setting everything up took a little over an afternoon.

Hardware selection was fairly simple, I just looked what had good support in ESPHome and went with the SCD41 from Aliexpress.
For the sensing hardware I had a DHT22 sensor for Temperature and Humidity, which the SCD41 also supports. I was primarily interested in CO2 levels but I thought I may as well throw it into the mix to measure the performance of the DHT22.
The Results
Once I had tweaked with the temperature and humidity calibration settings I created a dashboard in home assistant. Again this was something I’d not done before and it was very easy. I have really been pleasantly surprised with how everything has integrated well.
I created a 7 day and 24 hour view,

It became clear to me a number of things,
- CO2 levels regularly rise above 1000ppm in the room I work in when not ventilated, and they rise a lot quicker than I expected. I thought it would take all day to really get to what I consider a harmful level, but actually its more like an hour. After research online 1000ppm is what I would consider too high. It does seem like naturally detect these events and ventilate the room by instinct but its useful insight to see that.
- Ventilating the room equally drops the readings much more rapidly than expected, and leaving the window or door open is enough to bring the levels back to ~650ppm/400ppm relatively quickly.
- High CO2 levels seem more noticeable to me now, previously I had no perception or concept of when it might happen but I feel its much more noticeable now I know what it feels like, if that makes sense.
- I would like to log the data for a more long term view. Say a year or more. I think it would interesting to see if this affects humidity, temperature etc.
- Overall this was easy to setup and provided valuable insight I think.
Here is the 7 day view for those interested, I added the light switch being on or off state at the top of the graph too.

And here is the humidity readings, It was interesting seeing spikes on the graphs, I can easily correlate these with opening doors, having the heating on etc.

Try this yourself
Here is the final version of the YAML I applied to my ESP. I did some testing with sliding window averages but I actually found it was easier to just ignore the first few readings off the sensors to reduce the noise in the graphs.
esphome:
name: tco2s
friendly_name: tco2s
esp8266:
board: nodemcuv2
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "WWVhaCB0aGlzIGFpbnQgcmVhbA=="
ota:
- platform: esphome
password: "SSBjaGFuZ2VkIHRoaXMgbG9s"
mdns:
disabled: true
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip:
static_ip: 192.168.4.22
gateway: 192.168.4.1
subnet: 255.255.255.0
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Tco2S Fallback Hotspot"
password: "U2xlZXB5"
captive_portal:
i2c:
- id: bus_a
sda: D4
scl: D5
scan: true
# DHT22 Sensor
sensor:
- platform: dht
pin: D2
model: DHT22
temperature:
name: "DHT22 Temperature"
filters:
- skip_initial: 3
humidity:
name: "DHT22 Humidity"
filters:
- offset: -20.0
- skip_initial: 3
update_interval: 60s
- platform: scd4x
co2:
name: "SCD41 CO2"
filters:
- skip_initial: 3
temperature:
name: "SCD41 Temperature"
filters:
- skip_initial: 3
humidity:
name: "SCD41 Humidity"
filters:
- skip_initial: 3
I think based on the data I will improve the ventilation to see if it has any effect on my overall fatigue and concentration.
Thank you for reading.
Leave a Reply