0

CO2 SCD30 sensor - forced calibration failure
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

CO2 SCD30 sensor - forced calibration failure

by Jennyfool on Fri Apr 09, 2021 4:56 pm

Hi,

I am trying to calibrate the SCD30 sensor to a reference of known CO2 concentration at 410ppm. I am using the force calibration method. As recommended by the working document, I run the sensor for 2 minutes, then execute the force calibration code. My problem is that after restarting the sensor, the force calibration data is not updated, but wind back to 400ppm. (ps, I turned off the auto calibration to avoid it overrides force calibration result).

My questions are 1) does this mean the sensor returned to an "uncalibrated" status? 2) how to make the sensor remember the force calibration result?

266 seconds
Forced Recalibration reference: 410 ppm
T, 22.23Adafruit SCD30 test!
SCD30 Found!
Measurement Interval: 2 seconds
6 seconds
Forced Recalibration reference: 400 ppm
T, 23.66C,RH, 3.69 %,CO2, 0.000 ppm,,
8 seconds
Forced Recalibration reference: 400 ppm
T, 23.65C,RH, 3.70 %,CO2, 396.043 ppm,,
10 seconds
Forced Recalibration reference: 400 ppm
T, 23.62C,RH, 3.68 %,CO2, 434.326 ppm,,
12 seconds
Forced Recalibration reference: 400 ppm
T, 23.61C,RH, 3.78 %,CO2, 410.667 ppm,,
14 seconds
Forced Recalibration reference: 400 ppm
T, 23.58C,RH, 3.78 %,CO2, 407.019 ppm,,
16 seconds
Forced Recalibration reference: 400 ppm
T, 23.56C,RH, 3.77 %,CO2, 408.125 ppm,,
18 seconds
Forced Recalibration reference: 400 ppm
T, 23.55C,RH, 3.72 %,CO2, 407.193 ppm,,
20 seconds
....

158 seconds
Forced Recalibration reference: 400 ppm
T, 22.59C,RH, 2.98 %,CO2, 416.902 ppm,,
Forced Recalibration reference: 400 ppm
(here the code force calibration again)
Forced Recalibration reference: 410 ppm
160 seconds
Forced Recalibration reference: 410 ppm
T, 22.61C,RH, 3.07 %,CO2, 416.672 ppm,,
162 seconds
Forced Recalibration reference: 410 ppm
T, 22.60C,RH, 3.06 %,CO2, 416.675 ppm,,
164 seconds
Forced Recalibration reference: 410 ppm
T, 22.58C,RH, 3.04 %,CO2, 410.001 ppm,,
166 seconds
Forced Recalibration reference: 410 ppm
T, 22.57C,RH, 3.10 %,CO2, 409.875 ppm,,


My code:
Code: Select all | TOGGLE FULL SIZE
// Basic demo for readings from Adafruit SCD30
#include <Adafruit_SCD30.h>

Adafruit_SCD30  scd30;
int i=1;

void setup(void) {
  Serial.begin(115200);
  while (!Serial) delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit SCD30 test!");

  // Try to initialize!
  if (!scd30.begin()) {
    Serial.println("Failed to find SCD30 chip");
    while (1) { delay(10); }
  }
  Serial.println("SCD30 Found!");


  // if (!scd30.setMeasurementInterval(10)){
  //   Serial.println("Failed to set measurement interval");
  //   while(1){ delay(10);}
  // }
  Serial.print("Measurement Interval: ");
  Serial.print(scd30.getMeasurementInterval());
  Serial.println(" seconds");
}

void loop() {
  if (scd30.dataReady()){
    //Serial.println("Data available!");
    Serial.print(i*2); Serial.println(" seconds");
    Serial.print("Forced Recalibration reference: ");
    Serial.print(scd30.getForcedCalibrationReference());
    Serial.println(" ppm");
   
    if (!scd30.read()){ Serial.println("Error reading sensor data"); return; }

    Serial.print("T, ");
    Serial.print(scd30.temperature);
    Serial.print("C,");
   
    Serial.print("RH, ");
    Serial.print(scd30.relative_humidity);
    Serial.print(" %,");
   
    Serial.print("CO2, ");
    Serial.print(scd30.CO2, 3);
    Serial.print(" ppm,");
    Serial.println(",");
   
  } else {
    //Serial.println("No data");
  }

  delay(2000);
  i = i+1;
  if (i == 80){
    Serial.print("Forced Recalibration reference: ");
    Serial.print(scd30.getForcedCalibrationReference());
    Serial.println(" ppm");
    scd30.forceRecalibrationWithReference(410);
    Serial.print("Forced Recalibration reference: ");
    Serial.print(scd30.getForcedCalibrationReference());
    Serial.println(" ppm");
  }
 
}

Jennyfool
 
