2021-09-09 12:56 AM
Hi,
I have created a small function that reads out the 8-bit temperature register in the lis2dw12 sensor. The code is shown below
status lis2dw12::temperature(int8_t *temp)
{
*temp = static_cast<int8_t>(read_reg(REG_OUT_T)) + 25;
printf("%d\r\n", *temp);
return status::OK;
}
I run the function every 100ms (so 10Hz sampling). The measurements seems to be within the right range (25-26 deg C), but about every 5 to 10 sample I see some spikes where one measurement is maybe 28, 29 or even 30 deg C, which is wrong.
Below I have made a small 10 sec test where the temperature readings are plotted. If I average the datapoints the temperature is about 25.5 deg C which is what I expect.
My question is: "Is it normal to have such big fluctuations in the measured temperature valus when the sensor is placed right next to me on the desktop table... is this really within spec of the sensor?"
BR,
Carsten
2021-09-16 02:48 AM
Hi Carsten @CThue.1 ,
it looks a huge change, but maybe it is due to the 8-bit resolution.
Could you try the 12 bit one, where the sensitivity is 16LSB/°C, to check if it is an issue related to the temperature sensor?
You can the apply the conversion formula reported here --> lis2dw12_reg.c
float_t lis2dw12_from_lsb_to_celsius(int16_t lsb)
{
return (((float_t)lsb / 256.0f) + 25.0f);
}
-Eleon