CCS811 strange measurements

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
backdraft
 
Posts: 6
Joined: Wed Nov 15, 2017 3:54 pm

CCS811 strange measurements

Post by backdraft »

Hi all,

I got one of Adafruits CCS811 breakouts (https://www.adafruit.com/product/3566) to monitor my indoor air quality. So I installed the adafruit library and uploaded the unchanged test sketch which seemed to work fine at first but after a while I noticed a strange effect.

After I start the sensor I get VOC values from 0 to 20 ppb which look resonable. But when I open the windows in my appartment to get fresh air in, the VOC values (after dropping a bit while ventilation) sky rocket to maximum sensor value (around 1200ppb) and need hours to recover. In some cases they stay high until I reset the arduino and sensor. I uploaded a plot of one of my measurements for illustration. The chart is over a period of roughly 20 hours. I did several tests.... all with similar behaviour.

Why is this? Is my sensor broken? Do I have to add something in the code to avoid this?

Thx in advance.
Attachments
voc.PNG
voc.PNG (6.96 KiB) Viewed 1510 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CCS811 strange measurements

Post by adafruit_support_mike »

That graph shows a typical exponential-decay curve, which is what I'd expect from a room getting a sudden burst of new gas.

It looks like a couple of the CCS811's operating modes filter the output, which could also produce that kind of output. What values do you get from the RAW_DATA registers, and what readings do you get outside?

User avatar
backdraft
 
Posts: 6
Joined: Wed Nov 15, 2017 3:54 pm

Re: CCS811 strange measurements

Post by backdraft »

Hi Mike,

thanks for your reply. I logged the raw values like you suggested and plotted it (duration roughly 13h).

Reference code (after init with normal adafruit library). Conversion ADC value to voltage (*1.65/1023) is done in Excel.

//edit:
reference code removed (was rubbish).

I cant see any spikes related to my acitivity (leaving, entering, ventilating).

Maybe I did something wrong?

// edit:
Graph removed (was rubbish too). See below for new graph
Last edited by backdraft on Mon Nov 27, 2017 2:28 pm, edited 2 times in total.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CCS811 strange measurements

Post by adafruit_support_mike »

Try taking a running average of the readings:

Code: Select all

#define SAMPLES  3

   average = (( average * SAMPLES ) + latest_reading ) / ( SAMPLES + 1 );
The readings have a lot of noise, but it does look like there are some patterns underneath.

User avatar
backdraft
 
Posts: 6
Joined: Wed Nov 15, 2017 3:54 pm

Re: CCS811 strange measurements

Post by backdraft »

I did a moving average in Excel (with 3 samples) but it was still very noisy so I did it again with 10 samples (which equals 2.5min). Thats the result


//edit:
Graph removed (data is rubbish). See below for new graph
Last edited by backdraft on Mon Nov 27, 2017 2:27 pm, edited 2 times in total.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CCS811 strange measurements

Post by adafruit_support_mike »

That suggests the sensor itself is working properly, and the larges spikes you're seeing are related to the internal filtering and processing.

Try collecting a series of raw sensor values and filtered output values at the same time. Let's see what happens in the raw data when one of those spikes shows up.

User avatar
backdraft
 
Posts: 6
Joined: Wed Nov 15, 2017 3:54 pm

Re: CCS811 strange measurements

Post by backdraft »

I am sorry. I did a (stupid) mistake the first time I took the raw data (which explains why there isnt any noteworthy variation in raw data). So please ignore my old graphs. Here is a (this time hopefully correctly sampled) set of data. I think it is clear that the spikes are represented in voltage as well as in voc values. So the algorith with which the voc values are calculated doesnt seem to be the problem. So maybe the sensor is faulty? Can anyone verify this effect? All I did was to put the sensor on our table in our living room for 26h and let some fresh air in for a few minutes (three times).

Reference code:

Code: Select all

void loop() {
  
  Wire.beginTransmission(0x5A);
  Wire.write(0x02);
  Wire.endTransmission();
  delay(1);
  Wire.requestFrom(0x5A, 8);
  delay(5);
  uint8_t myBuffer[8];
  for (int i=0;i<8;i++) myBuffer[i]=Wire.read();

  uint8_t current=0;
  uint16_t voltage=0;
  uint16_t co2=0;
  uint16_t voc=0;

  co2=(uint16_t)(myBuffer[0]) <<8 | myBuffer[1];
  voc=(uint16_t)(myBuffer[2]) <<8 | myBuffer[3];
  current=myBuffer[6]>>2;
  voltage= uint16_t(myBuffer[6] & 0b11) << 8 | myBuffer[7];
  voltage=(uint16_t)(voltage*(1650.0/1023.0)+0.5);

// ### many serial prints ### //

  delay(15000);
}
Attachments
chart1.png
chart1.png (18.33 KiB) Viewed 1396 times
chart2.png
chart2.png (20.93 KiB) Viewed 1396 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CCS811 strange measurements

Post by adafruit_support_mike »

It's hard to say whether those graphs are meaningful data or random nose from a damaged sensor.

Let's control some variables and see what happens: try putting the CCS811 in a sealed plastic container and take another series of readings. The container should keep the atmosphere around the CCS8811 from changing, so any changes that do show up can probably be attributed to noise generated within the sensor itself.

User avatar
backdraft
 
Posts: 6
Joined: Wed Nov 15, 2017 3:54 pm

Re: CCS811 strange measurements

Post by backdraft »

Hi Mike,

I put the sensor in a contrainer like you suggested (good idea by the way) (see attachment). For the sake of comparability I used the same y-axis scale even though the voc-measurement details might not be perfectly visible now.

But you can definitely see that the voc levels are very stable and very low inside the container (compared to before). There is only one spike worth mentioning and the beginning of the spike (at 700min) is nearly exactly when I left home this morning (So I guess the sealing of my box was not perfect).

The little drop of VOC levels when I left home seem to be plausible (since all creatures emit voc??!). So in conclusion this means that I only have to protect the sensor from direct airflow while ventilating?

Or is there any other explanation?
Attachments
voc.PNG
voc.PNG (15.93 KiB) Viewed 1364 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: CCS811 strange measurements

Post by adafruit_support_mike »

That sounds reasonable.

Direct airflow across the sensor could do a couple of things: first, it will cool down the heater, which will have an effect on detection. Second, it takes time for the sensor to respond to chemicals in the air. If air is moving through the sensor faster than it expects, that could also have an effect on the readings.

Try replacing the lid of the container with a piece of light fabric. That will let air reach the CS811, but will stop wind.

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

Return to “Other Products from Adafruit”