cancel
Showing results for 
Search instead for 
Did you mean: 

Reading LIS2DE12 Temperature

Tal Ben Porath
Associate II
Posted on February 22, 2017 at 13:31

We're using LIS2DE12 in our device and manage to get reasonable acceleration data, interrupts etc.

However, when we try to read the temperature form the designated register, we clearly get wrong results.

Here is what we try to do:

1. write 0xC0 to TEMP_CFG_REG.

2. write 0x80 to CTRL_REG4.

3. read OUT_TEMP_L.

4. small delay (**we tried with and without it, with no seeming affect**).

5. reading OUT_TEMP_H and treating its value as the temperature.

Can someone point out if we're doing something wrong in the process?

Also - do we need to treat the outcome differently? the manual says 'Temperature data is stored inside OUT_TEMP_H as two’s complement data in 8-bit format left-justified', but i'm not sure I understand the meaning of this. If someone could give an example with actual numbers that might be helpful.

Finally, the manual doesn't specify the units of the result and whether it needs some calibration.

Are we correct in assuming the units are

Celsius and that no calibration is needed?

Thanks in advance!

Tal

5 REPLIES 5
Miroslav BATEK
ST Employee
Posted on February 22, 2017 at 14:56

The temperature sensor can be used to measure temperature variations.

It isn't suitable to return absolute temperatures measures. The value represents difference respect to a reference not specified value.

Do following to correctly work with temperature sensor:

- enable the bits 6 and 7 in TEMP_CFG_REG (1Fh)

- enable Block Data Update, BDU, feature. CTRL_REG4(0x23) , BDU (bit#7)=1.

- read both temp registers (because of BDU enabled): OUT_TEMP_L (0x0C) and OUT_TEMP_H (0x0D).

Data representation:

https://en.wikipedia.org/wiki/Two

Useful bits: 8, left aligned, hence useful data in OUT_TEMP_H.

Temperature sensor output change vs temperature: 1 digit/degree of Celsius

Posted on February 22, 2017 at 15:31

Thank you very much for the speedy reply!

Is there anywhere in the manual where this fact (that the temperatures are relative, not absolute) is mentiond?

Tal

Posted on February 22, 2017 at 15:42

also, is there any way to know the reference value (against which the difference is given), without measuring manually for each device?

Posted on February 22, 2017 at 16:20

I'm not aware about a place in datasheet where it is mentioned, but it is true :-).

The reference value is not guaranteed by ST, if you want to use to measure absolute temperature you have to calibrate each device.

The temperature sensor is used internally and the output is let say only secondary function.

Jan Liphardt
Associate
Posted on December 29, 2017 at 06:30

Curiously, in other ST micro products, there is information in both registers, Temp_L and Temp_H. I noticed that Temp_L seems to change, too, in a way that is coordinated with what is going on in Temp_H. Try this:

uint8_t rawTemp[2] = {0,0};

LIS2DE12

_read_register( 0x0C, (uint8_t*)rawTemp, 2, BUS_ACC );

float temperature = (float)((int16_t)(rawTemp[1] << 😎 + (int16_t)(rawTemp[0])) / 256.0;

There seems to be one bit of extra info in

Temp_L, and the above

 seems to give the temperature in 0.5C increments, centered on T = 25C.