I'm using the Adafruit BME280 library from here:
But it's designed for the Adafruit BME280 breakout board, whereas I'm using a cheap chinese clone, that looks like this:
I already had to edit the Adafruit library to use i2c address 0x76 instead of its default 0x77, to work with the BME280 clone. But I'm periodically getting a temperature reading of 0.00 (in a 21C room), or sometimes even a reading of "nan". It's very rare, maybe one out of every 100 readings, and inconsistent.
Now this is a cheap chinese board with much fewer components than the Adafruit board, so it could simply be a result of a faulty breakout board design. But is there anything in the library I could try editing to prevent this? Maybe using a slower i2c speed?
I2C address to use: 0x77=B1110111, 0x76=B1110110.
Skip last bit and get B111011 = 0x3B
I encountered this same problem today, except was getting "nan" more often than not, and traced it back to a problem with the 3.3v power connection.
Don't have to change the library, just use "bme.begin(0x76);"
Confirmed. Checking the 3.3v connection helped in my case. I2C seems to work with bad power connection. The sensor however does not.
Adafruit's BME280 board has an onboard I2C level shifter. The clone has not.
The clone therefore must be used with a 3.3volt Arduino.
Or you have to add an I2C level shifter breakout board.