Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME680 never getting past the startup stage when using RTC.

    BME680 never getting past the startup stage when using RTC.

    utopiaproject20
    New Poster

    HI,

     

     

    In wonder if anyone can help. The bosch library and bme680 on its own works fine... but no ive added to an air quality code with several sensors the start up millis never seems to count down and therefore the gas readings are consistently stuck at 25 (co2 = 500) and these figures never change. 

     

     

    Can someon please help as ive tried multiple things to try and solve this but im struggling.

     

     

     

    Thanks

    3 REPLIES 3

    BSTRobin
    Community Moderator
    Community Moderator

    Hello utopiaproject20,

    There was BSEC 1.4.8.0 example code run on STM32, you could refer it and test it again.

    Hi im using an arduino Mega with an esp8266 chip (RX/TX) that connects to Cayenne IOT Dahsboard..

     

    The sensor works perfectly without me using software serial.. but as soon as i add the cayenne credentials etc.. the sensor never gets past the 5 min warming up stage..

     

     

    Please advise.. im fairly new to this and no idea why it wont work..

    heres my code..

     

    #include <SoftwareSerial.h>
    //#define CAYENNE_DEBUG // Uncomment to show debug messages
    #define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
    SoftwareSerial ESPserial(19, 18); // RX | TXAT+CIOBAUD=9600
    #include <CayenneMQTTESP8266Shield.h>

    // ---------- WiFi network info -----------
    char ssid[] = "VM2588954-2G";
    char wifiPassword[] = "v2yhHrkFybwv";
    char username[] = "0dcf1300-a65f-11ea-a67f-15e30d90bbf4";
    char password[] = "7955777e9b1d2bec0b2da83baa65d271aad95c03";
    char clientID[] = "a19cece0-9967-11ec-8c44-371df593ba58";

    // Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
    #define EspSerial Serial1
    ESP8266 wifi(&EspSerial);

    // - BME680 - SETUP
    #include <Wire.h>
    #include "bsec.h"
    Bsec iaqSensor;
    String output;
    unsigned long time_trigger = millis();

    // **************************************************************************
    void setup() {
    Serial.begin(9600);
    Serial.begin(9600);
    EspSerial.begin(115200);
    delay(10);
    Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
    Wire.begin();

    Serial.println(F("BME680 test"));
    // iaqSensor.begin(BME680_I2C_ADDR_SECONDARY, Wire); // Adafruit
    iaqSensor.begin(BME680_I2C_ADDR_PRIMARY, Wire); // Seed
    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);
    }

    //***********************************************************************
    void loop() {
    Cayenne.loop();
    if (! iaqSensor.run()) { // If no data is available
    checkIaqSensorStatus();
    return;
    }
    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);
    Serial.print("Temperature = "); Serial.print(iaqSensor.temperature); Serial.println(" *C");
    Serial.print("Pressure = "); Serial.print(iaqSensor.pressure / 100.0); Serial.println(" hPa");
    Serial.print("Humidity = "); Serial.print(iaqSensor.humidity); Serial.println(" %");
    Serial.print("IAQ = "); Serial.print(iaqSensor.staticIaq); Serial.println("");
    Serial.print("CO2 equiv = "); Serial.print(iaqSensor.co2Equivalent); Serial.println("");
    Serial.print("Breath VOC = "); Serial.print(iaqSensor.breathVocEquivalent); Serial.println("");
    Serial.println();
    }// Loop End

    void checkIaqSensorStatus(void)
    {
    if (iaqSensor.status != BSEC_OK) {
    if (iaqSensor.status < BSEC_OK) {
    output = "BSEC error code : " + String(iaqSensor.status);
    Serial.println(output);
    for (;;) delay(10);
    } 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 (;;) delay(10);
    } else {
    output = "BME680 warning code : " + String(iaqSensor.bme680Status);
    Serial.println(output);
    }
    }
    }

    CAYENNE_OUT_DEFAULT()
    {
    float bme_temperature = iaqSensor.temperature;
    float bme_humidity = iaqSensor.humidity;
    float bme_pressure = iaqSensor.pressure / 100.0;
    float bme_gas_resistance = iaqSensor.gasResistance / 100;
    float bme_iaq = iaqSensor.staticIaq;
    float bme_co2 = iaqSensor.co2Equivalent;
    Cayenne.celsiusWrite(1, bme_temperature); // Temp
    Cayenne.virtualWrite(2, bme_humidity, "rel_hum", "p"); // Humidity
    Cayenne.virtualWrite(3, bme_pressure, "bp", "hpa"); // Pressure
    Cayenne.virtualWrite(4, bme_gas_resistance, "analog_sensor", "ppm"); // RAW GAS
    Cayenne.virtualWrite(7, bme_co2, "gas_sensor", "null"); // CO2 BME680
    Cayenne.virtualWrite(20, bme_iaq, "IAQ", "null"); // IAQ
    }

     

     

     

    Thank you

    Hello utopiaproject20,

    If you run the example on GitHub alone, will it work on your platform?
    https://github.com/BoschSensortec/BSEC-Arduino-library/blob/master/examples/basic/basic.ino

    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