@handytec, Thanks for the response and advice 🙂 FYI: we are using the BME680 in a battery powered IoT device that must take a measurement and send an RF packet with the data to a gateway that relays the info to a server. It is vital that the device's battery last as long as possible. I suspect that my Makefile did not pick up the change to the "bsec_serialized_configurations_iaq.c" file and used an old object file. After fixing it, the BSEC lib expects to be called every 300 seconds. Here is my simplified super loop that performes the operation every 300 seconds and feeds it an artificial timestamp: // Configure RTC to wake up micro once every 5 minutes (300 seconds)
px_rtc_wakeup_tmr_enable(PX_RTC_WAKEUP_PRESC_CLK_DIV_1, 300 - 1);
while (1)
{
// 300 seconds passed?
if(px_rtc_wakeup_tmr_has_expired())
{
px_sysclk_ticks_t start_ms = px_sysclk_get_tick_count();
// Update timestamp in nanoseconds before calling bsec_sensor_control()
time_stamp += 300e9;
// Retrieve sensor settings to be used in this time instant by calling bsec_sensor_control
ret = bsec_sensor_control(time_stamp, &env_sensor_settings);
PX_DBG_INFO("bsec_sensor_control() returned %d", ret);
// Trigger a measurement if necessary
bme680_bsec_trigger_measurement(&env_sensor_settings, sleep);
// Read data from last measurement
num_bsec_inputs = 0;
bme680_bsec_read_data(time_stamp, env_sensor_bsec_inputs, &num_bsec_inputs, env_sensor_settings.process_data);
// Time to invoke BSEC to perform the actual processing
bme680_bsec_process_data(env_sensor_bsec_inputs, num_bsec_inputs, output_ready);
PX_DBG_INFO("Duration = %u ms", px_sysclk_get_tick_count() - start_ms);
}
} I let the code run and here is a sample of my debug output: I 03603.529 env 137 : IAQ = 74.959404 (46.823772) Accuracy 1
I 03603.530 env 138 : Temp = 24.963551 (24.964138)
I 03603.535 env 139 : Hum = 46.385796 (46.384171)
I 03603.540 env 140 : Press = 100085.429688
I 03603.545 env 141 : Gas = 334342.656250
I 03603.549 env 142 : eCO2 = 587.295105
I 03603.554 env 143 : VOC = 0.695413
I 03603.558 env 537 : Duration = 2032 ms
I 03901.491 env 529 : bsec_sensor_control() returned 0
I 03903.493 env 137 : IAQ = 56.065483 (38.570335) Accuracy 1
I 03903.494 env 138 : Temp = 25.041248 (25.041836)
I 03903.499 env 139 : Hum = 46.475689 (46.474064)
I 03903.504 env 140 : Press = 100083.601562
I 03903.509 env 141 : Gas = 336407.125000
I 03903.513 env 142 : eCO2 = 554.281372
I 03903.518 env 143 : VOC = 0.613845
I 03903.522 env 537 : Duration = 2032 ms
I 04201.468 env 529 : bsec_sensor_control() returned 0
I 04203.470 env 137 : IAQ = 72.424126 (45.716286) Accuracy 1
I 04203.471 env 138 : Temp = 25.103903 (25.104490)
I 04203.476 env 139 : Hum = 46.501877 (46.500244)
I 04203.481 env 140 : Press = 100090.484375
I 04203.486 env 141 : Gas = 332980.343750
I 04203.490 env 142 : eCO2 = 582.865112
I 04203.495 env 143 : VOC = 0.683868 Why does the IAQ value vary so much between readings? If we were not interrested in IAQ, because of the excessive calculation burden, but only eCO2 and VOC, would there be a simpler formula / procedure available to calculate it from the gas resistance? Thanks in advance, Pieter
... View more