2021-06-25 02:56 AM
I am working on the LIS2DH12 chip for accelerometer and temperature readings.
I am facing an issue with the temperature readings. Please find below the steps for reading the temperature value.
Sensor Initialization for Temperature :
1. Initialization of the temperature sensor: TEMP_CFG_REG to 11
2. CTRL_REG4 BDU bit set to 1
Reading the temperature :
3. Reading the OUT_TEMP_L (0Ch), OUT_TEMP_H (0Dh)
4. int16_t temp_Raw = ((int16_t)OUT_TEMP_H[2]<<8) | OUT_TEMP_L[1];
5. float temp_celcious =lis2dh12_from_lsb_nm_to_celsius(temp_Raw);
float_t lis2dh12_from_lsb_nm_to_celsius(int16_t lsb)
{
return (((float_t)lsb / 64.0f) / 4.0f) + 25.0f;
}
6. As per calculation, I am getting temperature as 35,36,37 on one device and another device 401,42,43 which is not correct. Our ambient temperature is 22 to 23 C.
pls, help to get correct temperature readings.
2021-06-28 06:29 AM