Gases - SCD30 CO2, Humidity, Temperature

SCD30 CO2 sensor

Plugin details

Type: Gases

Name: SCD30

Status: COLLECTION D

GitHub: _P117_SCD30.ino

Maintainer: tonhuisman

Used libraries: https://github.com/Frogmore42/Sonoff-Tasmota/tree/development/lib/FrogmoreScd30 (corrected local copy)

Description

The SCD30 is a CO2 sensor unit that also provides Humidity and Temperature measurement, supports auto-calibration, allows forced recalibration, and has temperature and altitude compensation settings.

Configuration

Device configuration
  • Name Required by ESPEasy, must be unique among the list of available devices/tasks.

  • Enabled The device can be disabled or enabled. When not enabled the device should not use any resources.

I2C options

Note

According to manufacturer specification, the I2C ClockStretchLimit setting should be configured at a minimum value of 20 milliseconds, and can take up to 150 msec once a day. For ESP8266 and ESP32 there are somewhat different values to fill, ESP8266 expects microseconds (usec) there, 20000 to 150000, and ESP32 needs 1/80 usec, 1600000 to 12000000, so a factor 80 difference.

The available settings here depend on the build used. At least the Force Slow I2C speed option is available, but selections for the I2C Multiplexer can also be shown. For details see the Hardware page

Note

The SCD30 sensor supports a max. I2C Clock Speed of 100 kHz, so Force Slow I2C speed should be checked! (ESPEasy has a default setting of 100 kHz for I2C Slow device Clock Speed).

Device Settings

  • Altitude Set the altitude above sealevel in meters, where the sensor is placed. The range is 0..2000 meter.

  • Temp offset Offset for temperature correction. Can be set to compensate any self-heating of the device, by comparing the temperature measurement with another calibrated temperature measured close to the device. The difference can be set here, and is (also) stored in the sensor (but re-written every time ESPEasy initializes the sensor).

  • Measurement Interval: The default interval for continuous measuring is 2 sec. Here this interval can be increased, if so desired.

  • Automatic Self Calibration: When enabled, the automatic self-calibration will be activated when the plugin is started. If the calibration is set via the scdsetfrc,<co2_ppm> command, the calibration is reset to manual, as the ASC overwrites the manually set calibration.

Warning

Automatic Self Calibration is a tedious process, that at first run takes at least 7 days to complete, and requires the sensor to be in fresh air for at least 1 hour daily, during the self-calibration period.

The Data Acquisition, Send to Controller and Interval settings are standard available configuration items. Send to Controller only when one or more Controllers are configured.

  • Interval By default, Interval will be set to 60 sec. The data will be measured and optionally sent to any configured controllers using this interval.

Values

The used library provides an averaged CO2 value of the last 5 measurements in value CO2. The last single CO2 measurement is also available as CO2raw.

Humidity shows the relative humidity RH in a range of 0..100%.

Temperature shows the temperature of the sensor in degrees Celcius, with the Temp offset applied.

Commands available

Command Syntax

Extra information

scdgetabc
Shows automatic calibration period in days, 0 = disable.
scdgetalt
Shows altitude compensation configuration in meters above sea level.
scdgettmp
Shows temperature offset in degrees C.
scdsetcalibration,<0|1>
Set the sensor calibration mode to manual (0) or automatic (1).
The Device configuration setting is also updated, but not saved, when using this command.
About activating the Automatic Self Calibration (from the manual):
Continuous automatic self-calibration can be (de-)activated with the following command. When activated for the first time a period of minimum 7 days is needed so that the algorithm can find its initial parameter set for ASC. The sensor has to be exposed to fresh air for at least 1 hour every day. Also during that period, the sensor may not be disconnected from the power supply, otherwise the procedure to find calibration parameters is aborted and has to be restarted from the beginning. The successfully calculated parameters are stored in non-volatile memory of the SCD30 having the effect that after a restart the previously found parameters for ASC are still present. Note that the most recently found self-calibration parameters will be actively used for self-calibration disregarding the status of this feature. Finding a new parameter set by the here described method will always overwrite the settings from external recalibration (see chapter 1.3.7) and vice-versa. The feature is switched off by default.
To work properly SCD30 has to see fresh air on a regular basis. Optimal working conditions are given when the sensor sees fresh air for one hour every day so that ASC can constantly re-calibrate. ASC only works in continuous measurement mode. ASC status is saved in non-volatile memory. When the sensor is powered down while ASC is activated SCD30 will continue with automatic self-calibration after repowering without sending the command.

Warning

Automatic Self Calibration is a tedious process, that at first run takes at least 7 days to complete, and requires the sensor to be in fresh air for at least 1 hour daily, during the self-calibration period.

Note

After enabling, and completing, ASC, do not apply a forced recalibration (FRC) as that will overwrite the carefully built up calibration.

scdsetfrc,<co2_ppm>
Set the sensor forced recalibration value. The <co2_ppm> is validated to be between 400 and 2000 (as per the manual). When using this command, the sensor is switched to Manual Calibration, as Automatic Self Calibration overwrites this setting.
Forced Re-Calibration instructions (from the manual):
Forced recalibration (FRC) is used to compensate for sensor drifts when a reference value of the CO2 concentration in close proximity to the SCD30 is available. For best results the sensor has to be run in a stable environment in continuous mode at a measurement rate of 2s for at least two minutes before applying the calibration command and sending the reference value. Setting a reference CO2 concentration by the here described method will always overwrite the settings from ASC (Automatic Calibration) and vice-versa. The reference CO2 concentration has to be within the range 400 ppm ≤ cref(CO2) ≤ 2000 ppm.
FRC value is saved in non-volatile memory, the last set FRC value will be used for field-calibration after repowering.

Warning

Setting the sensor forced recalibration requires a reliable reference, in close vincinity of the sensor, to be useful.

Note

Setting a forced recalibration value will overwrite any earlier set, or automatically built via ASC, calibration.

scdgetinterval
Shows the current Measurement Interval of the sensor.
scdsetinterval,<interval>
Set the Measurement Interval to <interval> seconds. Factory default is 2 sec. Range from 2 to 1800 seconds.
The Device configuration setting is also updated, but not saved, when using this command.

Change log

Changed in version 2.0:

added 2022-02-26 Added commands and settings for measurement interval, automatic calibration and forced recalibration.

added 2021-11-20 Initial release version.