I have been using the BSEC library with ESP32 with Arduino. Everything is working fine.
As it is a battery powered application, I wanted to decrease the time the esp32 is awake and so while looking deeply within the BSEC functions I noticed that the BSEC::Run() function causes approximately a 2second delay. Upon experimentation I overrode the delay function and set the delay to 200ms regardless of whats passed in as a delay from BSEC. Everything is still working fine, the sensor readings dont seem to be off.
I wanted to know if it is okay to leave it at that? And what might the consequences be for such changes?
Solved! Go to Solution.
In the BSEC::Run() function, the library triggers a measurement of the BME680 sensors. The duration of each measurement, especially of the gas sensor, depends on the current operating mode. In Ultra-Low-Power mode (ULP with 5min sampling period), the gas measurement itself takes about 2 seconds. Since this duration corresponds to the active measurement time of the sensor, its respective delay period shall not be reduced.
If you would like to do something else within this measurement period, it is optionally possible to override the default delay function by a custom idle task, but be aware that this method would replace all internal delays, even of a few milliseconds, therefore this custom task shall not break the BME680 or BSEC timing requirements, nor reset the controller or BSEC/RAM states, etc.
Thank you for the quick response.
Yes you are correct, I am running this with the the ULP mode 300s. What mode would you recommend that would provide a faster reading with the least hinderance in the accuracy? (Something less than a second? Possible in the millisecond range).
Yes I did override the delay function but if its just possible to change the operating mode then no need.