@lafleur wrote:
In the library, you have a delay_ms that uses delay() function from Arduino… how is this used? Do I need to be concern about this when the MCU sleeps? if so, it would be nice if you would make this function __weak__ so that it can be overwritten in the main program.
If not specified, the BSEC Software Library uses the default delay() function from Arduino. Alternatively, the last argument of the begin() functions can already be used to overwrite the default delay behavior with your own custom function. Delays are typically used within the BME680 sensor API (drivers) as well as during the measurement period of the sensor.
@lafleur wrote:
What is the relationship of sensor.nextCall to MCU sleep timing?
BSEC expects timestamps to be continuous in time and sensor.nextCall represents the expected timestamp (in ms) at which bsec_sensor_control() - thus sensor.run() - should be called next. Therefore this value could be used to calculate how long you would put your MCU to sleep before the next measurement is needed.
@lafleur wrote:
Should BEC state ONLY be saved if IAQ>3?
It depends on your integration. If running continuously (e.g. without deep sleep), you could decide to save the state file only when the accuracy reaches 3. If you are running in deep sleep mode between measurements and the RAM content of your MCU (thus of BSEC internal states too) are wiped, it becomes mandatory to store/reload the state file between every single sample to retain the minimum mandatory information for BSEC to run.
@lafleur wrote:
I have been unable to get my test code to acquire an IAQ of anything other than zero when I attempted to sleep or delay for a fixed time… I based the code on the ESP32 example, but have been unable to make it work properly.
I’m sure it’s something I’m missing or do not understand about using the BEQ library. Any ideas??
If the IAQ accuracy remains at zero, it typically indicates some timing issues. BSEC requires accurate timings as determined by the selected operating mode, which is a sampling period of 3s in LP mode (or 300s in ULP mode). From your log and code, it looks like your are currently sampling at ~11s intervals (~10s sleep) time, which is most likely causing some internal warnings and preventing the accuracy from increasing.
... View more