cancel
Showing results for 
Search instead for 
Did you mean: 

what are the units of the h3lis331dl output data?

YLiu.34
Associate II

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

1 REPLY 1
Eleon BORLINI
ST Employee

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:

  • data_raw_acceleration.i16bit[0]: 0060h --> 12bits --> 006h --> two's complement conversion --> LSB 6 --> *sensitivity (*49) --> 294mg
  • data_raw_acceleration.i16bit[1]: 0040h --> 12bits --> 004h --> two's complement conversion --> LSB 4 --> *sensitivity (*49) --> 196mg
  • data_raw_acceleration.i16bit[2]: 02d0h --> 12bits --> 02Dh --> two's complement conversion --> LSB 45 --> *sensitivity (*49) --> 2205mg

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