Helllo, I am trying to use BSEC v1.8.1492 driving a BME680 sensor using ESP32 chip, I am using Arduino framework and PlatfotmIO. Previously I used BSEC Software Library v1.6.1480 and everything worked smoothly but I couldn't make it work after updating the BSEC to the latest version (1.8.xxxx). I basically used the official example in github https://github.com/boschsensortec/BSEC-Arduino-library/blob/master/examples/basic_config_state/basic_config_state.ino So basically iaqSensor.run() is always false but it seems to work once I commented iaqSensor.setConfig(bsec_config_iaq); and here is the actual code I am using #include <bsec.h>
#include <Wire.h>
#include <Arduino.h>
const uint8_t bsec_config_iaq[] = {
#include "config/generic_33v_3s_4d/bsec_iaq.txt"
};
#define SERIAL_BAUDRATE 115200
#define EEPROM_SIZE 512
#define VERBOSE true
#define DEVICE_NAME "Connected Ambiente"
//* I2C Pins
#define I2C_SDA_PIN GPIO_NUM_13
#define I2C_SCL_PIN GPIO_NUM_15
#define OLED_Address 0x3c
#define I2C_Frequency 400000
void checkIaqSensorStatus();
Bsec iaqSensor;
bsec_virtual_sensor_t sensorList[13] = {
BSEC_OUTPUT_IAQ,
BSEC_OUTPUT_STATIC_IAQ,
BSEC_OUTPUT_CO2_EQUIVALENT,
BSEC_OUTPUT_BREATH_VOC_EQUIVALENT,
BSEC_OUTPUT_RAW_TEMPERATURE,
BSEC_OUTPUT_RAW_PRESSURE,
BSEC_OUTPUT_RAW_HUMIDITY,
BSEC_OUTPUT_RAW_GAS,
BSEC_OUTPUT_STABILIZATION_STATUS,
BSEC_OUTPUT_RUN_IN_STATUS,
BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_TEMPERATURE,
BSEC_OUTPUT_SENSOR_HEAT_COMPENSATED_HUMIDITY,
BSEC_OUTPUT_GAS_PERCENTAGE};
void setup()
{
Serial.begin(SERIAL_BAUDRATE);
Wire.begin(I2C_SDA_PIN, I2C_SCL_PIN, (uint32_t)I2C_Frequency);
iaqSensor.begin(BME68X_I2C_ADDR_LOW, Wire);
if (iaqSensor.bme68xStatus != 0)
{
iaqSensor.begin(BME68X_I2C_ADDR_HIGH, Wire);
if (iaqSensor.bme68xStatus != 0)
{
printf("No sensor found.\r\n");
return;
}
else
printf("BME680 sensor found with secondary address.\r\n");
}
else
printf("BME680 sensor found with primary address.\r\n");
checkIaqSensorStatus();
iaqSensor.updateSubscription(sensorList, 13, BSEC_SAMPLE_RATE_LP);
iaqSensor.setConfig(bsec_config_iaq);
checkIaqSensorStatus();
printf(">> Sensor : BSEC library version %d.%d.%d.%d\r\n",
iaqSensor.version.major,
iaqSensor.version.minor,
iaqSensor.version.major_bugfix,
iaqSensor.version.minor_bugfix);
}
void loop()
{
// put your main code here, to run repeatedly:
delay(100);
unsigned long time_trigger = millis();
if (iaqSensor.run())
{ // If new data is available
String output = String(time_trigger);
output += ", iaq: " + String(iaqSensor.iaq);
output += ", iaqAccuracy: " + String(iaqSensor.iaqAccuracy);
output += ", staticIaq: " + String(iaqSensor.staticIaq);
output += ", co2Equivalent: " + String(iaqSensor.co2Equivalent);
output += ", breathVocEquivalent: " + String(iaqSensor.breathVocEquivalent);
output += ", rawTemperature: " + String(iaqSensor.rawTemperature);
output += ", temperature: " + String(iaqSensor.temperature);
output += ", " + String(iaqSensor.pressure);
output += ", rawHumidity: " + String(iaqSensor.rawHumidity);
output += ", humidity: " + String(iaqSensor.humidity);
output += ", gasResistance: " + String(iaqSensor.gasResistance);
output += ", stabStatus: " + String(iaqSensor.stabStatus);
output += ", runInStatus: " + String(iaqSensor.runInStatus);
output += ", gasPercentage: " + String(iaqSensor.gasPercentage);
Serial.println(output);
}
else
{
checkIaqSensorStatus();
}
}
void checkIaqSensorStatus(void)
{
if (iaqSensor.bsecStatus != BSEC_OK)
{
if (iaqSensor.bsecStatus < BSEC_OK)
{
printf("BSEC error code : %d\r\n", iaqSensor.bsecStatus);
for (;;)
; /* Halt in case of failure */
}
else
{
printf("BSEC warning code : %d\r\n", iaqSensor.bsecStatus);
}
}
if (iaqSensor.bme68xStatus != BME68X_OK)
{
if (iaqSensor.bme68xStatus < BME68X_OK)
{
printf("BME68X error code : %d\r\n", iaqSensor.bme68xStatus);
for (;;)
; /* Halt in case of failure */
}
else
{
printf("BME68X warning code : %d\r\n", iaqSensor.bme68xStatus);
}
}
}
... View more