Bosch Sensortec Community

    SOLVED

    BME680 : Using BSEC in backend

    Highlighted
    New Poster

    BME680 : Using BSEC in backend

    Hello,

    Is there any way we can run BSEC library outside of the microcontroller ?

     

    Details :

    I want to use BSEC library to get VOC readings from BME680.

    But maximum flash memory size is 192KB (STM32L073RZ), and when using BSEC the binaries are 271KB.

    Can I let's say make simple gas measurements on MCU, then convert the data in the cloud using BSEC ?

    Tags (2)
    2 REPLIES 2
    Highlighted
    Community Moderator

    Re: BME680 : Using BSEC in backend

    Yes, this is possible, with a few limitations. For instance, the sensor should run with a fixed configuration, according to the desired operating mode (ULP or LP). Therefore the ULP+ feature isn't supported anymore.

    An Arduino library is included in BSEC's package to show how the sensor should be configured, with the following snippet extracted from bme680_data.h:

    /* Macro definitions */
    #define BSEC_HUMIDITY_OVERSAMPLING       UINT8_C(1)            /*!< Humidity oversampling rate */
    #define BSEC_TEMPERATURE_OVERSAMPLING    UINT8_C(2)            /*!< Temperature oversampling rate */
    #define BSEC_PRESSURE_OVERSAMPLING       UINT8_C(5)            /*!< Pressure oversampling rate */
    #define BSEC_HEATER_TEMP_LP              UINT16_C(320)         /*!< Low Power mode heater temperature */
    #define BSEC_HEATING_DURATION_LP         UINT16_C(197)         /*!< Low Power mode heating duration */
    #define BSEC_HEATER_TEMP_ULP             UINT16_C(400)         /*!< Ultra Low Power mode heater temperature */
    #define BSEC_HEATING_DURATION_ULP        UINT16_C(1943)        /*!< Ultra Low Power mode heating duration */
    

    Attached is an example project that is based on the original bsec_integration.c sample code,  but was edited to use a csv file containing raw sensor data as input, and generating another csv file with BSEC's outputs. It includes:

    • bme680_remote_BSEC_run.c, bsec_integration_backend.c and bsec_integration_backend.h, the sample code,
    • datalog.csv, an example of raw sensor log from a BME680 (including the necessary timestamp, raw temperature/pressure/humidity/gas resistance) in a .csv file in a format expected by the sample code above,
    • bsec_output.csv, an example of output generated by the sample code above when datalog.csv was used as input file.

    To run the example above, you will need to add the library headers (bsec_interface.h and bsec_datatypes.h) from your BSEC package, as well as the pre-compiled library for your platform (BSEC v1.4.7.3 was used in this project, therefore it is recommended to use at least this version).

    To generate bsec_output.csv, BSECLibrary64.dll was used, and compiled in a COINES environment in Windows 10's CMD:

    C:\Users\username\Documents\BME680_remote_BSEC_run>bme680_remote_BSEC_run.exe -i datalog.csv -o bsec_output.csv
    input file: datalog.csv
    output file: bsec_output.csv
    BSEC initilization complete, now running BSEC...
    BSEC processing complete!
    

     

    Highlighted
    New Poster

    Re: BME680 : Using BSEC in backend

    Thank you very much for your helpful answer.

    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