09-04-2023 03:15 PM
I am using the BSEC Library v2.4.0.0 Generic Release 23012023 and trying to use the library to get IAQ data.
I read the API docs and the examples to build my own application. I am calling bsec_update_subscription with these parameters
bsec_sensor_configuration_t requested_virtual_sensor = { .sensor_id = BSEC_OUTPUT_IAQ, .sample_rate= BSEC_SAMPLE_RATE_LP};
const uint8_t n_requested_virtual_sensors = 1;
bsec_sensor_configuration_t required_sensor_settings[BSEC_MAX_PHYSICAL_SENSOR];
uint8_t n_required_sensor_settings = BSEC_MAX_PHYSICAL_SENSOR;
bsec_update_subscription(requested_virtual_sensor,
n_requested_virtual_sensors,
required_sensor_settings,
&n_required_sensor_settings);
These parameters should give me as output the sensors required to get the IAQ output. After executing the function I get the following sensors IDs in the array required_sensor_settings with a sample rate of 0.3333 (i.e. BSEC_SAMPLE_RATE_LP)
2,3,4,22,23,24
According to the header bsec_datatypes.h enum bsec_physical_sensor_t, sensor IDs 2,3,4 are humidity, temperature, gasresistor respectively. What I do not know is what is the meaning of sensor ID 22,23,24.
ID 22 is not specified and I do not find an example on what value should be assigned to the signal data member of struct bsec_input_t. In addition, could you explain what values should I assign to sensor IDs 22 (undefined), 23 (BSEC_INPUT_DISABLE_BASELINE_TRACKER) and 24 (BSEC_INPUT_PROFILE_PART).
From my attempts at understanding the sample code, sensor ID 23 (BSEC_INPUT_DISABLE_BASELINE_TRACKER) should be assigned to gas index if the operation mode of the BME688 is not FORCED_MODE (line 380 file bsec_integration.c). But sensor ID 22 and 24 (BSEC_INPUT_PROFILE_PART) are not used in the samples.
Is it safe and valid to use bme68x_bsec_process_data for my use case (IAQ virtual sensor) ignoring input ID 22 and 24 (i.e., sample rate = BSEC_SAMPLE_RATE_DISABLED) ?
If not could this be added to the docs or answered in this question?
Thanks in advanced and if I am missing something please let me know as I am new to the BSEC library.
As further information I am calling as per documentation first bsec_init and then bsec_set_configuration with config from folder bme688_sel_18v_3s_4d file bsec_selectivity.c.
Solved! Go to Solution.
09-05-2023 10:55 AM
Hi vic,
Could we know some information first from you:
1.What is about your host platform?
2.Which program language you used?
3.What outputs do you need to use from BSEC?
09-05-2023 11:23 AM
Hello @BSTRobin ,
1.What is about your host platform?
- Windows 11, compiling for the Zephyr OS. I.e. I am using the Zephyr arm Toolchain variant for a cortex-M33 CPU. In specific a NRF5340 MCU
2. Which program language you used?
- Language C 17
3.What outputs do you need to use from BSEC?
- As mentioned in the post I want to get the IAQ data output, which in the BSEC source code library header file is defined as "BSEC_OUTPUT_IAQ" and corresponds to sensor ID number one and named as "Indoor-air-quality estimate".
09-05-2023 01:23 PM
09-05-2023 03:38 PM
Thanks for the sample program.I checked further the library and it seems that it does not really matter what the function bsec_update_subscription gives as output for required sensors. What really matters is to call bsec_sensor_control and retrieve the sensor settings, in specific the values from data member process_data. Based on the bit flags then you should populate the output data to be process by the BSEC library through bme68x_bsec_process_data.
Summary:
I wanted to know what does sensor ID 22 and 24 mean. By reading the sample I found out it does not matter, just use bsec_sensor_control afterwards to get the real sensor settings that are required in your user specific sampling loop. This is important for my use case as I am not using the sample at all, I am working with Zephyr OS and wanted to know how to use the library to work with the Zephyr driver version and use BSEC only for its custom AI algorithm.