Arduino Forum

Using Arduino => Sensors => Topic started by: moeburn on Mar 04, 2017, 08:45 pm

Title: BME280 sensor periodically returns 0 or "nan", what should I try to fix this?
Post by: moeburn on Mar 04, 2017, 08:45 pm
I'm using the Adafruit BME280 library from here:

https://github.com/adafruit/Adafruit_BME280_Library

But it's designed for the Adafruit BME280 breakout board, whereas I'm using a cheap chinese clone, that looks like this:

(http://i.imgur.com/xoVfPu4.jpg)

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?
Title: Re: BME280 sensor periodically returns 0 or "nan", what should I try to fix this?
Post by: knut_ny on Mar 05, 2017, 01:03 pm
I2C address to use: 0x77=B1110111, 0x76=B1110110.
Skip last bit and get  B111011 = 0x3B

wire.requestFrom(0x3B,nn)
Title: Re: BME280 sensor periodically returns 0 or "nan", what should I try to fix this?
Post by: Kilili on Mar 21, 2017, 11:13 pm
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);"
Title: Re: BME280 sensor periodically returns 0 or "nan", what should I try to fix this?
Post by: silvanm on Apr 29, 2017, 12:02 am
Confirmed. Checking the 3.3v connection helped in my case. I2C seems to work with bad power connection. The sensor however does not.
Title: Re: BME280 sensor periodically returns 0 or "nan", what should I try to fix this?
Post by: Wawa on Apr 29, 2017, 03:51 am
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.
Leo..