Issue Intro
- We use a CCS811 gas sensor to approximate the aerosol quantity in rooms, which then in turn indicates the potential virus quantity in the air and thus serves as warning if it is necessary to ventilate the room.
- The problem is that our CCS811 gas sensors return implausibly high co2 values after 2 hours 25 minutes, i.e.: Values above 1.500 ppm, raising up to a maximum value of 2.170 ppm.
- Normal, expected co2 values measured for our office room would rather be like these: Minimum: 400 ppm, Average: 450 ppm, Maximum: 650 ppm.
- Did you get robust, sustainable, stable sensor readings using the CCS811 and if yes, what did you do compared to our approach (in terms of usage / configuration of the hardware, library / programming)?
- In the following, I provide details of our current approach:
Hardware Setup
-
Gas Sensor: CCS811
- photo and description: CJMCU-811 - RevSpace
- manufacturer / bought from: Search | ams
- data sheet found at: https://www.sciosense.com/products/environmental-sensors/ccs811-gas-sensor-solution/
-
Temperature and Humidity Sensor: HDC1080
- We have tested both the CCS811 gas sensors that have and those that don't have the HDC1080 integrated on the same circuit board.
-
Microcontroller unit (board): LilyGO TTGO T-display ESP32
Issue and Observations Details
- CCS811 returns implausibly high co2 readings after 2 hours 25 minutes: over 1.500 ppm, up to max. 2.170 ppm.
- This happens without having significantly intensive co2 sources (emitters) nearby and without changing the environment. I.e., nothing from the environment would cause such an implausible step-by-step increase of the values to such high values. Thus, this highly likely should be some error caused by the sensor or by its programming / usage.
- Then, the co2 value stays at its maximum (2.170 ppm) until the sensor is reset by our program.
- After a sensor reset, it shows plausible values like 417 ppm again, but only for a short time:
After that, it takes only a few hours until the sensor returns those implausibly high co2 values again. - It does not matter whether the hardware chip contains the HDC1080 or not.
- Normal, expected co2 values measured for our well ventilated office room are: Minimum: 400 ppm, Average: 450 ppm, Maximum: 650 ppm.
Library and Implementation Details
-
Libraries used for the sensors:
// For the CCS811 GAS sensor #include <Wire.h> #include "SparkFunCCS811.h" // For the CJMCU-8118 (Gas & TempHumid)'s => HDC1080 chip (temp & humid) #include "ClosedCube_HDC1080.h"
-
Default, basic setup and usage:
-
We have put our sensor on to an Arduino breadboard, thus there is an only 3 mm thin "air" space between the bottom of the chip and the top of the breadboard.
-
We do not set or change any of the sensor's internal registers, i.e. we leave those at their default values.
-
We just run our simple program that uses the SparkFunCCS811 Arduino library on the microcontroller that is connected with the CCS811 in a standard way using I2C.
-
-
Each 10 seconds, we read the gas sensor's co2 value this way:
if (gasSensor.dataAvailable()) { gasSensor.readAlgorithmResults(); airQuality.timeStamp = millis(); airQuality.co2 = gasSensor.getCO2(); }
-
That's the same way as it is recommended by the library example at:
SparkFun_CCS811_Arduino_Library/Example1_BasicReadings.ino at master · sparkfun/SparkFun_CCS811_Arduino_Library · GitHub
-
That's the same way as it is recommended by the library example at:
-
Each 5 minutes, we perform a sensor reset as follows:
gasSensor.beginWithStatus(Wire);
-
The following library example does a "reset" this way only once, i.e. during their setup() method:
SparkFun_CCS811_Arduino_Library/Example9_AdvancedBegin.ino at master · sparkfun/SparkFun_CCS811_Arduino_Library · GitHub
-
The following library example does a "reset" this way only once, i.e. during their setup() method:
Possible causes and facts to consider
As they are mentioned by the sensor's PDF manual or related PDF sheets:
Do we have to take special actions related to the topics written in the data sheet ( https://www.sciosense.com/wp-content/uploads/documents/SC-001232-DS-2-CCS811B-Datasheet-Revision-2.pdf ) at pages 12-13? E.g.:
-
Temperature and Humidity Change Compensation?
In an office room like ours, this does not change a lot though. Plus, the manual considers this only as an improvement of accuracy, not as a solution to the observed bug with implausibly high values.- In the related thread: "CO2 level readout Adafruit ccs811 CO2 sensor gradually increases"
The author fanofard (temporarily) got better sensor readings after applying temperature & humidity as a correction input. However, only a static, constant input temperature & humidity value was used in an outdoor scenario and the author was not sure whether applying dynamic, measured correction values would lead to robust results in general and especially indoors.
- In the related thread: "CO2 level readout Adafruit ccs811 CO2 sensor gradually increases"
-
Repeatedly resetting the sensor
- In the related thread: "Does CCS811 has any helpful value as CO2 & TVOC Sensor?"
The author MartinHill implemented and tested a very frequent sensor reset, i.e. resetting the sensor every loop with probably only short waiting (intervals) before the next, programmed sensor reset. However, this is also not mentioned or recommended by the sensor's manual and it did not result in long-term, stable results: Instead, the author's tests showed, that the problem reoccurred after 3 or 7 hours of operation (see diagrams there).
As a difference, we wait 300 seconds before we perform a sensor reset, but the problem remains, too.
- In the related thread: "Does CCS811 has any helpful value as CO2 & TVOC Sensor?"
- Sensor Burn-In
Let sensor run 48 hours without interruption?
For both the authors of the above mentioned threads, this did not help, too. - Measurement cycle
We implement this simply by calling the sensor read method every 10 seconds through our Arduino program. Do we need to do more here, e.g. configure the hardware / write to some of its registers? - Baseline correction
Is the default, namely "automatic baseline correction", sufficient to use for our standard use-case: office room, and for later use-cases: class room, car? Do we have to take any (time) constraints into account like, e.g.: Let the sensor run at least for 24 or 48 hours without interruption or power-off?
Related Project Thread
- In the related thread: "CO2 meter / air indicator"
The authors have tested 5 sensors and they recommend to use another sensor than the CCS811, because they had issues even after applying correction values.
It would be great if you could help us and share your experiences with us.
Thanks.