Skip to main content
Anil3
Associate III
June 27, 2024
Question

Hard Iron Calibration

  • June 27, 2024
  • 3 replies
  • 2596 views

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

3 replies

Federica Bossi
Technical Moderator
June 28, 2024

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.
Anil3
Anil3Author
Associate III
June 29, 2024

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
Technical Moderator
July 4, 2024

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.
Federica Bossi
Technical Moderator
July 23, 2024

Hi @Anil3 ,

The magnetic calibration algorithm is used to compensate for magnetic distortions in the environment around the sensor.
If conditions change such as the proximity of a magnet, the calibration is no longer effective. You need to redo the calibration.

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.