Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMP388 Compensation Calculations?

    BMP388 Compensation Calculations?

    kda199
    Occasional Visitor

    We are using the BMP388 and have a board with it (and 5 other sensors) on it.  I can read and write to the device, and can successfully read the product ID (00) -- I have found the 1.1.0 API code release in Gethub, and have  integrated it with our exising code.  But I have several questions.

       1) No where in the code or datasheet does it say what units the compensated pressure data is returned in. The data sheet gives the sensor's range and accuracy in hPa, so I assumed that is what the API would return from the compensate_pressure() function -- is that correct?  In the BMP-series-pressure-sensor-design-guide there is example code with a printf() statement that prints "P:  %.2f" supplying "bmp3_comp_data.pressure / 100" - so that indicates it is in Pa, not hPa?  Can you confirm?  That example code is not included in the API package so the only way to find this is to hunt around on the web and your site and finally find that one line buried in the example?

    2)  There is no example (sample inputs with expected outputs) for any of the calculations -- and the values read out of the device are unusable without running it through the compensation formulas, and there is no way to validate if the output is correct, making debugging virtually impossible.  Can you supply example input/expected results for the Temp and Humidity register reads, with example triming register values and the outputs of the compensated values.  (and including intermediate results would be exceedingly valuable).

    3) If you get through 1) and 2) and the results don't match your reference platform (if you have one) or your local weather report within some small range, there is no way to validate your results or know if there is a subtle bug in the code or if there is just an offset in the BMP3xx measurement results. 

    Thanks, Ken

     

    4 REPLIES 4

    o_o
    Contributor

    Hi Ken, thank you for your interest in Bosch Sensortec pressure sensors. We are here to help.

     

    1) In the design guide, it is mentionned that the sample code is to be found in the COINES installation folder, C:/COINES under Windows by default. It also includes a link on where to download this software, so you don't have to "hunt around on the web" to find it. I will ask the Sensor API team to add the units to the documentation for that function.

    2) We have a small spreadsheet that we use internally. See attached. In general if you are using the provided API, calculation errors should not be a concern.

    3) I think answers 1 and 2 should answer your concerns. To truly validate the output, as with any sensor, the only way is to compare the value with a reference unit with equal or higher precision.

    Hello,

    I have the same kinfd of issues. I use a BMP388 and a BME280. The BME280 returns correct values (compared to what the closest meteo station reports). On the other hand the BMP388 reports a false pressure. I should read something around 1015 mb, but I read 1050 mb. I expect I did a mistake with the compensation algorithm and wanted to check. Unfortunately the link to the XLS file reports HTTP error 404 !!!! 

    When I read the constants from the device it returns the follwing values :

    T1 : 27603

    T2 : 18754

    T3 : 246

    P1 : -476

    P2 : -2805

    P3 : 35

    P4 : 0

    P5 : 26148

    P6 : 31324

    P7 : 243

    P8 : 246

    P9 : 16258

    P10 : 10

    P11 : 196

    I tried with the double and integer compensation routines I get the same results. As an example if I ge the following raw values :

    Temperature : 7095664

    Pressure : 10479274

    I finally ahve the following compensated values :

    Temperature :18.90

    Pressure : 1047.92

    The tempeature is fine but the pressure is roughly 42 hpa to high.

    Any ideas ?

    Thanks for your support.

    Alain

    Hi Alain,

    This is far outside the expected accuracy of the sensor. Going from Software to Hardware, make sure that:

    1. Compensation formula is properly applied (see spreadsheet attached, don't understand why the error 404 on the previous post)
    2. Conversion from register value to integer value is good (see updated spreadsheet attached, with register value)
    3. Register value matches the bus activity (confirm with logic analyzer or oscilloscope that the values in your MCU memory match the decoded protocol from the bus)

    If all above looks okay, then the sensor is actually sending bad data, which indicates hardware failure. Confirm the soldering process follows the Handling, Soldering and Mounting instructions.

    Regards,

    o_o

     

    Do you have a similar spreadsheet for the BMP390?

    Your Temp parameters worked great - I was able to get that working fine.

    But, have the pressure parameters changed from BMP380 to BMP390?

    Thanks for supplying the sample calculation!

    Regards,

    Todd Anderson (A new user of the BMP390)

    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