Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

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

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

    produce_notice
    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

    produce_notice
    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.

    hi,

    you should look into using Uncle Rus' lib
    https://github.com/UncleRus/esp-idf-lib

    iznaiz. eggzzamplez ingluded. chiirz. from rassia with love

    Hello,

     

    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?

     

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist