Skip to main content
timothy0508
Associate II
Mar 20, 2019 3:06 PM UTC
Solved

L3GD20H raw value conversion

How does one convert:

  1. Raw angular rotation data to DPS
  2. Raw temperature sensor readings to degrees

Thanks :grinning_face:

    This topic has been closed for replies.
    Eleon BORLINI
    Eleon BORLINIBest answer
    ST Employee
    Mar 21, 2019 10:34 AM UTC

    ​you're welcome timothy, you can get temperature value in a similar way: read the OUT_TEMP (26h) reg value (e.g. 15h), transform in decimal value through two's complement (e.g. decimal 21) and apply the  -1 LSB/°C conversion factor, obtaining -21°C

    Regards

    Eleon

    6 replies

    Eleon BORLINI
    ST Employee
    Mar 20, 2019 4:42 PM UTC

    ​hi timothy,

    1. Raw angular rotation data to DPS --> taking X axis as example, you have to concatenate OUT_X_L (28h) and OUT_X_H (29h) in a 16 bit's word and convert the value in two's complement. Finally, multiply it for the dps/digit of page 10 of the ds (the conversion depends on the selected FS).

    0690X0000088NlrQAE.png

    1. Raw temperature sensor readings to degrees --> similar for the temperature sensor, -1LSB/deg on 8 bit (OUT_TEMP (26h)). Also in this case the value is expressed as two’s complement.

    0690X0000088NmBQAU.png

    regards

    timothy0508
    Associate II
    Mar 20, 2019 6:14 PM UTC

    Okay, so you mean, for example, that if my full scale is 500, I just take the concatenated 16 bit value and multiply by 500?

    Eleon BORLINI
    ST Employee
    Mar 21, 2019 8:50 AM UTC

    ​Suppose you get value E2h on OUT_X_L (28h) register and value 55h on OUT_X_H (29h). You concatenate 55h and E2h obtaining 55E2h, then you apply two's complement conversion obtaining decimal 21986 and finally you multiply it for 17.50 mdps (= 0.0175 dps) obtaining 384.755 dps, if your FS is 500dps.

    Regards

    timothy0508
    Associate II
    Mar 21, 2019 9:00 AM UTC

    Got it! Thanks so much.

    Could you also give a similar example with temperature conversion?

    Regards,

    Timothy

    Eleon BORLINI
    Eleon BORLINIBest answer
    ST Employee
    Mar 21, 2019 10:34 AM UTC

    ​you're welcome timothy, you can get temperature value in a similar way: read the OUT_TEMP (26h) reg value (e.g. 15h), transform in decimal value through two's complement (e.g. decimal 21) and apply the  -1 LSB/°C conversion factor, obtaining -21°C

    Regards

    Eleon