sparkfun / SparkFun_SCD30_Arduino_Library

An Arduino library for the SCD30 NDIR CO2 sensor.
Other
84 stars 47 forks source link

SCD30 Temperature offset library isn't working #25

Closed IshwariyaVen closed 3 years ago

IshwariyaVen commented 3 years ago

Hi Team,

I have been recently working with SCD30 and found there was a difference in the measured and actual Temperature and CO2 of the environment as I used a precise measuring unit to measure reference readings (which is LICOR LI_6800).

I then tried to force calibrate SCD30 for CO2 with the use of Arduino board, and used the example code given in the github for CO2 force calibration, which worked well.

But when I tried to do the same with example given in github for Temperature offset, but it's not working as intended. Even after , setting the offset value, the reading measurement of SCD30 is same as before off-setting.

Could anyone please help me out on this? Any help or leads will be highly appreciated.

Thanks in advance!

physikant commented 3 years ago

Temperature compensation is working for me with library version 1.0.13. I adapted the code from the example: airSensor.setTemperatureOffset(2);

Serial.print("Current temperature offset: "); Serial.print(airSensor.getTemperatureOffset(), 2); Serial.println("\u00b0C");

The output temperature is definitely adjusted properly in my case.

nseidle commented 3 years ago

Hi @IshwariyaVen - Do you have some minimal code that demonstrates the issue? Like physikant, I can't replicate.

IshwariyaVen commented 3 years ago

@physikant, Thank you for the response with additional information on the version.

@nseidle, Many thanks for following up for the issue.

I noticed that I was using version 1.0.12. After, @physikant mentioned about the version I updated the version to 1.0.14 and the code worked.

Reference Code snippet:

#include <SparkFun_SCD30_Arduino_Library.h>
#include <Wire.h>
SCD30 airSensor;
void setup()
{
  Serial.begin(9600);
  Wire.begin();
  airSensor.setTemperatureOffset(5.3);     //Temp. in deg. C to offset
  float offset = airSensor.getTemperatureOffset();
  Serial.print("Current temp offset: ");
  Serial.print(offset, 3);
}  
nseidle commented 3 years ago

Glad to hear it!