Skip to main content
Visitor II
November 8, 2019
Solved

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

  • November 8, 2019
  • 1 reply
  • 646 views

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?

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    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

    1 reply

    ST Employee
    November 8, 2019

    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