Description
Running SimpleTempSensor results in readTemperature() returning nonsensical values that change based on the temperature.
Temperature sensor sample rate = 52.00 Hz
Temperature reading in degrees C
T
123.12
126.44
126.00
127.25
128.56
The root cause is that the original part the Nano 33 IoT shipped with, the LSM6DS3 (Chip marked SH) is no longer manufactured, and other parts from this family are being shipped on these boards. Mine has a LSM6DSOX (Chip marked S4). These parts have different values for temperature sensitivity, which affects how the raw value is converted into degrees Celsius.
Arduino_LSM6DS3/src/LSM6DS3.cpp
Line 162 in 2640521
Changing the formula results in accurate temperature values
t = data[0] / 256.0 + 25;
Temperature sensor sample rate = 52.00 Hz
Temperature reading in degrees C
T
26.95
26.83
26.79
26.95
26.95
Unfortunately, I'm not sure how to programmatically determine which temperature setting value is appropriate.