Go Down

### Topic: HMC5883L Calibration? (Read 18298 times)previous topic - next topic

#### mamette

##### Mar 23, 2013, 01:03 pmLast Edit: Mar 23, 2013, 01:08 pm by mamette Reason: 1
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..

#### Erdin

#1
##### Mar 23, 2013, 04:05 pm
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.

#### jd.steinberger

#2
##### Mar 23, 2013, 08:28 pm
http://www.jameco.com/Jameco/Products/ProdDS/2150248.pdf

Explains declination adjustment, tilt compensation, etc.

#### mamette

#3
##### Apr 06, 2013, 05:00 pm

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.

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..

#### michinyon

#4
##### Apr 07, 2013, 10:41 am
Quote
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.

#### Erdin

#5
##### Apr 07, 2013, 11:14 am

Quote
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".

#### spokey

#6
##### May 13, 2014, 04:05 pm
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

Go Up