cancel
Showing results for 
Search instead for 
Did you mean: 

LIS2DH12 how to calculate G value from X Y Z output

SChun.5
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5
TBomb.1
Senior II

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

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.

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

Thank you for your reply,

I believe we are using 8g on the values [ X = 14496 , Y = 19568 , Z = -30944 and X = -22576 , Y = 9136 , Z = 32640 ].

Are there any problem if we use 8g on setting?

No, no issue, it is an available FS. Probably better to use 8g than 2g in you case, in order to detect mechanical hits.

Tom