Hi @HES_Engineering,
Running BSEC in the backend here only means that BSEC can run in any device and not specifically the MCU directly connected to the BME680 for instance. Therefore even when BSEC is running in the backend, you will still need to operate the BME680 with the same settings (T/P/H oversampling, heather duration and temperature, sampling interval, absolute timestamp, etc.) as required by BSEC.
@HES_Engineering wrote:
I have a problem that I don't fully undestand. How many measure do I need to write in the input file and how much time I need to cover with the datalog?
There is no specific rule here, and it completely depends on your use-case and expectations. The example code was provided for reference only, and simply parses the input file for however many lines are present in the file.
If you need real-time IAQ estimation, you will need to feed BSEC with relevant sensor data every time a BME680 measurement is done (again, with the relevant settings and timings). If real-time IAQ estimation is not needed, you may as well process batches of your preferred duration, e.g. once an hour, once a day, etc.
If you don't keep your BSEC instance/process open or running continuously, you would of course need to save and reload a valid state file every time BSEC is closed and re-opened, but the attached example only illustrated an example of a single, continuous run, without state file usage.
@HES_Engineering wrote:
In our case we have a BME680 that send one single measure (temp, rH, pressure, gasRes) every 10-15 mins.
10-15mins is not a valid sampling period for BSEC. The operating mode with the lowest current consumption supported by BSEC is its Ultra-Low-Power (ULP) mode, with a fixed sampling period of 5mins.
@HES_Engineering wrote:
How can I perform an IAQ calculation without sending a large amount of data from the sensor (like in this sample)?
Assuming you are able to store in the backend the trimming values of each individual BME680s you are operating, the minimum amount of data needed for each valid measurement would be an absolute timestamp together with the raw ADC/register values of the temperature/pressure/humidity/gas read-outs. Then prior to feeding these raw ADC values to BSEC, you would need to use the sensor API's compensation formulas to get the relevant units of each output, i.e. °C/%RH/Pa/Ohm. Trimming values read-out is already implemented and done by default when using our sensor APIs, and are unique per sensor, i.e. the trimming values of a specific sensor cannot be used for any other sensor.
@HES_Engineering wrote:
How many measures do I need to calculate IAQ with BSEC?
I've noted that the first 100 rows are always "25" with zero accuracy, how can I manage this in backend?
When BSEC starts running without loading a valid state file, the IAQ accuracy will show a value of zero (and typ. IAQ=25) for 20min in ULP mode, and 5min LP/HP modes, corresponding to BME680's initial stabilization time. If BSEC remains stuck at zero forever, it typically indicates that the timestamp of the measurements don't meet the timing requirements of current operating mode selected in BSEC, or some other integration issues. After these 20min/5min based on the operating mode, IAQ accuracy should vary between 1 and 3 over time based on the ambient conditions. BSEC may run asynchronously by processing batches of your preffered duration (after implementing state file support as mentioned above), but the BME680 itself must run continously at a fixed sampling rate to perform optimally, otherwise the initial 20min/5min of initialiazation will be autonomously triggered again by BSEC.
... View more