cancel
Showing results for 
Search instead for 
Did you mean: 

which type of data of accelerometer is used for calulate roll and pitch either raw data or converted G data?

Mpraj.19
Associate II

i use the lis2dh12 accelerometer and lis3mdl magnetometer for making tilt compensated compass. i read datasheet and application but i have below list of confusion

q 1] which type of data of accelerometer is used for calulate roll and pitch either raw data or converted G data?

q 1.1] which equation is used to convert raw accelerometer data to G value ? with example value.

q 2] which data i need to put inside accelerometer  3 x 3 misalignment matrix ? this question is related to accelerometer calibration.

q 2.1] is it raw data or converted g data?

q 3] explain misalignment matrix (between magnetic field and sensor frame axes) of magnetometer ? this question is related to magnetometer calibration.?

q 4] once the program is done is the tilt and direction with degree is that affected by different place like india to america?

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @Mpraj.19​ , trying to answer to your questions here below. Please refer to UM2225 for further information.

q 1] which type of data of accelerometer is used for calulate roll and pitch either raw data or converted G data?

>> converted G data are used in the eCompass algorithm

q 1.1] which equation is used to convert raw accelerometer data to G value ? with example value.

>> depending on the FS set, one of this conversion formulas is used (ref. github drivers)

float lis2dh12_from_fs2_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 1.0f;
}
 
float lis2dh12_from_fs4_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) *  2.0f;
}
 
float lis2dh12_from_fs8_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 4.0f;
}
 
float lis2dh12_from_fs16_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 12.0f;
}

q 2] which data i need to put inside accelerometer 3 x 3 misalignment matrix ? this question is related to accelerometer calibration.

q 2.1] is it raw data or converted g data?

 >> always in g

q 3] explain misalignment matrix (between magnetic field and sensor frame axes) of magnetometer ? this question is related to magnetometer calibration.?

I believe you should take inspiration from MotionEC library of X-Cube-MEMS function pack.

Regards

View solution in original post

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @Mpraj.19​ , trying to answer to your questions here below. Please refer to UM2225 for further information.

q 1] which type of data of accelerometer is used for calulate roll and pitch either raw data or converted G data?

>> converted G data are used in the eCompass algorithm

q 1.1] which equation is used to convert raw accelerometer data to G value ? with example value.

>> depending on the FS set, one of this conversion formulas is used (ref. github drivers)

float lis2dh12_from_fs2_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 1.0f;
}
 
float lis2dh12_from_fs4_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) *  2.0f;
}
 
float lis2dh12_from_fs8_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 4.0f;
}
 
float lis2dh12_from_fs16_hr_to_mg(int16_t lsb)
{
  return ( (float)lsb / 16.0f ) * 12.0f;
}

q 2] which data i need to put inside accelerometer 3 x 3 misalignment matrix ? this question is related to accelerometer calibration.

q 2.1] is it raw data or converted g data?

 >> always in g

q 3] explain misalignment matrix (between magnetic field and sensor frame axes) of magnetometer ? this question is related to magnetometer calibration.?

I believe you should take inspiration from MotionEC library of X-Cube-MEMS function pack.

Regards