Skip to main content
Visitor II
March 20, 2019
Solved

L3GD20H raw value conversion

  • March 20, 2019
  • 2 replies
  • 1594 views

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.
    Best answer by Eleon BORLINI

    ​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

    2 replies

    ST Employee
    March 20, 2019

    ​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

    Visitor II
    March 20, 2019

    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?

    ST Employee
    March 21, 2019

    ​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

    Visitor II
    March 21, 2019

    Got it! Thanks so much.

    Could you also give a similar example with temperature conversion?

    Regards,

    Timothy

    ST Employee
    March 21, 2019

    ​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