Simple ESPHome based indoor climate sensor using Sensirion SCD41 CO2 sensor, with buzzer and color LED.
Install esp command line tools
Connect esp32 and run:
esphome run 0-sensorita.yaml
After first run OTA updates are possible.
Tested with esphome 2022.6.1
- FireBeetle ESP32-E
- Sparkfun 8mm Adressable RGB LED (WS2812)
- TDK PS1240P02BT Piezzo Buzzer
- SCD41 Sensor
Should probably put a resistor on the datapin. Didn't do so so far and things seem to work fine. In a similar fashion, common wisdom seems to be to add a capacitor before (and smaller between) the LEDs. Again, it seems I'm getting away with it just fine, but notably I'm also driving only a single LED so not too surprising.
(See guides by Sparkfun and Adafruit)
WS2818 LEDs usually require 5V both on Data and Vin. I tried with both 5V and 3.3V supply and it worked fine without any flickering. The specs that Sparkfun linked to the LEDs I bought actually says 2.5V - 7.5V which implies that I got lucky again? (admittedly I read up on all of this only after the fact). But it also says that the data voltage should be somewhere around the supply voltage, so going with that now (i.e. having input voltage on 3.3V since I can't do much about data without an extra voltage regulator).
Response times to change of the sensor are
- CO2: 60s
- Humidity: 90s
- Temperature: 120s
Response time define as "Time for achieving 63% of a respective step function". (see datasheet)
Periodic measurement time is 5 seconds. There is also a power saving mode in which measurements are taken only every 30 seconds.
The SCD41 calibrates itself by default, but for this to work it needs to be exposed to ~400PPM (i.e. outdoors) at least once a week. This blog further notes that:
Although, we generally talk about the sensor taking 7 days to calibrate, to be precise, what you need are 7 good measurements separated by at least 18 hours (that is, approximately 5 days).
Generally, any settings are not written to the EEPROM (which only lives for ~2000 write cycles!). Calibration history however is automatically stored in a separate EEPROM "dimensioned for the specified sensor lifetime".
Factory default for temperature offset is 4C because of assumed self-heating. CO2 measurement accuracy is independent of temperature offset
As automatic calibration requires outdoor air every few days while the sensor is on, I disabled automatic self calibration and instead manually calibrated the sensor. (This requires esphome 2022.5.0 or newer which adds manual calibration to scd4x)