02-23-2022 11:01 PM
I have three Nicla Sense ME boards, and on all of them the temperature is about 7.5 degrees too high, and the Humidity is about 22% too low. There is little difference between the native temperature reading and the compensated BSEC output. Adjusting the multiplier in the library to the corrected value also has little effect.
I've tried running in standalone mode, and as a shield on an Arduino MKR1010. Same result.
Attached is a plot from 24h, demonstrating a comparison against a BME280.
The code running on the Nicla Sense is below.
Does anyone have any suggestions? And has anyone tested the gas sensor accuracy against a benchmark? I have my doubts, given the strange temperature and humidity readings.
/*
*Script to set the NICLA to respond to a wire command and return bsec data
*/
#include "Nicla_System.h"
#include "Arduino_BHY2.h"
#include <Wire.h>
Sensor temp(SENSOR_ID_TEMP); //!!the library has a multiplier: https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/Use-BSEC-with-BHI260AP-on-Arduino-Nicla-...
Sensor humi(SENSOR_ID_HUM );
Sensor baro(SENSOR_ID_BARO);
Sensor gas(SENSOR_ID_GAS);
SensorBSEC bsec(SENSOR_ID_BSEC_LEGACY); //it's critical to follow this tip https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME688-Nicla-Sense-me-how-to-access-the-...
#define BAUD_RATE_SERIAL_DATA (115200) //To transfer bsec data https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/Nicla-Sense-ME-I2C-Disconnecting-Bug/m-p...
int sampleInt = 5000;
unsigned long lastMillis = 0;
void setup()
{
//Serial.begin(115200);
Serial.begin(BAUD_RATE_SERIAL_DATA);
BHY2.begin();
temp.begin();
humi.begin();
baro.begin();
gas.begin();
bsec.begin();
nicla::begin();
nicla::leds.begin();
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
}
void loop()
{
int blueOn = 0;
//static auto lastMillis = millis();
// Update function should be continuously polled
BHY2.update(100);
if ((unsigned long)(millis() - lastMillis) > sampleInt) {
lastMillis = millis();
uint32_t eCO2 = bsec.co2_eq();
if (eCO2 < 800) nicla::leds.setColor(green);
if (eCO2 >= 800 && eCO2 < 1200) nicla::leds.setColor(yellow); // it's near green, could be optimized
if (eCO2 >= 1200) nicla::leds.setColor(red);
blueOn = 0;
}
if (millis() - lastMillis > 4000 & blueOn == 0) {
//blue means its waiting for a new query
nicla::leds.setColor(blue);
blueOn == 1;
}
}
void requestEvent() {
nicla::leds.setColor(magenta);
String output = bsec.toString();
char huh[131];
output.toCharArray(huh, 131);
Serial.print("Wire sending: ");
Serial.println(huh);
Wire.write(huh, 131); // respond with message of 131 bytes
// as expected by master
}
Solved! Go to Solution.
04-29-2022 09:40 AM - edited 04-29-2022 09:41 AM
Hi Guys,
The software is ready, you could refer the following steps to run it on you board.
1.download the code from URL https://github.com/bstbud/nicla-sense-me-fw/tree/fea_temp_compensation with the branch fea_temp_compensation;
2.update the BHI260 FW using the sketch: https://github.com/bstbud/nicla-sense-me-fw/tree/fea_temp_compensation/Arduino_BHY2/examples/BHYFirm...
3.run Standalone.ino sketch to get the temperature compensated ambient temperature and relative humidity reading from the BSEC sensor (virtual).
Looking forward to get feedback from you.
05-02-2022 06:19 PM
Hello,
I think i got it working.
The FW update seemed to have succeeded. There were no readable text on the serial monitor, only something like "?? ??". The sketch "Standalone.ino" seems to crash after 3 mins, because the serial monitor stops outputting text.
But the offset has the desired effect. The BSEC temperature is lowered and the humidity is increased to a reasonable value. The non BSEC sensors for temperature, pressure and humidity are not affected by the offset.
In my own test programme, the magnetometer self test failes with error code -5 (timeout).
So, we have to use the BSEC sensors for temperature and humidity? And for pressure? Is it possible to fix the non BSEC sensors too?
05-07-2022 03:43 AM
Hi sebp,
Please run Standalone.ino.
Open "Tools----Serial Monitor" to see output data.
05-07-2022 10:30 AM
BSTRobin,
i already did, it shows a similar output like your example.
The "not readable text" I mentioned was related to uploading the new FW.
05-11-2022 09:13 AM
Hi sebp,
We haven't reproduce your problem.
You could capture your problem as a picture.