Bosch Sensortec Community

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

    BME680 state_save / state_load problem

    BME680 state_save / state_load problem

    micha_pr
    Established Member

    using Arduino 1.88 / 1.85 with ESP8266 (lib 2.50 / 2.42) and two BME680 sensors.

    Final goal is to use these sensors in portable devices, but at first in normal mode without sleeping process.

    If using the config_state sample I can see that the state_save and state_load will not work correct.

    what is going on:
    1) BME starts - after some time will get right values as expected with accuracy=1
    2) some time later have still valid values with accuracy=2, sometimes is falling back to accuracy=1
    3) auto save procedure (with accuracy=2 (?) or even 1 (!) ) will be done
        (have canged this in code that I allow autosave only if accuracy >=2 - maybe "3" is correct? )
    4) After autosave to EEPROM with accuracy=3  reboot the ESP (power loss...)

    -> Load values from EEPROM

    5) BME start and show at first minutes no valid values and accuracy=0  (maybe correct ?)
    6) After some minutes accuracy=2 but IAQ is still 0 - for a very long time (hours).
        Resistance is in normal range (as before restarting) - so no changes.

    The only way is erase the EEPROM and start at new - then all is fine again (until next restart).

    I already made some control procedures - but not sure how to get a valid config_load after restarting.

    BTW: I have compared the saved and loaded values before - identical.

    Any idea?

    Thanks!

    Michael

    36 REPLIES 36

    I experienced the same. IAQ accuracy resets to `0` and it takes several minutes till the sensor is in a "calibrated mode" (=3). And after each reboot and loading the calibration, the IAQ value is more or less likely to be very close to the value it had while soring the last calibration. So e.g. storing a calibration, powering down and moving the sensor to a complete new location with different IAQ, the resulting IAQ value is more or less close to the one before. This make limited sense.
    This is not what we expected when reading about "GAS sensor response time < 1 s"  and the possibility of storing and restoring calibration data.

    How can we realize the following:

    1. Calibrate a reference sensor in a reference sensor platform (base on an ESP 8266 or ESP-12f) and extract its calibration data.
    2. Write this calibration data to multiple sensor plattforms.
    3. Make all sensor plattforms work without further calibration (as we have a stored reference calibration). Each sensor / sensor plattform should be able to take a sensor reading base on the calibration in seconds after powering up or after returning from a deep sleep.

    This is kind of key for a mass production. Sure, I can calibrate a sensor for 30 minutes in a clean and a polluted environmnent and then work with it for some evaluation. But how should this be done with 1000 sensors or with 1000 sensors after reboot e.g. after a batterie changes or after a deep sleep recovery if you plan long lasting solutions for IoT device.

    Spoiler
    Addendum: If what was described above is not possible, a reduced use case would be: Holdong power on the BME680, but sending only the ESP 8266 (or whatsever computer is used) to sleep. At least this setup should somehow be able to hold / recover fast (= in seconds). Is this possible somehow?

    I think every sensor need an own calibration. It is the same for all AQI sensors - only the way is different.

    After some time they will be calibrated, what is fine. That after a power-up will be needed some time is right - as sample the sensor heating must work stable (give a stable chip temperature for measure) and this all will take some minutes.

    The reaction time is fine - you can test it in indoor usage if you make bad air (with alcohol, smoke etc).

    I made some tests with different sensors and the BME680 seems to be the best for indoor usage.
    For outdoor I have some understanding problems to interpret the values correctly, they are much too high in the evening.

    I will publish later my Arduino sketch (if testing is finished) with optimized state save/load procedure.

    Michael

     

     




    @bastianhjaeger  wrote:

    How can we realize the following:

    1. Calibrate a reference sensor in a reference sensor platform (base on an ESP 8266 or ESP-12f) and extract its calibration data.
    2. Write this calibration data to multiple sensor plattforms.
    3. Make all sensor plattforms work without further calibration (as we have a stored reference calibration).

    It is not possible to calibrate multiple sensors against a single reference due to the working principle of this gas sensing technology. Therefore we decided to offer background calibration as part of the BSEC library.


    @bastianhjaeger wrote:

    So e.g. storing a calibration, powering down and moving the sensor to a complete new location with different IAQ, the resulting IAQ value is more or less close to the one before.


    I don't believe I fully understood your statement here, or why would the IAQ value be more or less the same after all these changes to the sensor and its environment?


    @bastianhjaeger wrote:
    Spoiler
    Addendum: If what was described above is not possible, a reduced use case would be: Holdong power on the BME680, but sending only the ESP 8266 (or whatsever computer is used) to sleep. At least this setup should somehow be able to hold / recover fast (= in seconds). Is this possible somehow?

    To get the best performance, it is recommended to run the gas sensor measurements in the same operating mode. Having your MCU go to "sleep" mode in-between measurement should be possible, if the state file could be stored/restored in time between measurements, and if your system could successfully both maintain a precise sampling period and keep track of the real timestamps. Alternatively, it would also be possible to run your "edge" device in a "sensor only" mode, while running BSEC remotely (e.g. on a server, in the cloud, ...).

    @handytech

    Thanks for the reply. But not sure if we can work with the sensors then. I am still trying my best understanding the Integration Guide regarding "Config" versus "State".

    Could you elaborate a little bit more, how it would be possible to reconnect to a BME680 (which constantly has Vcc) over I2C from an ESP-8266 or Arduino (which wakes after a deepsleep or some reset)? Not sure what more I would need for the library to accept the device as a calibrated  one.

     

    Maybe it would be helpful is you shared what your use-case is. From your previous post it seems like you are trying to do something the sensor is not made for. More specifically this part:


    @bastianhjaeger wrote:

    So e.g. storing a calibration, powering down and moving the sensor to a complete new location with different IAQ, the resulting IAQ value is more or less close to the one before. This make limited sense.
    This is not what we expected when reading about "GAS sensor response time < 1 s"  and the possibility of storing and restoring calibration data.


    What you to understand is that the BME680 (as all MOx-based gas sensors) is a relative, not absolute sensor. The response time is to a change in input while the device is powered-on. One thing that you cannot do, is power-off the device, move it to a new location, turn it on and immediately expect an output. Because the chemical reactions on the sensors change with temperature, when the device is powered-on, it needs some time to reach equilibrium. This is also why by default the BSEC library will simply report an accuracy of 0 at boot for the first 5 minutes.

     

    If you do need this instantaneous value, I recommend keeping the device always on. 


    @bastianhjaeger wrote:

    Could you elaborate a little bit more, how it would be possible to reconnect to a BME680 (which constantly has Vcc) over I2C from an ESP-8266 or Arduino (which wakes after a deepsleep or some reset)? Not sure what more I would need for the library to accept the device as a calibrated  one.


    This is also unfortunately not possible. The BME680 lacks an automatic system to turn on the hot plate at selected intervals, which means at the very least, you MCU must trigger a measurement periodically (every 5min in ULP mode) for the sensor to stay alive. This data can be batched and processed at a later point, but the BSEC software also requires to process each data point.

    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