Skip to main content
Visitor II
July 25, 2021
Question

x-nucleo-iks01a2 with motionFX library

  • July 25, 2021
  • 7 replies
  • 5489 views

Hello,

I'm using nucleoF446RE with X-NUCLEO-IKS01A2. 

I read data from sensor (LSM6DSL and LSM303AGR) and with MotionFX library I get rotations, but there are some problems.

At beginning, if I don't rotate the board, the z-axis rotation is different from 0; 

If I rotate the board along y-axis, I read correct value; 

If I rotate along x-axis, I read correct rotation for x-axis, but there is also a rotation along y-axis and z-axis. (I use USART protocol to send and read data)

Also, I can't do the magnetometer calibration.

Can sameone help me?

Thank you. 

    This topic has been closed for replies.

    7 replies

    ST Employee
    July 27, 2021

    I seems like wrong sensor orientation settings.

    I propose to use STM32CubeMX and X-CUBE-MEMS1 package. You can generate example application for MotionFX for NUCLEO-F446RE and X-CUBE-NUCLEO-IKS01A2 in the STM32CubeMX. This application should work properly also with magnetometer calibration.

    You can also directly check DatalogFusion application inside X-CUBE-MEMS1 package.

    AR1Author
    Visitor II
    August 1, 2021

    I tried to use DataLog application inside X-CUBE-MEMS1 and, using the gui, I see same thing: If I rotate the system along x axis I read rotation also on y axis (about -180), even after the magnetometer calibration.

    Moreover, I don’t know why in MotionFX datasheet it is written that the rotation along y axis is between -90 and 90 degrees.

    Can you help me?

    Thank you

    ST Employee
    August 2, 2021

    I tried to replicate your issue on Nucleo-F401RE and IKS01A2 and don't see your issue. It always rotates in correct axis only. Please send me your project and datalog. You can store the datalog in Unicleo-GUI application for example.

    AR1Author
    Visitor II
    August 4, 2021

    This is the project that I use to read the rotation with Uncleo-GUI application.

    AR1Author
    Visitor II
    August 4, 2021

    This is the datalog.

    ST Employee
    August 4, 2021

    Hello,

    I have analyzed your datalog and I see the magnetometer did not reach the calibrated state.

    You can check the scatter plot. The points should draw circle with center in [0,0], after calibration you will jump to the calibrated values.

    From your datalog I see you didn't cover second half of the sphere (circle) with the movement.

    0693W00000D1XIgQAN.png 

    This is example of well calibrated magnetometer.

    0693W00000D1XJoQAN.png You can try the magnetometer calibration process using MagnetometerCalibration application in X-CUBE-MEMS1.

    AR1Author
    Visitor II
    August 6, 2021

    I did it again and this is the data log. After calibration, when I rotate along x axis there is a rotation along y axis (about -180°) for some seconds and then it return to 0°.

    Can I use MotionMC library with MotionFX library? How can I merge them?

    Thank you.

    ST Employee
    August 9, 2021

    I have a few comments:

    The angle ranges are following:

    • Yaw seems ... 0-360 degrees
    • Pitch +/-180 degrees
    • Roll +/-90 degrees

    You can use MotionMC to calibrate magnetometer instead of functions MotionFX_MagCal... which are part of the MotionFX library. Basically you need to pass the data to MotionMC library and then use calibrated magnetometer data in sensor fusion (MotionFX).