CCS811 TVOC sensor issue(s)

Hi,
I'm trying to use a CCS811 sensor module to measure VOC's emitted from a device which momentarily melts small pieces of soft PVC tubing. I have the module connected exactly as shown in the attached image. I am using the example sketch from the adafruit CCS811 library as follows...


Adafruit_CCS811 ccs;

void setup() {
  Serial.begin(9600);

  Serial.println("CCS811 test");

  if(!ccs.begin()){
    Serial.println("Failed to start sensor! Please check your wiring.");
    while(1);
  }

  // Wait for the sensor to be ready
  while(!ccs.available());
}

void loop() {
  if(ccs.available()){
    if(!ccs.readData()){
      Serial.print("CO2: ");
      Serial.print(ccs.geteCO2());
      Serial.print("ppm, TVOC: ");
      Serial.println(ccs.getTVOC());
    }
    else{
      Serial.println("ERROR!");
      while(1);
    }
  }
  delay(500);
}

my question is regarding the delay function... for some reason I am getting readouts approximately 1 per second. even though the delay is set to 500ms. even if i lower the delay to 100ms it still only prints a reading once every second. Can anybody shed some light on why this might be please?

Thanks
this is the sensor I'm using: (CJMCU CCS811 811 Gas Sensors Air Quality Sensor Module for ESP8266 ESP32 Arduino | eBay)

arduino-sensor-c02-ccs811-conexion

Datasheet sez:

The CCS811 supports
multiple drive modes to take a measurement every 1 second, every 10 seconds, every
60 seconds, or every 250 milliseconds.

It also mentions it does I2C "clock stretching" that can slow things down.

Modes of Operation
The CCS811 has 5 modes of operation as follows
• Mode 0: Idle, low current mode
• Mode 1: Constant power mode, IAQ measurement every
second
• Mode 2: Pulse heating mode IAQ measurement every 10
seconds
• Mode 3: Low power pulse heating mode IAQ
measurement every 60 seconds
• Mode 4: Constant power mode, sensor measurement
every 250ms
In Modes 1, 2, 3, the equivalent CO2 concentration (ppm) and
TVOC concentration (ppb) are calculated for every sample.
• Mode 1 reacts fastest to gas presence, but has a higher
operating current
• Mode 3 reacts more slowly to gas presence but has the
lowest average operating current.
When a sensor operating mode is changed to a new mode with
a lower sample rate (e.g. from Mode 1 to Mode 3), it should be
placed in Mode 0 (Idle) for at least 10 minutes before enabling
the new mode. When a sensor operating mode is changed to a
new mode with a higher sample rate (e.g. from Mode 3 to Mode
1), there is no requirement to wait before enabling the new
mode.
Mode 4 is intended for systems where an external host system
wants to run an algorithm with raw data and this mode provides
new sample data every 250ms.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.