09-23-2021 06:36 PM
After receiving the Nicla Sense me arduino card, we've been trying to figure out how to access the data returned from the BME688 gas sensor using arduino IDE.
We are connecting the card through a regular USB cable.
So far, we've been using these lines of code:
Sensor gas(BHY2_SENSOR_ID_GAS); // Declaring the sensor as a global variable.
gas_value=gas.value(); // To access the data returned from the BME688 gas sensor
But, upon println(gas_value); we have been only seeing an integer number. So our question is basically, what are the functions/variables to use in order to see the full potentiel of BME688 and the data that it captures.
Solved! Go to Solution.
09-26-2021 08:11 PM
The current example sketch Standalone.ino and the Arduino_BHY2 library supports parsing of the raw gas sensor (gas resistance, sensor ID:131) , the gas resistance value is integer type.
To make sense of the gas resistance for something more useful and intutitive, the BSEC 1.x software has been integrated on the BHI260 chip of the board.
The BSEC output is also put in the FIFO with a sensor ID 171 (for older legacy BHI260 FW) or sensor ID 115 (for newer BHI260 FW).
To make it easier for you to use the BSEC output, please use this newer version of the Arduino_BHY2 library and bhy controller tools here:
In future, we would expect to see those updated software to be on github with more examples and features to make things easier on your side.
09-27-2021 05:52 PM
Thanks for your answer!
11-15-2021 06:16 PM
i'm trying to geht the IAQ value with the shared code.
could you please help me with the code:
but I only get the temperature:
BSEC output values - iaq: 0 iaq_s: 0 b_voc_eq: 0.00 co2_eq: 0 accuracy: 0 comp_t: 26.53 comp_h: 39.05 comp_g: 0
Could you help me.
11-16-2021 02:52 AM
This is because most sensor frame size is less than 10 (and to save space), SENSOR_DATA_FIXED_LENGTH is defined as 10.
you could change the definition of SENSOR_DATA_FIXED_LENGTH (in libraries/Arduino_BHY2/src/sensors/SensorTypes.h) to a larger value such as 30 (which is greater than the frame size of 29 for sensor id 171), and you should be able to see the actual IAQ values rather than 0.
BTW, the similar code (you are using from the google drive) is actually publically available on github.
again, you need to change the definition of SENSOR_DATA_FIXED_LENGTH to a larger value.
we will see in future, a more flexbile solution could be provided to accomodate for both large frames and small frames, right now, only few sensors have frame size larger than 10 that's why Arduino has implemented it this way.