Bosch Sensortec Community

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

    BME680 ESP8266 Deepsleep

    BME680 ESP8266 Deepsleep

    amrtgv
    New Poster

    Hello,

    I'm building a new weather station based on BME680(ULP mode) and ESP8266 :Deepsleep(5min). Everything works fine with BSEC library except AIQ. It seems that after each deepsleep/wakeup, BME loses it states? Any idea how to implement this?

    My code is based on " basic_config_state.ino".

     

    Thank you.

     

    11 REPLIES 11

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    1. IAQ remains as 25 and IAQ accuracy status remains as 0 during run-in time. And run-in time is 20 mins in ULP mode. After restart of the device, there is always run-in time required.
    2. bsec_set_state should be only applied when setup the sensor. After set_state, it makes a restart on BSEC side which means a new run-in time comes.
    3. When IAQ accuracy status is 1, it means that the run-in time is over, sometimes IAQ would still be 25. It is not a bug. Since in ULP mode, BME would have lower sensitivity and response time, only big changes of the environmental air would cause the changes of IAQ. You may use a sharpie pen or other more polluted air to trigger BME680 so that the IAQ accuracy can achieve 3.

    Thanks.

    Hello FAC_CA,

    Thank you for your reply, it make sense not to fully setup the sensor after each reboot. I did some changes to the code, I removed RTC memory and instead I'm using EEPROM method.

    I did below, but still no luck:

     

    void setup() {
    Serial.begin(9600);
    ESP.getResetReason();

    Wire.pins(0, 2);
    Wire.begin(0, 2);

    iaqSensor.begin(BME680_I2C_ADDR_SECONDARY, Wire);
    checkIaqSensorStatus();
    if ( resetInfo.reason == REASON_DEEP_SLEEP_AWAKE ) {
    Serial.println("DeepSleep");
    }
    else {
    Serial.println("Reset");
    EEPROM.begin(BSEC_MAX_STATE_BLOB_SIZE + 1); // 1st address for the length
    iaqSensor.setConfig(bsec_config_iaq);
    loadState();

    checkIaqSensorStatus();
    }
    bsec_virtual_sensor_t sensorList[7] = {
    BSEC_OUTPUT_RAW_TEMPERATURE,
    BSEC_OUTPUT_RAW_PRESSURE,
    BSEC_OUTPUT_RAW_HUMIDITY,
    BSEC_OUTPUT_RAW_GAS,
    BSEC_OUTPUT_IAQ,
    BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
    BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,

    };

    iaqSensor.updateSubscription(sensorList, 7, BSEC_SAMPLE_RATE_ULP);
    checkIaqSensorStatus();
    esp_timer_get_time = millis();
    wifi_setup();
    client.setServer(mqttServer, 1883);
    esp_timer_get_time1 = millis();
    }

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    We already reviewed your code which is just part of your project. It is difficult for us to clearly understand the complete process.

    Please provide the complete integration code including the setup and loop part.

    Thanks.

    Finally, it's working as expected,

    ESP8266 + BME 680  with 5 min deepsleep.

     

    image.png

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for the update. Please click "Accept as solution" button to close this topic.

    Thanks.

    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