As the title says... Chat on...

User avatar
By Warthog
#86120 Hello,
I have a breakout board with a ccs811 and SI7021 temp/hum sensor. I wanted to write the temp und humidity data into the ENV_DATA register of the ccs81, but when I read the data again, it seems that writing the data into the register was not successful.

Output of my debug lines:

Code: Select allccs811 CO2 :2985
ccs811 TVOC:393
ccs811 CO2 :4798
ccs811 TVOC:670
Humidity: 31.250  Temperature: 27.249 <-- (from SI7021)
ENV_DATA before: hum=17 0   temp=0 0 <-- reading the ENV_DATA register
 bytes written 4 <-- looks good
write to ENV_DATA: hum=62  temp=52 <-- hum must be leftshifted, temp=temp+25
ENV_DATA  after: hum=17 0   temp=0 0 [b]<-- *** PROBLEM ***[/b]
BMP280 Temp=27.28  QFE=1027.978 
ccs811 CO2 :3173
ccs811 TVOC:422
ccs811 CO2 :4973
ccs811 TVOC:696


Every minute I call this function via timer:

Code: Select allfunction read_SI7021()

   hum, temp, hum_dec, temp_dec = si7021.read()

   print(string.format("Humidity: %d.%02d  Temperature: %d.%02d", hum, hum_dec, temp, temp_dec))   
   
    css811_writeEnvData(hum, temp)  <-- writing to css811
   
end


Please see the attached file.
Attachments
(3.25 KiB) Downloaded 376 times