SCD30 Temperature and Humidity calibration

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Mushrooom
 
Posts: 8
Joined: Thu Dec 29, 2022 3:30 pm

SCD30 Temperature and Humidity calibration

Post by Mushrooom »

I needed to calibrate my SCD30 after painting it in conformal coating, I think the Black Light I used to see where I had painted messed with the CO2 sensor. The Humidity and Temperature readings were normal.

I re-calibrated the sensor using the Arduino IDE (I am more comfortable using that at the moment). I used the "sensor_tuning" code from the examples library (see below). This appeared to fix the CO2 calibration but it stopped any readings being recorded for Humidity. I am also not sure how the temperature offset works? It does not appear to be as simple as putting the sensor in a room at a specific temperature and calibrating at that same temperature.

Any help with the code I need to use to calibrate all three sensors on the SCD30 (CO2, Humidity and temperature) would be really appreciated.

Code: Select all

// Demo of the available settings for the SCD30
#include <Adafruit_SCD30.h>

Adafruit_SCD30  scd30;

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

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

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

  /***
   * The code below will report the current settings for each of the
   * settings that can be changed. To see how they work, uncomment the setting
   * code above a status message and adjust the value
   *
   * **Note:** Since Automatic self calibration and forcing recalibration with
   * a reference value overwrite each other, you should only set one or the other
  ***/


  /*** Adjust the rate at which measurements are taken, from 2-1800 seconds */
  // if (!scd30.setMeasurementInterval(5)) {
  //   Serial.println("Failed to set measurement interval");
  //   while(1){ delay(10);}
  // }
  Serial.print("Measurement interval: ");
  Serial.print(scd30.getMeasurementInterval());
  Serial.println(" seconds");


  /*** Restart continuous measurement with a pressure offset from 700 to 1400 millibar.
   * Giving no argument or setting the offset to 0 will disable offset correction
   */
  // if (!scd30.startContinuousMeasurement(15)){
  //   Serial.println("Failed to set ambient pressure offset");
  //   while(1){ delay(10);}
  // }
  Serial.print("Ambient pressure offset: ");
  Serial.print(scd30.getAmbientPressureOffset());
  Serial.println(" mBar");


  /*** Set an altitude offset in meters above sea level.
   * Offset value stored in non-volatile memory of SCD30.
   * Setting an altitude offset will override any pressure offset.
   */
  // if (!scd30.setAltitudeOffset(110)){
  //   Serial.println("Failed to set altitude offset");
  //   while(1){ delay(10);}
  // }
  Serial.print("Altitude offset: ");
  Serial.print(scd30.getAltitudeOffset());
  Serial.println(" meters");


  /*** Set a temperature offset in hundredths of a degree celcius.
   * Offset value stored in non-volatile memory of SCD30.
   */
   if (!scd30.setTemperatureOffset(1984)){ // 19.84 degrees celcius
     Serial.println("Failed to set temperature offset");
     while(1){ delay(10);}
   }
  Serial.print("Temperature offset: ");
  Serial.print((float)scd30.getTemperatureOffset()/100.0);
  Serial.println(" degrees C");


  /*** Force the sensor to recalibrate with the given reference value
   * from 400-2000 ppm. Writing a recalibration reference will overwrite
   * any previous self calibration values.
   * Reference value stored in non-volatile memory of SCD30.
   */
   if (!scd30.forceRecalibrationWithReference(400)){
     Serial.println("Failed to force recalibration with reference");
     while(1) { delay(10); }
   }
  Serial.print("Forced Recalibration reference: ");
  Serial.print(scd30.getForcedCalibrationReference());
  Serial.println(" ppm");


  /*** Enable or disable automatic self calibration (ASC).
   * Parameter stored in non-volatile memory of SCD30.
   * Enabling self calibration will override any previously set
   * forced calibration value.
   * ASC needs continuous operation with at least 1 hour
   * 400ppm CO2 concentration daily.
   */
  // if (!scd30.selfCalibrationEnabled(true)){
  //   Serial.println("Failed to enable or disable self calibration");
  //   while(1) { delay(10); }
  // }
  if (scd30.selfCalibrationEnabled()) {
    Serial.print("Self calibration enabled");
  } else {
    Serial.print("Self calibration disabled");
  }

  Serial.println("\n\n");
}

