Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME280 Programming Request

    BME280 Programming Request

    MajorGoober
    New Poster

    Hello! I am writing to request assistance with the BME280. I designed a circuit using a BME280 device and a PIC18F26K22 microcontroller. The PIC microcontroller acts as the "middle man" between the BME280 device and a LabVIEW program I wrote on a Windows based PC. The LabVIEW program communicates with the PIC microcontroller over an RS-232 bus. The PIC in turn communicates with the BME280 over an i2c bus.

    Using my LabVIEW program, I am able to read any register in the BME280 that I wish. However I don't know how to use the Calibration data (residing in registers 0x88 to 0xA1 and 0xE1 to 0xF0) to convert the raw data from the pressure, temperature, and humidity registers into engineering units.

    I have seen some C++ examples which apparently perform this calculation, but I am not fluent in C++. Is there an easy-to-use formula which will allow me to perform the pressure, temperature, and humidity calculations from inside of my LabVIEW program? The formula I am looking for is similiar to the formula I am using for the MAX44009 amibient light sensor. That formula is: LUX = (2^exponent) x (mantissa) x 0.72

    To explain a little further, the MAX44009 amibient light sensor utilizes two registers for recording the light intensity. They are the "LUX.MSB" & "LUX.LSB" registers. The formula provided by the manufacturer to calculate the LUX value, as stated earlier, is: LUX = (2^exponent) x (mantissa) x 0.72

    The manfacturer also specifies that the exponent & mantissa values are represented by different bits in the two registers, as shown below.
    -----------------------------------------------------------------------------------
    Bit D7 D6 D5 D4 D3 D2 D1 D0
    -----------------------------------------------------------------------------------
    LUX.MSB Register E3 E2 E1 E0 M7 M6 M5 M4
    LUX.LSB Register - - - - M3 M2 M1 M0
    -----------------------------------------------------------------------------------
    Definitions

    E: exponent (4 bits)
    M: mantissa (8 bits)
    -----------------------------------------------------------------------------------

    During communications with the MAX44009, I use my LabVIEW program to read the LUX.MSB & LUX.LSB registers in the MAX44009 device. I then use the formula provided by the manufacturer to examine the bits in each register and perform the LUX value calculation from inside of my LabVIEW program. I am hoping that a similiar formula exists for performing BME280 calculations.

    In conclusion, any assistance you can provide would be greatly appreciated. If you require additional information from me before generating an answer, please contact me. Thank you very much!

    Steven Gemberling
    Livermore, CA 94551
    sgemberling1@att.net
    (925) 800-9922 (cell)


    NOTE: While downloading some BME280 documents from your website, I noticed a Bosch Sensortec software package titled "DD2.1 UI". I assume this software package performs the calculations I am inquiring about. If that information is not sensitive, would it be possible to send it to me?  Thank you!

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hi MajorGoober,

    The BME280 sensor API on Github(https://github.com/boschsensortec/BME280_driver) already includes compensation code for sensor data, and you can use the API directly.
    I uploaded example code on STM32 for your reference, hope it will be helpful for you.

    Hello BSTRobin!

    Thank you for the information you provided to me about my BME280 programming request.  I have downloaded the .ZIP file and taken a look at the enclosed documents.  I will need to spend some time understanding the code before I proceed.  In the meantime, if I have further need of help on this forum, I will send another reply.  Again, thank you!

    MajorGoober

    BSTRobin
    Community Moderator
    Community Moderator

    Welcome, MajorGoober.

    Has it started working yet?

    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