Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME280 Environmental Temperature Compensation

    innovaAlex
    Member

    BME280 Environmental Temperature Compensation

    I am working with BME280 temp, pressure, and humidity sensor. I verified temperature readings and they seems to be within .5 deg C as adverticed. I have a custom board where BME280 mounted and it heats up to ~3 deg C above ambient. Since heating up is gradual I do see pressure measurements change with temperature. It is almost linear change, but not quite. I can come up with compensation formula but though I will check with a community first if this is something that needs to be done. I use refernce driver from Bosch which does read calibraion parameters. My undestanding that calibration parameters are set at the factory only once those do not account for environmental conditions. Is this true? Did anyone observe the same issue with pressure drift due to temperature? Do you have compensation equation? How does that effect humidity measurments? I haven't verified those yet. 

    4 REPLIES 4
    innovaAlex
    Member

    Re: BME280 Environmental Temperature Compensation

    something to note, the magic temperature that gives me accurate pressure reading is 26.65 deg C which seems to be a little too hot for a factory floor temp at which sensor presumably was calibrated 

    BSTRobin
    Community Moderator

    Re: BME280 Environmental Temperature Compensation

    Hello innovaAlex,

    Could we know your detailed test environment, test data, test result?

    innovaAlex
    Member

    Re: BME280 Environmental Temperature Compensation

    After taking a closer look at my code I found an issue and no longer see such a drammatic impact of temperature on pressure readings. However, temperature does affect pressure readings (see plots below) just not by a lot to worry about. I am testing in a home environment so temperature fluctuations are based on temperature in the room. Pressure is basically a sea level pressure. ~1012 mbar. What I find interesting now is that pressure has a huge offset ~340 mbars! I read some other posts on this forum and see that others found similar issues but no one has such a huge offset. Users typically reported ~50mbar offset. My humididy readings look offset too by 9-10%. What do you think can cause such an offset? Do you think sensor on my board was demaged during manufacturing? Is it tipical to calibrate these sensors? one time calibration or do they need to be recalibrated?  Please note temperature readings are correct, measuring board temperature which is ~3 deg C above ambient and has an error of +/-0.5 deg C (I verified it with thermocouple attached to sensor enclosure).

    innovaAlex_0-1627914461320.png

    innovaAlex_1-1627914511813.png

     

     

    BSTRobin
    Community Moderator

    Re: BME280 Environmental Temperature Compensation

    Hello innovaAlex,

    Do you fully refer to the BME280 driver code in github? https://github.com/BoschSensortec/BME280_driver
    Driver code included data compensation.

    /*!
    * @brief This API reads the pressure, temperature and humidity data from the
    * sensor, compensates the data and store it in the bme280_data structure
    * instance passed by the user.
    */
    int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev)
    {
    int8_t rslt;

    /* Array to store the pressure, temperature and humidity data read from
    * the sensor
    */
    uint8_t reg_data[BME280_P_T_H_DATA_LEN] = { 0 };
    struct bme280_uncomp_data uncomp_data = { 0 };

    /* Check for null pointer in the device structure*/
    rslt = null_ptr_check(dev);

    if ((rslt == BME280_OK) && (comp_data != NULL))
    {
    /* Read the pressure and temperature data from the sensor */
    rslt = bme280_get_regs(BME280_DATA_ADDR, reg_data, BME280_P_T_H_DATA_LEN, dev);

    if (rslt == BME280_OK)
    {
    /* Parse the read data from the sensor */
    bme280_parse_sensor_data(reg_data, &uncomp_data);

    /* Compensate the pressure and/or temperature and/or
    * humidity data from the sensor
    */
    rslt = bme280_compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data);
    }
    }
    else
    {
    rslt = BME280_E_NULL_PTR;
    }

    return rslt;
    }

    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