kubedzero / arduino-projects

Arduino C++ sketches for ESP8266 dev boards and Arduino Nanos
0 stars 0 forks source link

BME280 SensorID is 0x255 #1

Open GHBLoos opened 3 years ago

GHBLoos commented 3 years ago

Hi,

II have several BME280's that stopped working and gave error below.

Could not find a valid BME280 sensor. Check wiring, address, and sensor ID.
SensorID is: 0x255
0xFF: is a BMP180 or BMP085, or a bad address
0x56-0x58 is a BMP280
0x60 is a BME280
0x61 is a BME680

Google brought me at your Github where I read your readme.md.

2020/03/04 Update: Trying to update from the 1.1.0 version of the BME280 library to the 2.0.1 version, which notes a breaking change of dumbing down the sensor detection. Currently in 1.1.0 my Trace logs show Wire SensorID was: 0x96 whereas I think it's expecting 0x77 or 0x76. After updating the library though the trace shows the Wire SensorID was: 0x255. I had to update the signature to bme280.begin(0x76, &Wire) to get it working, and then it worked just as it used to.

Did you have the same error, and if you solved it, how exactly did you do that?

Gaston

kubedzero commented 3 years ago

That sounds as if we might have been encountering the same error. By default, when you call bme280.begin() it will do a search for sensors with the ID 0x60. However, the BME280 sensor I had (as discovered by doing an I2C scan) actually didn't have 0x60 as an address and instead had 0x76.

By changing my code from bme280.begin() to bme280.begin(0x76, &Wire) I was able to tell the BME280 library exactly what sensor ID to look for, and that fixed the issue.

https://playground.arduino.cc/Main/I2cScanner/ is the scanner I used to confirm the BME280 sensor address/ID

GHBLoos commented 3 years ago

I can't get it to work right now. This part in the code I use: debugI("SensorID is: 0x%d", adafruit_bme280_->sensorID()); results in 0x255, but I think that should be formatted to hex, so 0xFF, right?

kubedzero commented 3 years ago

When the BME280 library reports that the sensorID is 0x255, it's most probably an error and not the actual sensorID.

Did you run the I2cScanner library, and if so, can you list its output here?

GHBLoos commented 3 years ago
No I2C devices found

Scanning...
kubedzero commented 3 years ago

It sounds to me then as if the issue is in hardware, aka the Arduino is not picking up anything connected to I2C.

If you unplug the BME280 entirely, I bet you'll see the same behavior both from your own code and the I2C scanner.

I'd maybe check the wiring next, but at this point considering the I2CScanner couldn't find the BME280 either, I don't think it's an issue with software.

Edit: You could also try sensor ID 0x96 or 0x77 (assuming you've already tried 0x76) just to cover the spectrum