02-10-2022 05:05 PM - edited 02-10-2022 05:10 PM
Hello,
I would like to readout multiple BME688 simultaniously. I created two instances of Bsec2, and afterwards i do each step for both instances. I kept the NewDataCallback the same, as one input parameter is the BSEC instance. In BSEC2 i get an error 100 from BSEC2.
Please let me know what is the problem .
Bsec2 envSensors[2];
for(int i = 0; i < NUMBEROFDEVICES; i ++)
{
//Set multiplexer
if (!envSensors[i].begin(BME68X_I2C_ADDR_LOW, Wire))
{
checkBsecStatus(envSensors[i]);
}
/* Subsribe to the desired BSEC2 outputs */
if (!envSensors[i].updateSubscription(sensorList, ARRAY_LEN(sensorList), BSEC_SAMPLE_RATE_LP))
{
checkBsecStatus(envSensors[i]);
}
/* Whenever new data is available call the newDataCallback function */
envSensors[i].attachCallback(newDataCallback);
envSensors[i].index = i;
Serial.println("BSEC library version " + \
String(envSensors[i].version.major) + "." \
+ String(envSensors[i].version.minor) + "." \
+ String(envSensors[i].version.major_bugfix) + "." \
+ String(envSensors[i].version.minor_bugfix));
}
}
if (!envSensors[i].begin(BME68X_I2C_ADDR_LOW, Wire))
{
checkBsecStatus(envSensors[i]);
}
I checked the Arduino example for x8 board, which has 8 times BME688 and Multiplexer. It seems like the example is reading and processing only 1 BME688 sensor.
Kind Regards
Solved! Go to Solution.
02-15-2022 04:06 AM - edited 02-15-2022 04:06 AM
Hello hugehead,
You could modify macro definition SENS_NUM to support multiple sensor.
/* sensors are numbered 0-7 */
#define SENS_NUM 0
Hello hugehead, You could modify macro definition SENS_NUM to support multiple sensor. /* sensors are numbered 0-7 */ #define SENS_NUM 0
02-15-2022 08:30 AM
Hello Robin,
I do not understand how i could manage to read out multiple sensors with that method. I can change the sensor, compile, flash and run the code. Then i can change again, compile, flash and run on different BME688.
/* sensors are numbered 0-7 */
#define SENS_NUM 1
/* sensors are numbered 0-7 */
#define SENS_NUM 2
I would like to have a program that iterates over mutiple sensors during runtime. In the X8 Board-Case, I would like to iterate over the 8 sensors and read them one by one during runtime. With this X8 example it is not possible, as it is running only on 1 instance of Bsec2.
I sent you an example i created in arduino, to read 2x BME688 Pi 3g heads with I2C address 0x77 and 0x76. In there, i create 2 instances of Bsec2 and read them in a loop. In the output of that example (i shared in previous message), I can see from "gas resistance" that it is reading 2 different sensors, with unexpected timing. It is like 3 times reading envSensor1 and 3 times reading envSensor2. It should be reading alsways envSensor1, envSensor2, envSensor1, envSensor2. The values should be coming every ~ 3 seconds, what i saw in example with single sensor.
I am getting the warning 100. What is it about? How can i get rid of this warning 100? Do I have to save the current state of the library for each Bsec2 instance? Right now i am using one library for 2 sensors. Is that intended to work properly? Please help me to find a solution for this.
02-18-2022 02:05 PM
Hi,
I have the exact same problem on the BME888 development kit with the x8 basic example. If you want to have continuous data readouts from 2 sensors, it simply doesn't work. Only one sensor is giving a readout via the callback. The other ones gives back a "100" BSEC status.
It seems to me that trying to read sensor status messes the data readouts via the callback.
Is there any plan to release a basic arduino example on how to read multiple sensors at the specified data rate ?
Best regards
02-25-2022 09:53 AM
Hello hugehead,
Warning 100 means difference between actual and defined sampling intervals of bsec_sensor_control() greater than allowed.
Please ensure that your system calls bsec_sensor_control() at the time instructed in the previous call, a maximum jitter of 6.25% is allowed.
03-09-2022 01:16 PM
Hello Robin,
Thank you for the answer. I know already that this error is related to the timing. The timing is handled by the Libraries , i get the timestamp for the next call by "bsec_sensor_control".
As i have multiple instances of BSEC2, I made use of "bsec_set_state" and "bsec_get_state" for each of my BSEC2 instances. Still, I need to call the function "bsec_sensor_control" for each of my instances to get proper timestamp. The library, then, gives the error, because i run the funtion "bsec_sensor_control" too fast to get new timestamp.
My main question stays valid: how can i read out multiple BME688 at the same time. There is no example code for this available. I already create an issue in github repo, with no response. Please, could you get someone from the dev team to find out a solution on this? It seems i am not the only one trying to get this done.