Zanduino / BME680

Arduino Library to access the Bosch BME680 - temperature, pressure, humidity and gas sensor
GNU General Public License v3.0
37 stars 10 forks source link

Sporadic problems when reading Humidity and Pressure #14

Closed SV-Zanshin closed 4 years ago

SV-Zanshin commented 4 years ago

Expected Behavior

Values for temperature, humidity and pressure should be plausible

Actual Behavior

Occasionally, the BME680 using the example SPIDemo program, will show correct temperature values but the humidity will read 100% and the pressure will be below 700hPa although it should be close to 1000hPa.

Steps to Reproduce the Problem

Power down the device and restart. Sometimes the error will be reproducible. It seems to be a non-deterministic occurrence.

Specifications

Zanshin Logo

SV-Zanshin commented 4 years ago

This is an odd problem that has been bothering me for some time, as it was quite non-deterministic in nature. Looking around the various forums on the internet for the BME680 it would seem that others have had this problem as well, and it was not always clear what the problem was.

I found that I could write values to the "Ctrl_Hum" register bits 0:2, which control the oversampling rate of the humidity sensor and regardless of what I wrote to that address, the values would remain "0" (humidity sensor turned off). Sometimes cycling the power would fix that, sometimes calling "reset()" would work, but not always.

SV-Zanshin commented 4 years ago

It seems as if writes to the registers, or at least this register, don't take effect if there is an active conversion in progress. Changing the [SetOversampling()](https://github.com/SV-Zanshin/BME680/wiki/setOversampling()), [setIIRFilter()](https://github.com/SV-Zanshin/BME680/wiki/setIIRFilter()) and [setGas()](https://github.com/SV-Zanshin/BME680/wiki/setGas()) functions so that they wait for any active conversion to finish solves the issue.

SV-Zanshin commented 4 years ago

Fix implemented for v1.0.6