MAG calibration - ISSUES

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

MAG calibration - ISSUES

Post by nhadrian »

Hi all,

I'm having problems with my MAG. I have a Crius AIO pro board (HMC5883 mag sensor).
The problem is that after calibration I have about 15-16 degrees error in North, 7-9 degrees error in West, 0-2 degrees in East, 0 error in South direction (compared to a real compass).
I can't figure out what is the problem, I tried many combinations of rotating the copter during calibration in the air. Without success, almost the same result (maximum 2-3 degrees in error).
There is not any magnet close to the sensor, even moved the beepers 15 cm away from it. (The whole frame is 30 cm so the farest point...:D )
Any ideas, suggestions?

BTW, what do you think of having a different, more accurate method of calibration? Like in mikrokopter code? (Rotating through all axes each after each, beep confirms once one axis is done).

BR
Adrian

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: MAG calibration - ISSUES

Post by IceWind »

What code version are you using?
I noticed the same when using the latest dev version.
But just thought the magnetic pole had changed in the mean time. :)

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: MAG calibration - ISSUES

Post by nhadrian »

Update. I found the solution. But not the origin... :(
I had the idea if there is something with either the sensor or the position of the snesor on the board (some magnetic influence?!?!?!)
So I removed the sensor from the board (soldered out), and connected a HMC5843 on a Brake out board (I had a spare).
It solved the issue, after recalibrating, all directions works fine. The BOB is placed onto the Crius aio extend board (somewhere instead of xbee module on the top).

I don't know if this issue was related to a damaged sensor, a bad position or a BUG in the code.

BR
Adrian

PS.: Code is r1177.

vpb
Posts: 231
Joined: Mon Jul 23, 2012 4:09 pm

Re: MAG calibration - ISSUES

Post by vpb »

Hi nhadrian! what's your MAG calibration order? Yaw, then Pitch and Roll, CW or CCW direction? Thanks!

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: MAG calibration - ISSUES

Post by shikra »

A while ago someone posted an interesting and the optimum way to calibrate mag. It may even have been on rcgroups.
In brief it suggested lining up axis with magnetic field. in my case / location it means pointing slightly down to the ground. About 20 degrees or so. I do recall noticing an improvement so have carried on doing that.
Anyone have a link to the article?

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: MAG calibration - ISSUES

Post by IceWind »

Found this, does it ring a bell? Or was something different?

http://paparazzi.enac.fr/wiki/ImuCalibr ... gnetometer

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MAG calibration - ISSUES

Post by copterrichie »

Correctly if I am mistaken here but having the Mag is basically good for Waypoints, Return to home and Navigation. I really don't understand the need to accuracy at this stage of the game.

fiendie
Posts: 151
Joined: Fri Apr 20, 2012 4:22 pm

Re: MAG calibration - ISSUES

Post by fiendie »

copterrichie wrote:Correctly if I am mistaken here but having the Mag is basically good for Waypoints, Return to home and Navigation. I really don't understand the need to accuracy at this stage of the game.

What about Headhold and Headfree modes?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MAG calibration - ISSUES

Post by copterrichie »

fiendie wrote:
copterrichie wrote:Correctly if I am mistaken here but having the Mag is basically good for Waypoints, Return to home and Navigation. I really don't understand the need to accuracy at this stage of the game.

What about Headhold and Headfree modes?


Heading Hold, I am not so sure about, I personally use the YAW PID and set the I value high, the Headfree mode is nice.

User avatar
IceWind
Posts: 115
Joined: Fri Mar 25, 2011 2:11 am
Contact:

Re: MAG calibration - ISSUES

Post by IceWind »

One of the features of the RTH is point the head/tail home. For that the MAG is needed no?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MAG calibration - ISSUES

Post by copterrichie »

IceWind wrote:One of the features of the RTH is point the head/tail home. For that the MAG is needed no?


Things may have changed recently but I thought on an Airplane(I think Eagle ODS), it used GPS for RTH. I really don't know how RTH on the MWC works.

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: MAG calibration - ISSUES

Post by nhadrian »

I tried many variations of orders, yaw-pitch-roll; yaw-pitch-roll to north then pitch-roll to west, etc...
Also I can notice that the bad calibration caused strange behaviours in headfree mode and circlaing in position hold.
So proper mag calibration is really important for those features!!!
Yesterday I tested with the HMC5843 and all the strange behaviours disappeared.

vpb
Posts: 231
Joined: Mon Jul 23, 2012 4:09 pm

Re: MAG calibration - ISSUES

Post by vpb »

IceWind wrote:One of the features of the RTH is point the head/tail home. For that the MAG is needed no?

As I remember, it uses MAG. I'll check that when RTH with MAG disabled.

User avatar
shikra
Posts: 783
Joined: Wed Mar 30, 2011 7:58 pm

Re: MAG calibration - ISSUES

Post by shikra »

Thanks for link!

That wasn't the one - but it does point out that you have to line it up with magnetic axis at your location for best results. Plus there is link through to a magnetic calculator. 66 degrees down for me.

The post I saw before described it quite well. Thought I'd give it a try and I could notice the difference on the GUI straight away after calibrating with the method. Much more accurate.

I only use it for PH / RTH so not that worried, but if can make it more accurate my calibrating differently then might as well...



IceWind wrote:Found this, does it ring a bell? Or was something different?

http://paparazzi.enac.fr/wiki/ImuCalibr ... gnetometer

AgusSantoso
Posts: 4
Joined: Wed Nov 28, 2012 4:44 am

Re: MAG calibration - ISSUES

Post by AgusSantoso »

i've just bought a multiwii SE v2.0 from hobby king, there's an error on my magnetometer,
the south and north direction are reversed, is there anyone can help me about that problem?
thanks before..

flyrobot
Posts: 73
Joined: Thu Apr 05, 2012 3:59 pm

Re: MAG calibration - ISSUES

Post by flyrobot »

AgusSantoso wrote:i've just bought a multiwii SE v2.0 from hobby king, there's an error on my magnetometer,
the south and north direction are reversed, is there anyone can help me about that problem?
thanks before..


P agus,

What firmware version do u use?
Make sure :
1. You choose right board on config.h
2. Calibrate the mag
3. No steel or cable power near mag sensor.

Hope it help.

John

doppler
Posts: 64
Joined: Wed Sep 26, 2012 1:35 pm

Re: MAG calibration - ISSUES

Post by doppler »

copterrichie wrote:
fiendie wrote:
copterrichie wrote:Correctly if I am mistaken here but having the Mag is basically good for Waypoints, Return to home and Navigation. I really don't understand the need to accuracy at this stage of the game.

What about Headhold and Headfree modes?


Heading Hold, I am not so sure about, I personally use the YAW PID and set the I value high, the Headfree mode is nice.


What is "high", mine is 0.250 and it's mostly holding YAW but still rotates clockwise from time to time. Headhold and headfree modes haven't been very successful either, too much magnetic interference from the motors I think.

Andrew

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: MAG calibration - ISSUES

Post by copterrichie »

doppler wrote:
Heading Hold, I am not so sure about, I personally use the YAW PID and set the I value high, the Headfree mode is nice.


What is "high", mine is 0.250 and it's mostly holding YAW but still rotates clockwise from time to time. Headhold and headfree modes haven't been very successful either, too much magnetic interference from the motors I think.

Andrew[/quote]

On my sweptback which is very close to a normal quad, I have P 9, I .030, D 6

tovrin
Posts: 705
Joined: Tue Sep 20, 2011 4:08 pm

Re: MAG calibration - ISSUES

Post by tovrin »

using default PIDS on my paris board with GY-86 (includes HMC5883L compass) i use headlock and it completely removes any yaw drift, which i see most of the time during low altitude aggressive playing (which i do a lot up and down my street, generally between 5-15 feet in the air).

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: MAG calibration - ISSUES

Post by Hamburger »

Heading hold would use very low p but higher i and d values.
The normal I becomes the P of heading hold
The normal D becomes the I of heading hold
We lack a D for heading hold so it is wobbly and not usable.

cardboard
Posts: 183
Joined: Tue Mar 15, 2011 9:40 am

Re: MAG calibration - ISSUES

Post by cardboard »

I had a similar issue with the mag being derp.
check this thread for my fix

viewtopic.php?f=6&t=2700

EDCKiwi
Posts: 2
Joined: Sun Dec 09, 2012 2:56 am

Re: MAG calibration - ISSUES

Post by EDCKiwi »

I bought the the MultiWii Pro Flight controller from Hobbyking. The mag seems to be 90 degrees out. Anyone seen this and have a fix?
I tried offsetting it in the code but all efforts failed, due today being the first time I have looked at the code and not knowing exactly where an offset should be included.
Thanks for any help.

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: MAG calibration - ISSUES

Post by Gimbal »

In sensors i guess.

#if defined(SENSORS_TILT_45DEG_LEFT)
int16_t temp = ((magADC[PITCH] - magADC[ROLL] )*7)/10;
magADC[ROLL] = ((magADC[ROLL] + magADC[PITCH])*7)/10;
magADC[PITCH] = temp;
#endif
#if defined(SENSORS_TILT_45DEG_RIGHT)
int16_t temp = ((magADC[PITCH] + magADC[ROLL] )*7)/10;
magADC[ROLL] = ((magADC[ROLL] - magADC[PITCH])*7)/10;
magADC[PITCH] = temp;
#endif

Post Reply