Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME280 Humidity Compensation Example

    BME280 Humidity Compensation Example

    JESE
    New Poster

    Hi Guys

    So, I've had a sensor in production for the last 3 years, to report Temperature & RH, using the BME280.
    Recently, I've noted that at higher Humidity conditions and Lower Temperatures, the compensated RH result jumps from say 70% at 12°C to 100%.

    Revisiting the latest data sheet (R1.9), Section 8.1 documents example C code to resolve RH.
    Trying to turn the following in to intelligable format to impliment for integer process, I've hit several ambiguities...

    double bme280_compensate_H_double(BME280_S32_t adc_H); {    ... Unexpected semi-colon

    then this superlative line of code:
    var_H = (adc_H – (((double)dig_H4) * 64.0 + ((double)dig_H5) / 16384.0 * var_H)) * (((double)dig_H2) / 65536.0 * (1.0 + ((double)dig_H6) / 67108864.0 * var_H * (1.0 + ((double)dig_H3) / 67108864.0 * var_H)));

    Any one any suggestion as to the order of preference that should be applied withing parenthasis? I was taught BODMAS, Brackets of, Division, Multiplication, then Addition and Substarction. IMO, the above line of code could do with a make over. I'd then be happy to share an integer math equivalent for
    any one else implimenting on an 8 or 16 bit micro...

     

    1 REPLY 1

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    Please see the attached "sample_calculation_BME280.xlsx" for more information. Of cause, you can use integers operation in 8 bit or 16 bit MCUs.

    Thanks.

    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