2021-07-19 01:51 AM
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
Solved! Go to Solution.
2021-07-22 12:46 AM
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
2021-07-19 03:19 AM
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
2021-07-20 05:42 PM
Thank you for your reply.
I've two more questions about our test case.
Thank you for your support.
2021-07-22 12:46 AM
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
2021-07-22 01:08 AM
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?
2021-07-26 01:10 AM
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