Comments (15)
Hmm, not sure what is going on.
I do know the CCS811 requires clock stretching, and that not all controllers (I2C masters) support that.
For example, I used an ESP8266, and some extra waits are required (built-in in the lib).
What I do see is that your controller (which MCU is that by the way) does see the CCS811.
We do get the correct hardware version fro example.
So that is good.
But the first status lines are bad. You get
errstat=0=--vhxmrwf--ad-ie
but you should get something like
errstat=90=--vhxmrwF--Ad-ie
The "A" flag must be 1, it means that the internal memory contains a valid application.
That flag can never be 0 (it would mean you erased the memory, and no operation is possible).
The "F" flag must be 1 at this point in time. It means there is a valid application, and the the bootloader started it. A 0 means the chip is still in bootloader mode.
Since the next line is ok, and you even get data sometimes, I think the chip has a valid app A-hi and that app is running F-hi, but the (I2C) communication has errors.
- what MCU are you using
- do you have I2C pull-ups
- are you using set_i2cdelay()
- what I2C bus speed are you using
- do you have an I2C analyzer (like Saleae) to check the I2C traffic?
- what is the link to the Adafruit library you are using?
- I do not have the CCS811 board you have.. . could you send me one?
from ccs811.
I have this MCU: https://www.aliexpress.com/item/1PCS-Wireless-module-CH340-NodeMcu-V3-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266/32665100123.html
I do not have i2C pull-ups. I assumed they are on board. All other things are working: i2c display and HTU21D sensor. But i can add them and see does they change something.
I used library default example sketch. Nothing changed.
I can use oscilloscope. If needed.
Adafruit library: https://github.com/adafruit/Adafruit_CCS811/
from ccs811.
That is strange - I have (at least at first sight) exactly the same board as you.
The bad news is that ESP8266 is bad a clock stretching - but for me the lib is working on ESP8266.
I believe the ESP8266 has internal pull-ups, but weak ones, and they only become active when wire.begin() is called, which causes some "bus spikes" during startup. Adding pull-ups has helped me in the past in some cases. You might try, but I don't think it is the cause of your problems.
Because you do get some sensible output now and then but nonsens in other cases, I still suspect the I2C communication (hence a bus trace would be nice).
You said the Adafruit lib does work with CCS811, but you have other problems with it. What does that mean precisely? CCS811 is always working with that lib, but you have problems elsewhere (humidity sensor/oled). Or does the Adafruit lib also cause problems with CCS811? I see the Adafruit lib is using Wire.setClockStretchLimit(500); maybe that helps.
from ccs811.
When I use CCS811 Adafruit library it works for some time: 30m or 3h. Then i get eCO2 reading 39040ppm and in next loop i will lost connection with CCS811.
I added your I2C bus clear library. All other i2C devices will keep working. CCS811 will not respond and recovers only when i manually restart MCU.
I have now second similar CCS811 + 10K pull-ups. Your library works same way like before.
I will test now does pull-ups fix my problem or does one CCS811 is just bad.
btw. From one of your example i learned how to use thingspeak.com. Thank You!
from ccs811.
from ccs811.
1.After i added pull-ups it seems to be more stable but not error free. For long time it was always same number (39040) but now i am not sure anymore.
One recorded error: https://imgur.com/a/nRB0H6Y
My reset is now this:
else{
Serial.println("CCS811 reading ERROR!");
I2Cbus_clear(SDA,SCL);
Wire.begin();
delay(100);
digitalWrite(CCSRESET, LOW);
delay(300);
digitalWrite(CCSRESET, HIGH);
if(!ccs.begin()){
Serial.println("Failed to restart CCS811!");
while(1) delay(1);
}
}
After that CCS811 works again. And its resolves the problem for me.
- I'm testing now your library with Nano (Atmega328p Old Bootloader).
2.1 There seems to be some typos:
file:ccs811.h line 64 and 65
ccs811.cpp line 278 and 289
Should be uint16_t not uint16
2.2 First it worked the same way. Lot of waiting before i get data:
Starting CCS811 basic demo
init: hardware version: 12
init: bootloader version: 1000
init: application version: 1100
CCS811: errstat=0=--vhxmrwf--ad-ie
CCS811: errstat=0=--vhxmrwf--ad-ie
CCS811: waiting for (new) data
CCS811: waiting for (new) data
After i added delay(500) on beginning. I get more data. 1000 is waiting free (+1000 at the end).
CCS811: eco2=400 ppm etvoc=0 ppb
CCS811: eco2=403 ppm etvoc=0 ppb
CCS811: waiting for (new) data
CCS811: eco2=400 ppm etvoc=0 ppb
CCS811: waiting for (new) data
CCS811: eco2=400 ppm etvoc=0 ppb
CCS811: eco2=400 ppm etvoc=0 ppb
CCS811: waiting for (new) data
CCS811: eco2=400 ppm etvoc=0 ppb
CCS811: eco2=409 ppm etvoc=1 ppb
My testing is been to short to say does CCS811 error appears or not.
from ccs811.
(1a) The problem of a CCS811 reset, is that you loose the internally maintained baseline.
(1b) With Serial.printf("setup: I2C bus: %s\n", I2Cbus_statusstr(I2Cbus_clear(SDA,SCL)))
you can see what bus clear actually did.
(2) I fixed the typos (and some warnings)
I would like to play with your board myself...
from ccs811.
I would like to play with your board myself...
I ordered one chinese clone
from ccs811.
After quite some research, I found a bug in the ESP8266 core libraries, which caused problems when an I2C devices stretches the clock - just as CCS811 does.
See the last paragraph of the ESP8266 section in the readme. You might want to try that! Solved all my problems in the CCS811 driver.
from ccs811.
Thank You. I will try it.
from ccs811.
I've been testing this for a few days now and I think this will fix the problem with CCS811!
from ccs811.
from ccs811.
It seems my proposed change for the i2c library is accepted, so when there is a new release of the esp8266 library or should work.
Are you happy, can I close this issue?
from ccs811.
Yes i am happy!
from ccs811.
closing
from ccs811.
Related Issues (20)
- Esp32 Deepsleep confusion HOT 1
- Problem with CCS811 version HOT 1
- CCS811 firmware demoted to version 1.1.0 HOT 3
- Seek help from CCS811
- begin() required before flash() ? HOT 2
- Self over-heating
- Having a simple questions about the CCS811 function when it comes to modes HOT 5
- [Question] Modes, Burn-In - Several Questions HOT 3
- ESP32 ERRO I2C HOT 2
- IC2 Error with nodemcu HOT 2
- LilyGo T5 V2.3 and cjmcu-8128. Unable to flash ccs811 HOT 3
- Sensor faulty or soldering issue? HOT 2
- Issues in CCS811 sensor reading HOT 2
- version checking functions have wrong comment, I think HOT 2
- Readings drift higher over time. HOT 3
- CCS811 Baseline Issues HOT 8
- My CCS811 from CJMCU does not works after flashing comleted. HOT 2
- Can it really be used for co2 monitoring? HOT 2
- C811 baseline HOT 2
- Firmware version not detected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ccs811.