Skip to main content
SChun.5
Associate
July 19, 2021
Solved

LIS2DH12 how to calculate G value from X Y Z output

I'm new to sensor programming.

I want to have G value with X,Y,Z output values.

Here's what I have done - sqrt( x^2+y^2+z^2 ) = G

please give me any advice to have a better outcome.

If I miss any values that I might have between the above equation, please help me.

Thank you in advance

This topic has been closed for replies.
TBomb.1
TBomb.1Best answer
Visitor II
July 22, 2021

Yes it is possible to get higher acceleration values from a shock impact than in case of free fall, it depends on the intensity of the pulse. You have to choose the correct full scale to be able to detect these shocks, for example the 16g FS.

The values X = 14496 , Y = 19568 , Z = -30944 and X = -22576 , Y = 9136 , Z = 32640 are above 2g: are you using higher full scales?

Tom

5 replies

TBomb.1
Visitor II
July 19, 2021

Hello, if you want to convert the LSB into physical units you can refer to the sensitivity value on the datasheet.

Alternatively you can use the formula I found on github:

float_t lis2dh12_from_fs2_hr_to_mg(int16_t lsb)
{
 return ((float_t)lsb / 16.0f) * 1.0f;
}

you convert in two's complement on 16 bits and then multiply by the mg/LSB sensitivity.

The formula you are referring to is the overall gravity vector intensity, not just the single axis components.

Tom

SChun.5
SChun.5Author
Associate
July 21, 2021

0693W00000D0AUhQAN.png0693W00000D0AUmQAN.pngThank you for your reply.

I've two more questions about our test case.

  1. we got X = 14496 , Y = 19568 , Z = -30944 and X = -22576 , Y = 9136 , Z = 32640 values in different timestamp, Is it possible to get those values in the round-back trip test?
  2. we tested on our lab in a different condition, we got more impact on our sensor from bumpy road test than free-fall test. the test conditions are attached. Do we usually receive more impact on the bumpy road than free-fall?

Thank you for your support.

TBomb.1
TBomb.1Best answer
Visitor II
July 22, 2021

Yes it is possible to get higher acceleration values from a shock impact than in case of free fall, it depends on the intensity of the pulse. You have to choose the correct full scale to be able to detect these shocks, for example the 16g FS.

The values X = 14496 , Y = 19568 , Z = -30944 and X = -22576 , Y = 9136 , Z = 32640 are above 2g: are you using higher full scales?

Tom