All,
I am getting a very strange behavior from a CCS811 gas sensor used with a Wemos D1.
I have followed the recommendations from the below case
https://www.b4x.com/android/forum/threads/normal-behavior.81417/#post-516437
and actually the I2C readings/writings from/to the sensor work just fine for a while but after some time (I was not able to identify any root cause) upon the status request (see below code) for some reasons the sensor does not reply with the status byte and (I believe) does not reply at all because the "readbyte.lenght" is NOT 1 and from that moment on the sensor stops responding to I2C requests..
the only way to restore it is via HW reset pin which of course takes it back to the default 400 reading for CO2 even if before the rest the sensor was sensing lets' say 1000 (just an example..).
I have tried everything I could think..like retrying..(the sensor actually never recovers until you reset it..so rethy won't work), re-initializing the I2C bus (no luck)...
Does anybody have a clue?
THANKS!!
I am getting a very strange behavior from a CCS811 gas sensor used with a Wemos D1.
I have followed the recommendations from the below case
https://www.b4x.com/android/forum/threads/normal-behavior.81417/#post-516437
and actually the I2C readings/writings from/to the sensor work just fine for a while but after some time (I was not able to identify any root cause) upon the status request (see below code) for some reasons the sensor does not reply with the status byte and (I believe) does not reply at all because the "readbyte.lenght" is NOT 1 and from that moment on the sensor stops responding to I2C requests..
the only way to restore it is via HW reset pin which of course takes it back to the default 400 reading for CO2 even if before the rest the sensor was sensing lets' say 1000 (just an example..).
I have tried everything I could think..like retrying..(the sensor actually never recovers until you reset it..so rethy won't work), re-initializing the I2C bus (no luck)...
Does anybody have a clue?
THANKS!!
B4X:
Private readbyte(1) As Byte
Private writebyte(1) As Byte
writebyte(0) = STATUS
master.WriteTo2(CSS811_ADDRESS,True,writebyte)
Delay (50)
readbyte = master.RequestFrom(CSS811_ADDRESS,1)
If readbyte.Length=1 Then
....