Skip to main content
Anil3
Associate III
May 22, 2024
Solved

Facing issue with MotionMC library

  • May 22, 2024
  • 4 replies
  • 5475 views

Hello Everyone!

I am working on a project Ecompass using controllers STM32F401CBU6 and mems sensor ISM303DAC. can able to read raw values of both accelerometer data and magnetometer data properly and after reading the magnetometer data i am parsing magnetometer data to MotionMC library for calibration purpose but after calling MotionMC_GetCalParams function output is always showing as

HI_Bias = {0, 0, 0},

SF_Matrix = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}},

CalQuality = MMC_CALQSTATUSUNKNOWN

i have used systick as timestamp and and also cross verified with heap and stack, rotating the sensor in 3D space 8 direction everting tried but nothing got work..... got stuck at this point.

could anyone please let me know what might be the problem.

Thank you!!!

ANIL.

 

 

Best answer by Petr S

I'm glad you finally calibrated successfully. After disconnecting power you need to calibrate it again otherwise you should implement storage of your calibration parameters and reload it after powerup but since magnetic field can change it's always better to calibrate again. Concerning the drift I'm not an expert for the algorithm so I cannot answer. Bye bye.

4 replies

Petr S
ST Employee
May 23, 2024

Hello @Anil3,

Could you please send me the datalog containing all your input data including timestamp that you feed to library?

Attached is the example of the datalog format I'd be able to use for offline analysis.

Thanks and regards,

Petr

Anil3
Anil3Author
Associate III
May 24, 2024

Thanks for the reply @Petr S 

Here is the data that I transmit as input for the Motion MC library,  also i am attaching my project file link please have a look and suggest me if any changes required. 

https://drive.google.com/file/d/1HZHeFVc6uA-nNU5QG3OdYpGI2Ij1SvnH/view?usp=drive_link

regards,

ANIL.

 

Petr S
ST Employee
May 24, 2024

I just checked your datalog and for the first look I noticed that accZ axis is copy of accY axis (or vice versa) so please check the data you get from the sensors, their processing (like unit conversion) and correctness of data feeding into library. Please take MagnetometerCalibration application in latest X-CUBE-MEMS1 as reference.

Anil3
Anil3Author
Associate III
May 25, 2024

Hello @Petr S 

Yah!!  by mistake while printing  the data i have printed the accelerometer both y and z axis as same sorry for inconvenience!!! here is the exact data that i am being received from sensor.

I have considered UM2192 for my reference.

Please find the attached.

Thank you!

Here i am having a doubt like... while feeding data to Motion_MC library we are feeding only magnetometer data with timestamp on such case we need to consider only the magnetometer data right or both accelerometer and magnetometer??

regards,

ANIL.

Anil3
Anil3Author
Associate III
May 28, 2024

 can anyone please looking into this issue?? as I have got stuck with this thing!!!!

Thank you.

regards,

ANIL.

Petr S
ST Employee
May 30, 2024

You're right, only magnetometer data are needed. But the data in your last datalog shows you're not rotating the board at all.

PetrS_0-1717066738455.png

You need to rotate the board around all 3 axes (ideally more than 360° around each axis). Then the elliptic magnetometer data are transformed into sphere and shifted to 0,0,0. The transformation parameters are actually soft iron and hard iron calibration parameters. See the example of my datalog I sent you before:

PetrS_1-1717066950168.png

 

Anil3
Anil3Author
Associate III
June 3, 2024

Hello @Petr S 

As i have mentioned earlier (at beginning of my post) even tried by  rotating device 3d space 8 shaped direction, then also it not getting the calibrated output...

Don't know exactly what I am missing with.

regards,

ANIL.

Petr S
ST Employee
June 3, 2024

Aha, ok, so please send me your datalog with rotation around all 3 axes and I'll simulate it here to see if the problem is in your data or in your code. Again I really suggest to compare your code with MagnetometerCalibration application code in latest X-CUBE-MEMS1 package to see if you do everything the same way, especially if there is some data conversion and so on. Every detail can count.