Bosch Sensortec Community

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

    BME680 Api Observations

    BME680 Api Observations

    geoff
    New Poster

    I have recently purchased a BME680 for evaluation and noticed that there are some errors in the description of pressure measurement (section 3.3.2) on the datasheet. In the floating point part there are undefined variables var1_p, var2_p and var3_p which comparing with the actual api code should be simply var1, var2 and var3. There are also some worrying mathematical errors:- (1) In initialising var1, the constant 64000.0 is used in the floating calc and the same effective value 64000 used in the integer calc. This cannot be correct because the integer calc is scaled by a factor of 100. Surely, one of these constants is incorrectly scaled? (2) Again comparing the update to var1 (line 5 in each case), the floating point and the integer versions are not mathematically equivalent. (3) Both the above issues are replicated in the driver library.

    It looks like the compensation formulae in the data sheet have been reverse engineered from the code. It would be helpful and much clearer if the formula were expressed mathematically for all the compensation calculations and leave the programmer to implement them appropriately. For example the temperature compensation appears to be a simple hyperbolic function: t_comp = (x - a)(b + (x-a)c)/d . Some of the manipulations documented are obscure and I suspect have been programmed to avoid register overflow. This makes it tricky to implement the formula in other languages such as java.

    4 REPLIES 4

    handytech
    Community Moderator
    Community Moderator

    Thank-you for your comments and suggestions. The undefined variables have been reported internally. Unfortunately we can only share the compensation formulas as part of the Sensor API/datasheet as done today. If supported by your platform, we recommend using the floating point integration when possible, while the integer implementation offers an alternative on more restricted devices. In case you are any issue facing with your outputs using either implementation in the Sensor API please let us know.

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    We will investigate the conversion code in BME680 datasheet for the pressure sensor part to see if there is any mathematical mismatch regarding floating and integer calculations. We will then get back to you.

    Regrading the calibration parameters for temperature sensor, pressure sensor and humidity, each BME680 has been factory calibrated and trimmed before shipping to the market. In order to get final compensated temperature, pressure and humidity results, we provide sample code in both datasheet and driver at https://github.com/BoschSensortec/BME680_driver. If users use different programming languages, then they can verify if the final compensated values match the environmental truth or not. The formula doesn't help too much to understand how the conversions work because they have been designed in the ASIC part of BME680. 

    Thanks.

    Thank you for your helpful reply. I would like to withdraw item (1) in my observations - I am now satisfied the Integer and FP formula are consistent in this respect. 

    In relation to the original question, I have found inconsistency among API and Datasheet for the calculation of gas sensor heater resistance.

    Page 21 of Datasheet shows floating point and integer calculations but they are not equivalent. var1 in integer calculation is (amb_temp*par_g3/10)<<8, but the floating point method calculates this part as (amb_temp*par_g3*10)<<8 (var1 in the floating point method is different from that in the integer method, so I have deduced this result by rearranging the entire floating point formulae).

    Moreover, the integer calculation in API is var1=(amb_temp*par_g3)/1000)*256 (small modifications made for clarity) in line 1006 of bme680.c. The floating point calculation in API looks the same as that in Datasheet.

    So, there are three variations in calculating var1 or its equivalent, each 100 times different from another. Could you tell me which is correct, and hopefully fix the incorrect formulae? Thank you.

     

    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