CCS811 errors

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

CCS811 errors

Post by jerryn »

I have been playing with a CCS811 sensor for the past few days and am running into a puzzling error.
Note: I have seen this same issue via Arduino IDE, and CircuitPython, on both ans 8266 Feather and an M0 Express.

At this point I have the sensor on an 8266 Feather under the Arduino IDE.
The issue is that after running for some time (minutes to hours) the sensor will hang up - and a read attempt will result in a returned status of False (255).
This indicates that during a read attempt, the DAT_READY Flag is not set but the code always polls for the DATA_READY being set before attempting the read.
To get this failure, The poll but be getting DATA_READY True then when it goes to read, somehow DATA_READY had gone back to false. I suspect that the senor has just hung entirely and is not responding.

I am able to usually get it working again by toggling the RESET line on the CSS811 and then re-initializing.
If the re-init fails, I toggle the 8266 RST line to reset the whole thing. Somethings this works...

Here is the read section of my sketch. As you can see, it polls for the data to be available before reading. Every time this fails, the status is reported as 255 which indicates the data is not ready. A real "error" reading would have a different value.


Has anyone run one of these for an extended period of time without any errors? I'll never get it to complete the 48 hour "burn" in at this rate ;-)
Is this a flaky sensor?

Code: Select all

void get_reading()
{
  oled.setCursor(0,0);
  if(ccs.available()){
    oled.clearDisplay();
    float temp = ccs.calculateTemperature();
    uint8_t ccs_stat;
    if(!(ccs_stat=ccs.readData())){
      oled.print("eCO2: ");
      Serial.print("eCO2: ");
      eCO2 = ccs.geteCO2();
      oled.print(eCO2);
      Serial.print(eCO2);
      
      oled.print(" ppm\nTVOC: ");
      Serial.print(" ppm, TVOC: ");      
      float TVOC = ccs.getTVOC();
      oled.print(TVOC);
      Serial.print(TVOC);
      
      Serial.print(" ppb   Temp:");
      oled.print(" ppb\nTemp: ");
      Serial.println(temp);
      oled.println(temp);
      oled.display();
    }
    else{
      Serial.println("ERROR!");
      Serial.println(ccs_stat);
      oled.print("ERROR!");
      oled.display();
      digitalWrite(RESET, LOW);   // Pull RESET LOW
      delay(250);                      
      digitalWrite(RESET, HIGH);    // set RESET line HIGH
      delay(250); 
      if(!ccs.begin()){
           Serial.println("sensor not responding - attempting hard reset.");
           digitalWrite(RST, LOW);   // Pull RST LOW     
           while(1);
      } 
 

    }
  }
  delay(500);
     
  
 
 

}


User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Just a brief update: I have been running the sensor continuously for the past two days. I continue to get the error: sometimes after 5 minutes, sometimes after an hour or more...
My reset code seems to take care of it and it restarts but it is annoying!
Is anyone else using this sensor? I'd appreciate knowing if you are able to run it without it hanging as I am seeing.

Note: I am running it in the default mode set up by the examples - 1 second sampling.

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

Re: CCS811 errors

Post by adafruit_support_mike »

If the errors happen at random intervals, the underlying problem isn't likely to be in the code.

Post a photo showing your hardware and connections and we'll see if those have any clues. 800x600 images usually work best.

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Agreed. The sensor just appears to randomly stop responding until it is RESET.

Here are some photos as requested.
IMG_0141 (1).jpg
IMG_0141 (1).jpg (118.18 KiB) Viewed 3059 times
IMG_0142 (1).jpg
IMG_0142 (1).jpg (93.25 KiB) Viewed 3059 times

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

Re: CCS811 errors

Post by adafruit_support_mike »

Your soldering and connections look good, but breadboards are notoriously flaky.. lots of unexpected parasitic resistance, capacitance, etc.

Try moving the boards to different places on the breadboard and see if it has any effect on the errors.

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Mike, I tried hooking it up without the breadboard at all. Just used jumpers to go from a feather tripler to the sensor.
I has been running for an hour now with no errors. I'll let it run overnight and report back. So far so good.
Thanks for the suggestion.

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Nevermind - It crashed after about 90 minutes.

Back to square one. I'm restarting to see if I can get some repeatability, but I think it's a bit flaky...

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Errors are recurring as in the past. One after another 30 minutes then an hour until the next one. Oh well...
As before, the sensor only recovers if the RESET line is pulled low. I then can be reconfigured and restarted.

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

Re: CCS811 errors

Post by adafruit_support_mike »

Okay, that rules out another class of issues.

Do you happen to have access to an oscilloscope or logic analyzer? At this point it would really help to see what the signals are doing.

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

I do have an oscilloscope. What would you like to see?

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Here are some scope shots of SCL (yellow) and SDA (blue)
Are the short spikes on SDA normal?
Is there some particular picture you would like to see.
I will try to trigger it on the RESET to see if anything shows up. That may take some time...
DS1Z_QuickPrint7.png
DS1Z_QuickPrint7.png (52.15 KiB) Viewed 2966 times
DS1Z_QuickPrint8.png
DS1Z_QuickPrint8.png (34.88 KiB) Viewed 2966 times

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

here is another shot of SCL and SDA with the trigger on the RST line so it is the last transmission before it hangs.
DS1Z_QuickPrint1.png
DS1Z_QuickPrint1.png (48.35 KiB) Viewed 2958 times
this is an expanded view of the SCL/SDA traces:
DS1Z_QuickPrint2.png
DS1Z_QuickPrint2.png (46.02 KiB) Viewed 2958 times

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

Re: CCS811 errors

Post by adafruit_support_mike »

Thank you for the traces.. that helps.

I see some serious ringing and transient coupling between the SDA and SCL signals (the spikes in the blue trace when the yellow trace goes high or low). That will be a combination of the supply voltage and the wiring.

Start by putting a capacitor in the 10uF to 100uF range into the breadboard's power rails right next to the CCS811. It takes time for current to get from one end of a wire to the other, and a capacitor works like a nearby battery for sudden changes in current.

See what effect that has on the spikes, and if any still exist, try putting 100-ohm resistors into the connection between the Feather's I2C pins and the breakout. Electrical signals echo in wire, and a resistor burns off the energy that would otherwise bounce back.

User avatar
jerryn
 
Posts: 1975
Joined: Sat Sep 14, 2013 9:05 am

Re: CCS811 errors

Post by jerryn »

Thanks for the suggestions - I added a 100uF cap (also tried 47uF-looked the same) and the signals look better, but there are still spikes and I still got errors.
I also added the 100 ohm resistors to SDA/SCL but still the errors persist...
Do I have this setup up correctly?
Note - the magenta trace is just the RST line used to trigger on errors (ignore it in these pics)
IMG_0150.JPG
IMG_0150.JPG (108.36 KiB) Viewed 2916 times
DS1Z_QuickPrint3.png
DS1Z_QuickPrint3.png (48.78 KiB) Viewed 2916 times
DS1Z_QuickPrint4.png
DS1Z_QuickPrint4.png (44.82 KiB) Viewed 2916 times

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

Re: CCS811 errors

Post by adafruit_support_mike »

Those signals are much cleaner than the previous ones, and I don't see any remnants left that would be large enough to cause a signal error.

Looking back at your original code, I see that you call oled.clearDisplay() between checking the ready pin and requesting a value from the sensor. Try swapping those around.. contact the sensor immediately after checking the pin, and only update the OLED after you get the new value. The more stuff you do between checking the pin and getting the data, the more time there is for the pin to change.

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

Return to “Other Products from Adafruit”