Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME680 warning code : 2 and BME680 error code : -2 on NodeMcu esp8266.

    BME680 warning code : 2 and BME680 error code : -2 on NodeMcu esp8266.

    user001
    Member

    Hi!

    I am running the "basic_config_state.ino"  from github.com/BSEC-Arduino-library on a NodeMcu esp8266.

    The measurement starts then I get a bunch of BME680 warning code: 2 in a row (1200+ lines) and then the measurement resume. This continues for a while until I get BME680 error code : -2

    This is my code: https://pastebin.com/mKyxjQtW 

    I have the latest Arduino 1.8.10, the latest esp8566 library (2.6.1), BSEC library version 1.4.7.4 (downloaded yesterday from github)

    The modification explained in github/readme are applied to eagle.app.v6.common.ld and platform.txt 

    Thanks a lot for your help!

     

    Explanation of the error code and solution found in the forum

    ○ BME680 error code : -2 = "BME680_E_COM_FAIL" was solved here by replacing Wire.begin() by Wire.begin(I2C_PIN_SDA, I2C_PIN_SCL) but in that case, the code never run. In my case, the code run for a while  and then I get this bug  si this isn't a fix 

    ○ BME680 warning code : 2 = BME680_W_NO_NEW_DATA

    My log

     

    Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%]
    7455, 16.96, 98149.37, 67.71, 11152.22, 25.00, 0, 16.85, 67.85
    .... measurements continue without bug
    124456, 18.81, 98151.98, 64.74, 19586.68, 25.00, 0, 18.71, 62.69
    1268 lines of : BME680 warning code : 2
    130457, 17.67, 98147.52, 64.48, 18958.91, 25.00, 0, 17.61, 66.40
    .... measurements continue without bug
    298457, 18.98, 98157.34, 64.36, 20297.18, 25.00, 0, 18.88, 62.17
    2500+ lines  of BME680 warning code : 2
    307458, 17.82, 98152.27, 64.05, 19081.22, 25.00, 0, 17.79, 65.79
    .... measurements continue without bug
    385457, 18.84, 98157.93, 64.24, 20217.90, 25.00, 0, 18.73, 62.45
    1280+ lines of BME680 warning code : 2
    391458, 17.82, 98154.58, 64.00, 19512.84, 25.00, 0, 17.76, 65.70
    .... measurements continue without bug
    475457, 19.16, 98150.90, 64.08, 20975.81, 25.00, 0, 19.05, 61.78
    1260+ lines of BME680 warning code : 2
    481460, 17.82, 98156.16, 63.77, 19476.13, 25.00, 0, 17.77, 66.06
    .... measurements continue without bug
    520460, 17.85, 98156.33, 63.82, 18634.68, 25.00, 0, 17.74, 65.90
    1300+ lines of BME680 warning code : 2
    526462, 17.86, 98155.77, 63.83, 19348.71, 25.00, 0, 17.81, 65.29
    .... measurements continue without bug
    736462, 18.79, 98162.40, 64.18, 20703.13, 25.00, 0, 18.68, 62.33
    1300+ lines of BME680 warning code : 2
    742462, 17.74, 98157.47, 63.96, 19736.06, 25.00, 0, 17.69, 65.70
    .... measurements continue without bug
    823461, 18.85, 98165.16, 64.05, 20933.39, 25.00, 0, 18.74, 62.14
    BME680 error code : -2

     

     

    I also tried with the basic.ino and I get a similar log (but the bug comes sooner):

     

    Timestamp [ms], raw temperature [°C], pressure [hPa], raw relative humidity [%], gas [Ohm], IAQ, IAQ accuracy, temperature [°C], relative humidity [%], Static IAQ, CO2 equivalent, breath VOC equivalent
    6092, 17.53, 98178.95, 66.61, 12085.89, 25.00, 0, 17.47, 66.01, 25.00, 500.00, 0.50
    .... measurements continue without bug
    15093, 18.50, 98189.98, 66.46, 14548.93, 25.00, 0, 18.43, 63.65, 25.00, 500.00, 0.50
    1265 lines of : BME680 warning code : 2
    21094, 17.37, 98181.46, 65.98, 14268.18, 25.00, 0, 17.34, 67.33, 25.00, 500.00, 0.50
    .... measurements continue without bug
    102094, 18.74, 98188.98, 64.72, 17909.28, 25.00, 0, 18.67, 62.62, 25.00, 500.00, 0.50
    BME680 error code : -2

     

     

    Something I tried that didn't work

    I tried to solve the BME680 warning code : 2  (meaning no new date) by adding a delay just before updateState() in the loop() like this:

     

            delay(60000);
            yield();
            updateState();

     

     

    But I still get the BME680 warning code : 2 and BME680 error code : -2 and I even get BSEC warning code : 100 and BSEC error code : -2 

    ○ BSEC Error code : -2 = "BSEC_E_DOSTEPS_VALUELIMITS" which means the value of the input (physical) sensor signal passed to bsec_do_steps() is not in the valid range.The solution proposed  here  is a fix in the code but I already have it.

    ○ BSEC warning code : 100 = "BSEC_W_SC_CALL_TIMING_VIOLATION " : Difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed

     

    5 REPLIES 5

    handytech
    Community Moderator
    Community Moderator

    @user001 wrote:
    I guess I don't understand how to set the 5min config in "basic_config_state.ino".

    The config file is one thing, but you need to inform the Arduino library that you want to run in ULP mode too. This is done by simpling updating this line:

    iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_LP);

    into:

    iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_ULP);

     


    @user001 wrote:
    I also tried to add/remove a connection to a server so I can save my data (which probably adds delay and makes my interval between my measurement unstable).

    This is a known issue, and especially with all the ESP users around 😉 BSEC requires precising timings, and if the WiFi (for the ESP8266) needs to (re)connect, it is most likely to generate timing violations. I understand that you initial goal was to refresh at most every 60seconds, but I would strongly recommend to use BSEC's ULP mode instead, with 300s of sampling period. In this mode the measurement and BSEC operation take just a few seconds, which leaves some minutes to do any other actions, such as WiFi connections/transmissions.


    @user001 wrote:

    But I still get the BME680 warning code : 2 and BME680 error code : -2 and I even get BSEC warning code : 100 and BSEC error code : -2 

    ○ BSEC Error code : -2 = "BSEC_E_DOSTEPS_VALUELIMITS" which means the value of the input (physical) sensor signal passed to bsec_do_steps() is not in the valid range.The solution proposed  here  is a fix in the code but I already have it.

    ○ BSEC warning code : 100 = "BSEC_W_SC_CALL_TIMING_VIOLATION " : Difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed


    Please note that BME680 warning/error codes are different than BSEC warning/error codes. In you case, it seems that you have "BME680 error code : -2" which is typically cause by communication failures. If this only happens from time to time, I would make sure that you have proper sensor connections, and that no other components/tasks may interfere with communication to the BME680 (e.g. any other components on the bus?).


    @user001 wrote:

    I found a way to step this up with my NodeMU esp8266 and the ticker library. 


    Sounds good. If you follow my recommendation to use ULP mode, don't forget to update your timeout periods accordingly. Also note that if you switch to ULP mode, I am confident that you could put the data printout/transmission in the same scope right after running BSEC.

     

    PS: On a side note, I have heard that in some case it is better to add at least a 'delay(1);' rather that leaving your loop() function empty, to improve the stability of your program.

    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