Hello,
i have a Nicla sense me and i can't seem to figure out how to read from the bsec sensors.
if i try to read the different values all i get back is zeros. firstly i followed the exaples in the cheat sheat and later i adapted the "standalone" example of the "arduino_BHY2.h" library but the output is the same:
i found other posts with similar problems but not the exact same problem and their solutions haven't worked. one of these "solutions" was to change the variable length in the library itself from 10 to 30 but that hasnt worked either
this is my code. (please keep in mind that i am only just starting to learn c++):
#include "Arduino.h"
#include "Arduino_BHY2.h"
SensorBSEC bsec(SENSOR_ID_BSEC);
void setup()
{
Serial.begin(115200);
while(!Serial);
BHY2.begin();
bsec.begin();
}
void loop()
{
static auto printTime = millis();
// Update function should be continuously polled
BHY2.update();
if (millis() - printTime >= 1000) {
printTime = millis();
Serial.println(String("BSEC info: ") + bsec.toString());
}
}
But change from: SensorBSEC bsec(SENSOR_ID_BSEC);
To: SensorBSEC bsec(uint8_t(171));
It turns out that in the latest library the sensor ID in the sensor.h file of the library, is 115, however on the old firmware (on the board chip), it actually is ID 171. So you have to manually choose it.
If you do that and also change the frame length to 30 from 10, it should work. Good luck!
THANK YOU!!!
it works now, well atleast sort of.
the temperature and humidity seem to be actual readings but the reported temperature is like 9 degrees to high, but i can just offset that later. The other measurements arent actually measurements and are just fixed values. You don't by chance have a fix for that do you?
The iaq, voc and co2 should be correct and it requires a few seconds to start delivering correct outputs.
As for the temperature, I am having the same issue, it seems to be way higher, one thing I found on the Bosch forums is that by changing the scaling of 1.00 to 0.8 you should get correct values.
Try it and see how it goes. In my case the output went from 32C to 25C which I still doubt is 100% correct but is way better.
The comp h and t are compensated temperature and humidity readings after the board considered the chip "heating up" and removed that % from the actual temperature reading. The comg_g makes no sense however, mine is 7, yours is 4, and it should represent the compensated_gas resistance value in ohms, but it should be in the 500000 range(good air quality) and not that low.
Anyways good luck using it.
Btw let me know if you are able to get TinyML working on it, it should support it, but atm it looks like it needs a custom library.