Posts: 5
Joined: Fri Apr 09, 2021 12:45 pm

Re: CO2 SCD30 sensor - forced calibration failure

by mikeysklar on Sat Apr 10, 2021 9:28 pm

Hmm, look at our site it might be a good idea to include an explicit line to disable the ASC (Automatic Self Calibration)..

Code: Select all | TOGGLE FULL SIZE
scd30.selfCalibrationEnabled(false);


https://learn.adafruit.com/adafruit-scd ... -3084006-9

mikeysklar
 
Posts: 7777
Joined: Mon Aug 01, 2016 8:10 pm

Re: CO2 SCD30 sensor - forced calibration failure

by scottmil on Mon Apr 19, 2021 3:09 pm

I have the same problem. With ASC disabled, I tried multiple times to setForceRecalibrationWithReference to 415 ppm, but the value won't persist when I disconnect power and re-energize the SCD30, but returns to 400 ppm. I have been successful in setting the temperature offset and altitude offsets: (printout below from modified Adafruit sensor tuning code)

Temperature: 22.58 degrees C
Temperature offset: 2.67 degrees C
Altitude offset: 86 meters
Ambient pressure offset: 0 mBar
Relative Humidity: 46.27 %
Forced Recalibration reference: 400 ppm
Automatic Self Calibration disabled
CO2: 413.355 ppm

scottmil
 
Posts: 13
Joined: Fri Apr 16, 2021 6:18 pm

Re: CO2 SCD30 sensor - forced calibration failure

by mikeysklar on Tue Apr 20, 2021 10:13 am

@scottmil,

Can you open an issue on github for this library. It sounds like this need to be investigated by the library manager.

https://github.com/adafruit/Adafruit_SCD30/issues

mikeysklar
 
Posts: 7777
Joined: Mon Aug 01, 2016 8:10 pm

Re: CO2 SCD30 sensor - forced calibration failure

by scottmil on Tue Apr 20, 2021 3:29 pm

I opened an issue on GitHub as requested.

However, I wrote a short sketch to try to set the ForcedCalibration reference using the Seeed-Studio SCD30 library, and had the same result: my new 415 ppm reference value did not persist after either SCD30 de-energize/energize or SCD30 soft reset but stuck at 400 ppm.

My conclusions: 1) There must be an unpublished procedure that must be followed to set the ForcedCalibration reference, or 2) There is a problem with the SCD30 firmware.

scottmil
 
Posts: 13
Joined: Fri Apr 16, 2021 6:18 pm

Re: CO2 SCD30 sensor - forced calibration failure

by mikeysklar on Wed Apr 21, 2021 11:22 am

@scottmil,

Thank you for opening a github issue and trying with the alternative Seeed-Studio library. Even though the github library might not be the right place to be discussing potential SCD30 firmware issues we need to bring it up somewhere to acknowledge the issue.

There are other github repos that have SCD30 example code. I think you will want to take a look at SparkFun's example where they try to pull in a forced calibration setting.

https://github.com/sparkfun/SparkFun_SC ... ttings.ino

mikeysklar
 
Posts: 7777
Joined: Mon Aug 01, 2016 8:10 pm

Re: CO2 SCD30 sensor - forced calibration failure

by scottmil on Wed Apr 21, 2021 3:53 pm

I tried setting the SCD30 ForcedRecalibrationReference with the Sparkfun SCD30 library as suggested above, but the with the same unsuccessful result: no matter what reference value is set, the SCD30 always returns 400 ppm.

scottmil
 
Posts: 13
Joined: Fri Apr 16, 2021 6:18 pm

Re: CO2 SCD30 sensor - forced calibration failure

by scottmil on Thu Apr 22, 2021 2:04 pm

There seems to be conflicting information in the SCD30 documentation. The statement below states that the FRC reference is stored in VOLATILE memory, and the reference 400 is always returned upon repowering:

"The FRC method imposes a permanent update of the CO2 calibration curve which persists after repowering the sensor. The most recently used reference value is retained in volatile memory and can be read out with the command sequence given below. After repowering the sensor, the command will return the standard reference value of 400 ppm. "

The statement above reflects the current behavior of the SCD30.

End of story?

scottmil
 
Posts: 13
Joined: Fri Apr 16, 2021 6:18 pm

Re: CO2 SCD30 sensor - forced calibration failure

by mikeysklar on Thu Apr 22, 2021 3:47 pm

scotmil,

Good find.

It makes sense if the FRC is stored in volatile memory it will always be lost on reset.

However, in your case can you set the FRC on initialization (power up) and use that instead of the default 400 without issue? Maybe that would meet your needs to always start from a forced value?

mikeysklar
 
Posts: 7777
Joined: Mon Aug 01, 2016 8:10 pm

Please be positive and constructive with your questions and comments.