Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    BME280 over I2C + driver v3.4.3 + ESP32 readings not changing

    BME280 over I2C + driver v3.4.3 + ESP32 readings not changing

    New Poster

    I've just started using a BME280, and I'm using it with my ESP32 (specifically the Adafruit Huzzah32). Looking for existing implementations, I found yanbe/bme280-esp-idf-i2c . This uses the original version of the driver, v2.0.5. Updating yanbe's implementation to build on the ESP-IDF v4.0, everything works as expected and I get reasonable values (I haven't calibrated anything yet). To me, this indicates the I2C communication implementation is correct and shouldn't need to change (how to actually read and write registers doesn't change, regardless of the driver version).

    Updating the code to use the latest version of the driver (v3.4.3), communication with the sensor seems to go well but the output is nonsense and constant:


    Temperature, Pressure, Humidity
    20.52, 69352.51, 85.38
    20.52, 69352.51, 85.38
    20.52, 69352.51, 85.38
    20.52, 69352.51, 85.38
    20.52, 69352.51, 85.38
    20.52, 69352.51, 85.38


    An example real value might be 22 degrees, 982hPa, 39% relative humidity. I have tried adapting the code from yanbe's implementation (i.e. applying the same configuration with the new driver) and I also have tried the example code from the driver's readme, both yield exactly the same results - successful looking interaction with the sensor (initialization/configuration), but nonsense/unchanging sensor reads. This stands for both normal mode and forced mode

    To sum up:

    BME280 over I2C + driver v2.0.5 + ESP-IDF = success in normal and forced mode
    BME280 over I2C + driver v3.4.3 + ESP-IDF = failure in normal and forced mode

    Anyone have any experience/guesses/things that maybe I'm missing? I figured I'd ask before diving into anything too far.

    3 REPLIES 3

    New Poster

    A Reddit user solved this - epvuc/esp-fume-detector shows a working I2C configuration. The I2C clock speed used in the v2 driver implementation was 1 Mbit/s, for some reason that doesn't work with the v3 driver implementation. Slowing the clock speed down works. I didn't figure out an exact maximum, but <= 43 kbit/s works for me. Over that and the sensor reads start misbehaving - e.g. only humidity comes back. Upping to  Mbit/s and the sensor reads are all seemingly fixed at an arbitrary value.


    you should look into using Uncle Rus' lib

    iznaiz. eggzzamplez ingluded. chiirz. from rassia with love



    I believe I need this to solve mine as well. Its readings are completely off for eg.

    Temperature = -144.28 *C

    Pressure = nanhpa

    Approx Altitude = nanm

    Humidity = nanm


    How exactly do we implement the code from the link you posted? Download it and add it as a library?