# LSM6DS3H information

Discussion created by Douglas Miller on Jul 10, 2017

The LSM6DS3H temp sensor info is as follows:

- It can be used for ambient measurements
- Sensitivity is 16LSB/C
- 25C offset

To calculate the temperature:

- Form a word with OUT TEMP_H + OUT_ TEMP_L (e.g. 16bit data)
- If MSB=0, the value represents the temperature in counts
o Temperature (C) = ( [OUT TEMP_H + OUT_ TEMP_L] / 16) + 25C
- If MSB=1, you must use 2’s compliment and then calculate as above, but put a minus sign in front
o Temperature (C) = - 1 x ([OUT TEMP_H + OUT_ TEMP_L] / 16) + 25C

Example 1:
OUT TEMP_H + OUT_ TEMP_L = FE70h
2’s compliment
FE70h = 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0
Invert = 0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 1
Add1 = 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 = 0190h = 400 decimal
Temp (C) = - 1 x (400 / 16) + 25 = -25C+25C = 0C

Example 2:
OUT TEMP_H + OUT_ TEMP_L = 0000h
no need for 2’s compliment since MSB=0
Temp (C) = (0/ 16) + 25 = 25C

Example 3:
OUT TEMP_H + OUT_ TEMP_L = 0190h = 400 decimal
no need for 2’s compliment since MSB=0
Temp (C) = (400/ 16) + 25 = 25C+25C = 50C

Thanks to ST Applications Engineering for this information.