Sensirion / arduino-i2c-scd30

Arduino I2C driver for Sensirion's SCD30 sensor
https://sensirion.com/products/catalog/SCD30/
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

DOC: FRC requires a wait time after calling forceRecalibration() #4

Open ferdinand0815 opened 1 month ago

ferdinand0815 commented 1 month ago

When using the FRC method to calibrate the sensor, it is important to let it run for some time after calling forceRecalibration(). This is contrary to the field calibration application note which states "The effect of FRC takes place immediately."

Calling either softReset() or stopPeriodicMeasurement() (or power cycling the device) will null the just set calibration.

For calibration to work, one needs to either have a delay() or just keep measuring. The required wait time seems to be related to the measurement cycles - once two cycles are past the calibration curve is saved.

// let the CO2 reading be:
// -> 800 ppm

sensor.forceRecalibration(1200);
sensor.softReset();
// -> 800 ppm - fail

sensor.forceRecalibration(1200);
delay(5000);
sensor.softReset();
// -> 1200 ppm - good

I hope this helps someone.

sdmueller commented 1 month ago

Hi @ferdinand0815

Thanks for using our sensors!

I tried to reproduce the behavior you observed but on my side the FRC value is applied immediately and stays after soft resetting.

Are you sure the FRC call does not return an error in the first case (return value should be 0)? If yes, what does sensor.getForceRecalibrationStatus(...) read out before and after the soft reset?

And what firmware version is your sensor on?

ferdinand0815 commented 1 month ago

Please refer to the attached script: sdc30test.ino.zip. This is using an ESP8266.

I do use the non-blocking getDataReady()/readMeasurementData(). Maybe the measurement interval is important. I played around with stopPeriodicMeasurement() before starting calibration but this seems to have no effect.

Please do not just add a delay() to the forceRecalibration() ... ;)

Output for 1601 ms delay after calling forceRecalibration() - calibration fails

SDC30: Firmware version 3.66, altitude 450 m, temp offset 350 C, auto calibration disabled CO2: 0.00 ppm CO2: 737.47 ppm CO2: 850.24 ppm CO2: 860.41 ppm CO2: 845.60 ppm CO2: 841.16 ppm CO2: 841.52 ppm Reference CO2 before calibration: 400 ppm Forcing calibration to 1200 ppm Reference CO2 after calibration: 1200 ppm Waited for 1601 ms Restarting ESP ...� [...] SDC30: Firmware version 3.66, altitude 450 m, temp offset 350 C, auto calibration disabled CO2: 0.00 ppm CO2: 738.39 ppm CO2: 825.60 ppm CO2: 826.26 ppm CO2: 827.11 ppm CO2: 815.13 ppm CO2: 815.83 ppm

Output for 2601 ms delay - calibration works

SDC30: Firmware version 3.66, altitude 450 m, temp offset 350 C, auto calibration disabled CO2: 0.00 ppm CO2: 740.87 ppm CO2: 841.72 ppm CO2: 823.00 ppm CO2: 826.75 ppm CO2: 824.49 ppm CO2: 817.02 ppm Reference CO2 before calibration: 400 ppm Forcing calibration to 1200 ppm Reference CO2 after calibration: 1200 ppm Waited for 2601 ms Restarting ESP ...� [...] SDC30: Firmware version 3.66, altitude 450 m, temp offset 350 C, auto calibration disabled CO2: 0.00 ppm CO2: 1070.39 ppm CO2: 1216.61 ppm CO2: 1206.10 ppm CO2: 1215.21 ppm CO2: 1214.48 ppm CO2: 1217.50 ppm

sdmueller commented 1 month ago

Very interesting find.

I could now reproduce this exact behavior as well. I was testing on a different firmware version before.

We will investigate this internally and I will update you if I know something more.

Thanks!

ferdinand0815 commented 1 month ago

Also please note, the first measurement reported is always 0.