void loop() {
  if (scd30.dataReady()) {
    
    if (!scd30.read()){ 
      Serial.println("Error reading sensor data"); 
      return; 
    }

    Serial.print("Temperature: ");
    Serial.print(scd30.temperature);
    Serial.println(" degrees C");
    
    Serial.print("Relative Humidity: ");
    Serial.print(scd30.relative_humidity);
    Serial.println(" %");
    
    Serial.print("CO2: ");
    Serial.print(scd30.CO2, 3);
    Serial.println(" ppm");
    Serial.println("");
  }

  delay(100);
}


User avatar
bidrohini
 
Posts: 202
Joined: Thu Oct 20, 2022 10:03 am

Re: SCD30 Temperature and Humidity calibration

Post by bidrohini »

You can try the forced recalibration method: https://learn.adafruit.com/adafruit-scd ... alibration

User avatar
Mushrooom
 
Posts: 8
Joined: Thu Dec 29, 2022 3:30 pm

Re: SCD30 Temperature and Humidity calibration

Post by Mushrooom »

Thanks for the reply. I tried the hard reset outside with a CO2 value of 400ppm outside. I am not sure what conditions to provide for humidity and temperature.

The CO2 reading looks kind of normal, no way of really knowing with one sensor but its not too strange. The temperature and Humidity readings are definitely off. Humidity is much too high and Temperature is much too low.

Strangely, they appear to continue to increase or decrease in small increments after the hard reset.

Could the sensor be damaged?
Is this normal behavior after a reset?
Does the Hard reset code you pointed me at also re-calibrate temperature and Humidity?

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: SCD30 Temperature and Humidity calibration

Post by adafruit_support_carter »

I needed to calibrate my SCD30 after painting it in conformal coating, I think the Black Light I used to see where I had painted messed with the CO2 sensor.
Very possible depending on what was done here. Can you post a photo of the current condition of the SCD30.

User avatar
Mushrooom
 
Posts: 8
Joined: Thu Dec 29, 2022 3:30 pm

Re: SCD30 Temperature and Humidity calibration

Post by Mushrooom »

Photos below of sensor. I used the black light so it was easier to see where the conformal coating had touched. I know that might cause me more problems if its the Black light that caused the issue but I just wanted to share in the best detail I could. Considering it might already be broken I don't really have anything to lose.
Screenshot 2023-01-27 at 19.28.52.png
Screenshot 2023-01-27 at 19.28.52.png (257.09 KiB) Viewed 327 times
Screenshot 2023-01-27 at 19.29.01.png
Screenshot 2023-01-27 at 19.29.01.png (246.95 KiB) Viewed 327 times
Screenshot 2023-01-27 at 19.28.36.png
Screenshot 2023-01-27 at 19.28.36.png (279.94 KiB) Viewed 327 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: SCD30 Temperature and Humidity calibration

Post by adafruit_support_carter »

Thanks for the photos. The main regions of concern in terms of avoiding covering are here:
coating.png
coating.png (184.81 KiB) Viewed 321 times
Why was the coating added? Not sure if it was the coating itself, or possible UV damage from the blacklight, but damage somehow related to adding the coating seems most likely.

User avatar
Mushrooom
 
Posts: 8
Joined: Thu Dec 29, 2022 3:30 pm

Re: SCD30 Temperature and Humidity calibration

Post by Mushrooom »

I avoided these areas. I added the coating because it will be in a mushroom grow box (90%) with very high humidity. On smaller prototypes with DH22 humidity sensors the connections corroded really quickly so I wanted to protect this sensor.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”