Open clebi opened 6 years ago
There seems to be no definitive answer to that. The datasheet indicates 8 LSB/°C as per TSDr
in section 2.2, so an increment of 8 for each °C. However it also appears that the sensor is calibrated to zero at a specific temperature, and this is not entirely clear. The datasheet only mentiones "T = 25°C" in the same section, which could be understood as having to add 25 to your value.
In other words, probably
let temp = sensor.temp() as f32 / 8.0 + 25.0; // °C
Other forum posts mention 20°C and 21°C by experiment.
In any case, it seems best to treat it as a relative input only to account for relative reading changes (e.g. LA_TCSo
and LA_TCOff
in 2.1).
Hello,
I've tried to read the temperature sensors and I've got weird readings. It returns 58° when it should be around 20°. I've read the datasheet of the device and it says that there is 8 LSB/deg. The following code doesn't seem to take that into account.
https://github.com/japaric/lsm303dlhc/blob/f942183517da7ae56ab4c1f0b99d7dbbdfac8aa1/src/lib.rs#L102
But still, if I divide the value by 8, it is still far from the real temperature. I didn't find any other information in the datasheet that could be explaining this.