Bosch Sensortec Community

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

    BME680 on ESP8266 IAQ, CO2, ... do not change

    BME680 on ESP8266 IAQ, CO2, ... do not change

    Desh
    Member

    Hi,

    I use a  Wemos D1 ESP8266 Board with a BME680 connected to I2C , BSEC libary installed and adjustments done as decribed in the Github pages (https://github.com/BoschSensortec/BSEC-Arduino-library) and using the "basic" example from there. Temp., humidity, pressure look OK, but all other values do not change since 9 days (IAC =25, Accuracy=0, CO2 = 500, VOC = 0.5).

    Edit: Gas resitance changes, esp. when I breath on it, so Iassume the sensor works, but caclulation of the values not.

    I've tested three versions of the BSEC library, but no change (1.2.1474, 1.4.703, 1.4.8.0).

    I'm using Arduino IDE 1.8.13, includes are: bsec.h (as per example provided)

    Any ideas?

    Thanks

    Desh

    18 REPLIES 18

    @Jet: Thank you for your answer, but how would I do that in the basic example code provided (basic.ino, see below)?

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    basic.ino

    #include "bsec.h"

    // Helper functions declarations
    void checkIaqSensorStatus(void);
    void errLeds(void);

    // Create an object of the class Bsec
    Bsec iaqSensor;

    String output;

    // Entry point for the example
    void setup(void)
    {
    Serial.begin(115200);
    Wire.begin();

    iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire);
    output = "\nBSEC library version " + String(iaqSensor.version.major) + "." + String(iaqSensor.version.minor) + "." + String(iaqSensor.version.major_bugfix) + "." + String(iaqSensor.version.minor_bugfix);
    Serial.println(output);
    checkIaqSensorStatus();

    bsec_virtual_sensor_t sensorList[10] = {
    BSEC_OUTPUT_RAW_TEMPERATURE,
    BSEC_OUTPUT_RAW_PRESSURE,
    BSEC_OUTPUT_RAW_HUMIDITY,
    BSEC_OUTPUT_RAW_GAS,
    BSEC_OUTPUT_IAQ,
    BSEC_OUTPUT_STATIC_IAQ,
    BSEC_OUTPUT_CO2_EQUIVALENT,
    BSEC_OUTPUT_BREATH_VOC_EQUIVALENT,
    BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
    BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,
    };

    iaqSensor.updateSubscription(sensorList, 10, BSEC_SAMPLE_RATE_LP);
    checkIaqSensorStatus();

    // Print the header
    output = "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";
    Serial.println(output);
    }

    // Function that is looped forever
    void loop(void)
    {
    unsigned long time_trigger = millis();
    if (iaqSensor.run()) { // If new data is available
    output = String(time_trigger);
    output += ", " + String(iaqSensor.rawTemperature);
    output += ", " + String(iaqSensor.pressure);
    output += ", " + String(iaqSensor.rawHumidity);
    output += ", " + String(iaqSensor.gasResistance);
    output += ", " + String(iaqSensor.iaq);
    output += ", " + String(iaqSensor.iaqAccuracy);
    output += ", " + String(iaqSensor.temperature);
    output += ", " + String(iaqSensor.humidity);
    output += ", " + String(iaqSensor.staticIaq);
    output += ", " + String(iaqSensor.co2Equivalent);
    output += ", " + String(iaqSensor.breathVocEquivalent);
    Serial.println(output);
    } else {
    checkIaqSensorStatus();
    }
    }

    // Helper function definitions
    void checkIaqSensorStatus(void)
    {
    if (iaqSensor.status != BSEC_OK) {
    if (iaqSensor.status < BSEC_OK) {
    output = "BSEC error code : " + String(iaqSensor.status);
    Serial.println(output);
    for (;;)
    errLeds(); /* Halt in case of failure */
    } else {
    output = "BSEC warning code : " + String(iaqSensor.status);
    Serial.println(output);
    }
    }

    if (iaqSensor.bme680Status != BME680_OK) {
    if (iaqSensor.bme680Status < BME680_OK) {
    output = "BME680 error code : " + String(iaqSensor.bme680Status);
    Serial.println(output);
    for (;;)
    errLeds(); /* Halt in case of failure */
    } else {
    output = "BME680 warning code : " + String(iaqSensor.bme680Status);
    Serial.println(output);
    }
    }
    }

    void errLeds(void)
    {
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, HIGH);
    delay(100);
    digitalWrite(LED_BUILTIN, LOW);
    delay(100);
    }

    Jet
    Occasional Contributor

    Hi Sir:

        Did you verify other example code? In this code, I didn't find this function, iaqSensor.setConfig(bsec_config_iaq), which configure the BSEC library with information about the sensor.

        I recommend you to test other reference code  or refer to them to modify your code.

    @Jet: I finally had time to test your input today. Using the "basic_config_state" example it worked after 5 minutes. You could clearly see all values changing when I did breate on it. So I can now use it for my CO2 box 😁 Many thanks!

    I have some additional questions though - sorry 🤔:

    • What are the units for CO2_EQUIVALENT (ppm?), BREATH_VOC_EQUIVALENT (ppm?) and IAQ?
    • IAQ: I know it is a calculated value, but what are typical values for i.e. out side in a forrest vs. close to a highway traffic jam? Is lower better?
    • Is there an easy way to re-calibrate temperature and humidity? It seems, that they are to high (temp approx. 2°C) or too low (humidity approx. 15%)

    Jet
    Occasional Contributor

    Hi Sir:

       Regarding some additional questions:

       1. Please see the topic and you will know their definition descriptions:

            https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-Min-and-Max-values-of-CO2e-and-b-...

           IAQ have no unit, and PPM means parts per milion. And from BME680 datasheet you also can know what b-voc we test in laboratory is how to mixture.

       2. IAQ only reflect the air quality worse or better, which means the device is in more better air condition or more worse, can't compare one site with another site at the same time, but we can know the air quality is becoming good or bad after you move sensor.

      3. Humidity may not be re-calibrated, but termperature offset can be inputed to BESC algorithm. by bsec_iot_init() function.

        Recommand you to recreate a new topic to talk about your thoughts in order to trace it.

        We will give you the satified answers for your queries.

        New thought, new topic, 😄.

    Hi Jet,

    thanks a lot for the fast answers as always. The answers and link provided did help me for now.

    Keep up the good work

    Desh

    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