HMC5883L Calibration?

Hi, i have HMC5883L 3 axis magnetometer. I heard that magnetometer must be calibrated first before it can used properly. And the method is depending from the area where we live.

I find out the magnetic field on my area through this website:
http://www.geomag.bgs.ac.uk/data_service/models_compass/wmm_calc.html

There is many variable, like Declination, Inclination, North Intensity, East Intensity, Horizontal Intensity, Vertical Intensity, and total Intensity.

The question is, are those variables used in magnetometer calibration? Or which variables that used in magnetometer calibration? And how to do a magnetometer calibration?

Thank you..

If you keep if flat, it senses the magnetic north. No problem so far.

The 'D' is deviation or declination and is the difference between the real north and the magnetic north. You could take that into account.
If the HMC5883L sensor is tilted, you need an accelerometer to detect how much it is tilted and you have to correct it. Because of the 'I' (Inclination) the magnetism is pointing downward or upward causing a change in the direction if it is tilted.

1 Like

http://www.jameco.com/Jameco/Products/ProdDS/2150248.pdf

Explains declination adjustment, tilt compensation, etc.

Erdin:
If you keep if flat, it senses the magnetic north. No problem so far.

The 'D' is deviation or declination and is the difference between the real north and the magnetic north. You could take that into account.
If the HMC5883L sensor is tilted, you need an accelerometer to detect how much it is tilted and you have to correct it. Because of the 'I' (Inclination) the magnetism is pointing downward or upward causing a change in the direction if it is tilted.

i have do it, but magnetometer tilt compensation is the problem, i have tried many algorithm like on this site:
https://www.loveelectronics.co.uk/Tutorials/13/tilt-compensated-compass-arduino-tutorial

and many others algorithm that not too different with it, but i still failed.

jd.steinberger:
http://www.jameco.com/Jameco/Products/ProdDS/2150248.pdf

Explains declination adjustment, tilt compensation, etc.

Yes, the algorithm is not too different like on this site:
https://www.loveelectronics.co.uk/Tutorials/13/tilt-compensated-compass-arduino-tutorial

and many other version of magnetometer tilt compensation algorithm that i have tried, but still didn't works well. There must something wrong..
May be the calibration process is influential..

If you keep if flat, it senses the magnetic north. No problem so far.

That isn't really so. It is sensing the direction of the geomagnetic field at your location, which is neither "flat", nor is it pointing at magnetic north. It is a 3-D vector field.

michinyon:

If you keep if flat, it senses the magnetic north. No problem so far.

That isn't really so. It is sensing the direction of the geomagnetic field at your location, which is neither "flat", nor is it pointing at magnetic north. It is a 3-D vector field.

True.
I should refrase that: "If you keep if flat and ignore the Z-axis, it senses the magnetic north. No problem so far".

Sorry for digging up a dead topic, I found a library which claims auto calibration of HMC5883L, its given here http://hobbylogs.me.pn/?p=17, its simple an can be used in a project where very limited sources can be dedicated to the compass. But it only uses 2D plane for the calculation of magnetic north.
I was looking for some easy way to calibrate my HMC5883L and bumped into this