cancel
Showing results for 
Search instead for 
Did you mean: 

Hard Iron Calibration

Anil3
Associate III

Hello Everyone!!!

I am using ISM303DAC in my project E-Compass, I am facing an issue regarding hard iron calibration. in datasheet it is mentioned that we have do hard iron calibration using external processor  and has to store those values in the internal registers of sensor.  here i don't know how to do the hard iron compensation can anyone please let me know the procedure/steps to do the hard iron calibration if any example is available with you please provide me.

Thank you,

regards,

ANIL.

ISM303DAC.PNG

5 REPLIES 5
Federica Bossi
ST Employee

Hi @Anil3 ,

You can use MotionMC library to implement the hard iron compensation.

Here you can find the user manual, let me know if you have any other doubt.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Federica Bossi,

Thanks for your reply!!!

I have used MotionMC library and got calibrated the compass and also received calibration quality as 3 which is good.

Even though it calibrated, compass value are not constant please have a look to the attached excel sheet.

how can i get some constant values?

 One more thing is that...for every power cycle i need to re-calibrate the sensor which is not possible as this compass is going to be fixed to a particular position. If i stored the previous values and send it to sensor it might be ok but the magnetic effect will change from place to place. any suggestion that how can i overcome to this issue.

Awaiting for your valuable reply.

regards,

ANIL.

 

Federica Bossi
ST Employee

Hi @Anil3 ,

In most applications it is necessary to recalibrate if environmental conditions change. it is not recommended to always use the same Hard Iron calibration values.
For compass applications we suggest the MotionEC library.
You can find code examples https://github.com/STMicroelectronics/X-CUBE-MEMS1/tree/main

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hello @Federica Bossi 

sorry for the delay in reply as i have assigned in another task i haven't gone through this...

As said by you i am using the motionMC library  and magnetometer is also getting calibrated.....but i have observed that we are calling the magnetometer calibration algorithm even after it got calibrated...can i Deinit  MC library once it got calibrated??

Thank you!!!

regards,

ANIL.

Hi @Federica Bossi 

Sorry for the late reply as i am being on another task i haven't seen into this for a while.

I am already using the motionMC library and i am also getting output values with an accuracy of 0.5 degree.

In manual it is mentioned that hardiron compensation is done by the library i have calibrated the magnetometer and also got calib.quality as good(3) , I have kept device a side and placed a magnet near to device, the values got deflected. If library is doing hard iron calibration why the values are getting deflected if a magnet is placed near to sensor even after calibration???

regards,

ANIL.