Bosch Sensortec Community

    Showing results for 
    Search instead for 
    Did you mean: 

    Configuring BSEC for BME688 in backend configuration

    Configuring BSEC for BME688 in backend configuration



    I've started using the BME688 sensor on a custom hardware platform. The sensor is connected to a small, memory limited MCU, collecting BME688 data at a configurable rate ranging from 1 to 100 seconds in forced mode. Data collection is controlled by a timer in the small MCU which is set at a fixed rate, but can be modified for different applications. Due to the memory limitation, only the BME6xx API is running on the MCU. The BSEC library, used to calculate more advanced metrics such as IAQ and eCO2, is performed on a larger MCU. Essentially, the smaller MCU connected to the BME688 collects and processes the temperature, humidity, pressure and gas measurements. Then, the measurements are transferred to the larger MCU to perform the additional BSEC calculations. My solution is loosely based on the information found on your forum here. At the moment, I'm using BSEC and not BSEC2, but I will most likely change in the future, but for simplicity, I'm sticking with BSEC.

    Now that I have a prototype, I have several questions which I hope someone can answer to ensure that I'm using the BME688 and software correctly.

    Question 1:

    I'm still unclear what is happening when loading the binary blob into the BSEC driver using the "bsec_set_configuration" function. Because my BME688 is powered on 3.3V and my sample rate can vary between 1 and 100 seconds, I decided to use the `generic_33v_300s_4d` configuration for my application. Is this correct, particularly regarding the sample rate?

    I'm still unclear what the 4 day / 28 day configuration actually does. I don't understand the documentation when is states the following: "4days/28days, means BSEC will consider the last 4days/28days of operation for the automatic background calibration." WHat is actually happening in the background and what are the pros/cons in both configurations?

    Question 2:

    Out of curiosity, I've downloaded BSEC2 and I see that it also includes a binary blob similar to "generic_33v_300s_4d" under the "bme688_sel_33v_300s_4d" folder. Further inspection shows that these files are not the same. Will this be a problem if I'm using the BME688 and not the BME680 with BSEC?

    Question 3:

    Nowing that I'm using a backend configuration, how can I configure BSEC to use the same settings applied to my BME688 configured by my small MCU such as heater_temperature, heating_duration, humidity_oversampling, etc.? Is this part of the binary blob data, as discussed in question 1, or is it something else? I can easily extract the BSEC settings using "bsec_sensor_control" but I don't see any way to set these configurations.

    Question 4:

    Every time the large MCU, running BSEC, receives BME688 measurements from the smaller MCU, it provides a time stamp (in nanoseconds) to BSEC. Because this sample rate can vary from 1 to 100 seconds, should I configure the virtual sensor time in BSEC for “BSEC_SAMPLE_RATE_ULP”?


    Thank you in advance for any help you can provide!

    5 REPLIES 5

    Community Moderator
    Community Moderator

    Hi MrRoboto,

    1,2: If you use generic_33v_300s_4d configuration, it will read sensor data every 300s and run BSEC algorithm;
    After you download BSEC package, you will find a integration guide, bsec_sel_iaq* configuration support to output gas recognition, generic* configuration don't support to output gas recognition.
    For 4 days/ 28 day configuration, you could get information from integration guide.

    BSEC 2.4.0-4day 28day.png

    3,4: In latest BSEC version folder "BSEC2.4.0.0_Generic_Release_23012023\examples\BSEC_Integration_Examples\examples\bsec_iot_example", it demostrated a example code on MCU.
    If you would like to use it on two MCU artecture, you could migrate it to your platform.

    Hello @BSTRobin. Thank you for the quick reply!

    I also saw that section in the document describing the 4/28 day operation, but I don't understand what it means when it says "BSEC will consider the last 4 (or 28) days of operation for the automatic backgorund calibration". What does this exactly mean? How does this consideration impact automatic background calibration?

    As for the BSEC configuration settings, the document says that the settings can be configured to set the maximum allowed time between two bsec_sensor_control calls:

    BSEC - section 1.2.2.png

    Inlight of the above document snippet and assuming I'm using a 300s configuration file, does this mean that I can use any sample rate smaller or equal to 300 seconds, seeing how the document says "maximum allowed time" (assuming that the sample rate is always consistant)? For example, If my rate is 10 seconds, and my setting is for 300s, will this still work?

    Community Moderator
    Community Moderator

    Hi MrRoboto,

    The BSEC will calibrate based on 4 days or 32 days of data.
    The example code is usually run based on the sampling rate, if your rate is 10 seconds, and your setting is for 300s, you may not get the updated output from BSEC.

    Hello @BSTRobin ,

    In your previous message you say "you may not get the updated output from BSEC". Are you implying that I may/may not get the output result or I simply won't get the correct output? Would the return value from "bsec_do_steps" confirm if the output is good or not? I'm currently running my code in this configuration and results seem reasonable without any return error coming from "bsec_do_steps".

    If I want to generate a configuration file for 10 sec. sampling and not 3s or 300s, how do I create this file? Currently, I'm using the generic files which are part of the BSEC library I downloaded:

    • generic_33v_3s_4d
    • generic_33v_300s_4d

    How are these files generated?