Library for interfacing Sensirion SCD30 CO2, humidity and temperature sensor.
The SCD30 is an I2C-bus controlled CO2, humidity and temperature sensor. -) I2C interface with communication speed up to 100kHz -) Fixed I2C adress -) CO2 measurement range 400 – 40000 ppm
typical I2C clock speed to be used (40kHz)
Initializes I2C communication with the SCD30.
It copies the I2C port, I2C address to the transferred empty device handle and checks if the SCD30 is available and responds.
Enables periodic measurements of the SCD30.
First the given measurement interval is set, then - if available - the altitude is set for altitude compensation. The periodic measurement is started using the ambient pressure for compensation (if available).
Reads out measurements of the SCD30.
Disables periodic measurements.
absolute maximum I2C clock speed (100kHz)
Checks, if the SCD30 is ready to receive commands.
Starts continuous measurement of the CO2 concentration, humidity and temperature.
Measurement data which is not read from the sensor by using SCD30_ReadMeas() will be overwritten. The measurement interval is adjustable via the command SCD30_SetMeasInterval(). The initial value is 2sec.
The CO2 measurement value can be compensated for ambient pressure by feeding the pressure value in mBar to the sensor. Setting the argument to zero will deactivate the ambient pressure compensation. For setting a new ambient pressure when continuous measurement is running the whole command has to be written to SCD30
Stops the continuous measurement of the SCD30.
Sets the interval used by the SCD30 sensor to measure in continuous measurement mode.
Initial value is 2s. The chosen measurement interval is saved in non-volatile memory.
Reads the current interval used by the SCD30 sensor to measure in continuous measurement mode.
The data ready function is used to determine if a measurement can be read from the sensor’s buffer.
Whenever there is a measurement available in the internal buffer of the SCD30 "bDataReady" of this function is set to "true". Otherwise it is set to "false". As soon as the measurement has been read using SCD30_ReadMeas() "bDataReady" changes to false.
Reads measurement data from the SCD30.
When new measurement data is available it can be read out with this function.
Sets an offset value of the temperature.
The on-board rH/T sensor is influenced by thermal self-heating of SCD30 and other electrical components. Design-in alters the thermal properties of SCD30 such that temperature and humidity offsets may occur when operating the sensor in end-customer devices. Compensation of those effects is achievable by writing the temperature offset found in continuous operation of the device into the sensor.
Temperature offset value is saved in non-volatile memory. The last set value will be used for temperature offset compensation after repowering.
Reads the current offset value of the temperature.
Sets the height above sea level.
Measurements of CO2 concentration based on the NDIR principle are influenced by altitude. SCD30 offers to compensate deviations due to altitude.
Altitude value is saved in non-volatile memory. The last set value will be used for altitude compensation after repowering.
Reads the current value for the height above sea level.
(De-)Activates Automatic Self-Calibration (ASC).
Continuous automatic self-calibration can be (de-)activated with this function. 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 selfcalibration 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 SCD30_SetForcedRecalib()) 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.
Reads the current Automatic Self-Calibration (ASC) mode.
Sets the Forced Recalibration value (FRC)
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.
Reads the current Forced Recalibration value (FRC).
Reads the firmware version of the SCD30.
Resets the SCD30.
The SCD30 provides a soft reset mechanism that forces the sensor into the same state as after powering up without the need for removing the power-supply. It does so by restarting its system controller. After soft reset the sensor will reload all calibrated data. However, it is worth noting that the sensor reloads calibration data prior to every measurement by default. This includes previously set reference values from ASC or FRC as well as temperature offset values last setting.
The sensor is able to receive the command at any time, regardless of its internal state.