Some issues with the Serial with BME680 BSEC

while the bme680 works fine with simple library, (https://github.com/baxtery/LoRawan_Wisblock_BME680) i am having some Serial issues with the BSEC library, (either LoRa or BSEC stops working) is there a way to initialize the BSEC with LoRa?

Hello Baxter,
Please give more details about the problems you have and what code you are using. The code in the link you provided is using the ClosedCube library.

I had my WisBlock with BME680 using the BSEC library working over weeks without problems.

When you say LoRa or BSEC stops working, what do you mean exactly.

To initialize BSEC (or the BME680) over LoRaWan:
You have to use the downlink capability of the LoRaWAN server, define what byte sequence you want to use to start a new initialization, and send it when necessary.
On the WisBlock side you have to listen in your application to the correct data port, check the received data and if it is the byte sequence that should initiate a re-initialization of the BME680, recall the function that initializes the BME680.

1 Like

Hi Bernd, thx for the reply, I am not using (yet) the sleep so i don’t quite understand why use downlink.
I have published my code (WIP/draft) https://github.com/baxtery/LoRawan_Wisblock_BME680/blob/main/WIP_BSEC_TTN

the problem is that the IAQ returns 0 on line 337 DEBUG_PLN(iaqSensor.bme680Status);

Hi,
You asked how to initialize the BME over LoRaWan. That is what I tried to explain with the DownLink.
I tried your code and get the same error.
Now in your bme68-+0_init() I am missing the

const uint8_t bsec_config_iaq[] = {
#include "config/generic_33v_300s_4d/bsec_iaq.txt"
};
...
void bme680_init() {
...
	iaqSensor.setConfig(bsec_config_iaq);
...

But that might be because I am using the old version of BSEC (1.4.7.4)
[EDIT]
I tried to run your code and it seems the nRF52 get’s stuck when iaqSensor.run() is called.
But I cannot find out why.
The only idea I have is that send_lora_frame() is called from within a timer interrupt and that it simply takes too long.
I would try to do the reading from the BME680 either in a separate task, or from the loop() function.

1 Like

I suspect the question was actually just about how to have both BSEC and LoRaWAN working in the same firmware

I would try to do the reading from the BME680 either in a separate task, or from the loop() function.

Indeed. And not just the reading, the BSEC needs to be called into at its requested interval regardless if a reading is desired or not. The Arduino wrapper seems to expect to be called quite often, and decides if it’s actually time to call through to the secret binary BSEC library.

1 Like