Skip to main content
Visitor II
May 19, 2021
Solved

LIS2DH Raw output to Temperature conversion

  • May 19, 2021
  • 1 reply
  • 914 views

I saw below topics.

How can i see discussion 71915817?

***

The datasheet doesn't specify how to convert register (OUT_TEMP_L (0Ch), OUT_TEMP_H (0Dh) ) data to actual temperature. 

let's say for example if reg 0x0c = 0x7 value and reg 0x0d = 0x00 value, then what will be the temperature.

https://community.st.com/s/question/0D50X00009XkeF4SAJ/lis2dh-raw-output-to-temperature-conversion

***

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    Hi @BBQ​ ,

    I suggest you to check the C drivers on Github for the LIS2DH --> lis2dh_reg.c

    • For the Normal mode:
    float_t lis2dh_from_lsb_nm_to_celsius(int16_t lsb)
    {
     return (((float_t)lsb / 64.0f) / 4.0f) + 25.0f;
    }
    • For the Low power mode:
    float_t lis2dh_from_lsb_lp_to_celsius(int16_t lsb)
    {
     return (((float_t)lsb / 256.0f) * 1.0f) + 25.0f;
    }

    If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

    -Eleon

    1 reply

    ST Employee
    May 19, 2021

    Hi @BBQ​ ,

    I suggest you to check the C drivers on Github for the LIS2DH --> lis2dh_reg.c

    • For the Normal mode:
    float_t lis2dh_from_lsb_nm_to_celsius(int16_t lsb)
    {
     return (((float_t)lsb / 64.0f) / 4.0f) + 25.0f;
    }
    • For the Low power mode:
    float_t lis2dh_from_lsb_lp_to_celsius(int16_t lsb)
    {
     return (((float_t)lsb / 256.0f) * 1.0f) + 25.0f;
    }

    If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster. 

    -Eleon