2020-04-20 11:50 PM
Hi,
I am using h3lis331dl to measure acceleration. I am using the official demo code, and I can get the ID correctly. But when I was trying to get acceleration data, the output data is weird. The output data in hexadecimal are:
data_raw_acceleration.i16bit[0]: 60
data_raw_acceleration.i16bit[1]: 40
data_raw_acceleration.i16bit[2]: 2d0
When I using transformation formula:
#define H3LIS331DL_FROM_FS_100g_TO_mg(lsb) (float)( lsb * 49.0f )
the acceleration data will be really large.
So I wonder what's the unit of the output data? are they m/s^2 or mg?
Thank you in advance!
lyc
2020-04-22 03:05 AM
Hi @YLiu.34 , you are using the correct function. As pointed out by the function name itself (H3LIS331DL_FROM_FS_100g_TO_mg), the conversion is from LSB to mg. But the data is on 12 bits, as pointed out in the datasheet, p.9. so you basically have to drop the 4 LSBs
In particular:
which is double than what I expected but is quite compatible with a steady state of the sensor device on x-y plane (z axis should be close to 1g)
Please note that this part number is designed for the high-g sensing, so it's pretty common to have a "high noise" at low g.
Regards