MAG Calibration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MAG Calibration

2,145 Views
a8Chcx
Contributor V

Hi Mike,

 

I have some questions about MAG calibration:

I am using Version 5.0 to do MAG calibration. We installed the compass module on our system and our system will be installed on top od vehicle. Before we install the system on top of vehicle, we can calibrate it by 3-axis movement and get 10 point resolved and 5% error fit. It works fine.

After the system is installed on top of vehicle, we can only move elevation(pitch) in 90 degrees, and Azimuth(YAW) in 360 degrees.

1) We move elevation up to certain angle and make the compass module leveled, then we read heading.

2) Can I move elevation up to certain angle and move azimuth(YAW) in full range(0~~360 degrees) to do the MAG calibration? a) If so, can I use 4-point, 7-point or 10-point and error fit rate to decide if it is OK or not? b) How long do I need to move in YAW?

3) If I know NORTH, EAST, SOUTH, and WEST when I do MAG calibration, is there a simple way to calibrate MAG?

 

Thanks,

 

Christie

Labels (1)
0 Kudos
15 Replies

1,571 Views
a8Chcx
Contributor V

Hi Mike,

When I applied the permanent MAG around MAG senor, I can see the heading is off a lot.

When I am trying to calibration the magnetic heading by turning 3 axes, I can't bring the heading back to normal value.

Could you tell me if I can calibrate the heading to be right again in the MAG interfered environment? Why?

Thanks,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

Is the magnetic field from the magnet within the dynamic range of the sensor?  If not, there's nothing you can do.

Is the magnet fixed spatially with respect to the sensor?  If not, there's nothing you can do. 

I suspect you've violated one or both of these constraints.

See Chapter 11, Theory: hard and soft iron magnetic compensation in the V7.00 user guide to understand why.

Mike

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

I am trying to figure out MAG interference strength. I checked FXOS8700CQ, the MAG sensing range is +/-1200uT. Then I am using Sensor Tab to check, it is much smaller than this. Do you think that I checked wrong place? How can see the raw data from MAG? I just put the screw driver around sensor to cause the interference...

What is MAG range for normal MAG field? There is possible way to say there is big interference? In Toolbox. it shows the MAG interference in RED, what kind of threshold is based on?

Thanks,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

It sounds like you are violating the 2nd constraint I gave you above.  You cannot calibrate out interference in which the source of interference (your screwdriver) moves with respect to the sensor.  It's a fundamental limitation of the physics.  This is explained in the reference I gave you earlier.  Please take the time to read and understand it.  It will help you to develope a more intuitive understanding of the physics involved, and thereby the limitations of the software.

Mike

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

I am trying to put my screw driver around my sensor. I can see big MAG interference on RED bar. Then I turn the board, but not moving screw driver, I can't calibrate to working status...

Maybe, it violate the first condition? Where can I see the raw MAG data?

Do you want to have any data to figure out the reason?

Thanks,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

You are definitely violating the 2nd condition by moving the board, but not the screwdriver relative to it.  They MUST move together, as if they were part of one rigid body, for magnetic calibration to do it's job.

We don't display raw magnetic data in the GUI.  You'll have to use a debugger or instrument your own to see that.  But exceeding the sensor range is certainly not your problem.  

Mike

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

Thanks. I am going to try to move together to see if it can be calibrated?

The RED MAG interference bar that shows MAG interference on Tool Box is based on what conditions?

Is it possible to tell there is big MAG interference based on MAG raw data, like earth MAG field will be smaller than certain uT in X, Y, Z axis?

Sorry for asking you too many questions...

Regards,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

The GUI code for the mag interference bar is essentially:

MagDeviation = Math.Sqrt(Mag[X] * Mag[X] + Mag[Y] * Mag[Y] + Mag[Z] * Mag[Z]) - B;

// Main tab magnetic interference

if (Math.Abs(MagDeviation) < 0.5 * B / 7.0)

textBoxMagInterference.Width = 0;

else if (Math.Abs(MagDeviation) > 4.0 * B / 7.0)

textBoxMagInterference.Width = 180;

else

textBoxMagInterference.Width = (Int32)((Math.Abs(MagDeviation) - 0.5 * B / 7.0) / (3.5 * B / 7.0) * 180.0);

The textbar width calculations are heuristic.  Basicially, it is just looking for variation from expected constant amplitude of the calibrated magnetometer.  You need to use calibration outputs, as precalibrated values may be distorted too much.

Mike

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

I'm sure you already understand that the calibration before you put the DUT on the vehicle will be rendered useless once you install the device.  It's not a question of "how long" do you do calibration, but how many points, and with how much diversity of the measured vectors about the magnetic ellipsoid.  More of both is always better.  If you know the actual direction for a given measurement, you could toss in the difference as a fudge factor, which would probably help.  Again, probably nothing you haven't already thought about.

Fit errors need to be used with caution.  a 3% fit error using a 7 element model may not be as good as a 4% fit error with a 10 element model.  The latter will tend to use more points in the fitting process, which can naturally increase the apparent error.  Think of it this way, you know you can do a 100% match to 3 points with a polynomial fit.  But the actual function might be better represented with a straight line.  At the end of the day, whatever solution you choose should be validated using a lot of different device orientations.

Mike

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

I can only move in azimuth (0~~360) when the compass module leveled. and I read the heading at the leveled position as well. What you are saying is possible to get the MAG calibration done properly.

Do you have any idea how to use pre-defined 4 directions to make the calibration easier and better?

Thanks,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

I suppose it depends on what the residual error looks like.  If a simple rotation, the best you can do is measure the calibrated compass heading at those four points, compute the average error from known heading, and then use that as your fudge factor.  If you have unresolved ellipsoid distortion, you could try an additional fit using your 4 known points.

Remember that vehicle slope relative to gravity (road grade) effects computations.  These can be up to 8 to 15% depending upon local road construction standards.  If you only gather data on a flat surface, you'll only be correcting a "slice" of the 3D ellipsoid space.  This is a fundamental limitation, and I assume the reason that my car's compass only gives me heading to about 45 degrees resolution (N, NE, E, SE, S, SW, W, NW).

Also, every vehicle will have different properties.  The value YOU bring to the party is gathering data and determining the best approach for your application.

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

I tried to calibrate MAG by turning in 3D dimension. I found that it can't get 7/10 point resolved, only can pass 4-point sometime. Is it something wrong for starting data? What is the conditions to be met for good MAG calibration?

Thanks,

Christie

0 Kudos

1,571 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

The Version 5.00 code at issue is in file magnetic.c, function fRunMagCalibration().  You'll see an if-else structure where it sequences through the solvers, as well as a final acceptance test based on fit error and whether the computed magnetic field is within a reasonable range.  You'll need to monitor the various parameters in your debugger to see what is holding things up.

Mike

0 Kudos

1,571 Views
a8Chcx
Contributor V

Hi Mike,

What you are saying is there is some issues in magnetic.c and it should get 7-points and 10-points if I am turning the board in 3-D dimension.

What is the possible reason if there is some issues?

Or it can be in 4-points only based on the condition I am running at?

How good is it if I am just running on 4-points?

Regards,

Christie

0 Kudos

1,572 Views
michaelestanley
NXP Employee
NXP Employee

Christie,

What I'm saying is that the strategy for applying the various magnetic calibration functions is encoded in function fRunMagCalibration.   If you are not getting satisfactory results (look at the magnetic tab in the sensor fusion toolbox to determine how good your magnetic sphere looks), then this is the function to start digging into.  it is always possible that you might want to encode a slightly different strategy.  The stuff in fRunMagCalibration is heuristic in nature, so it's OK to make adjustments to better fit your system.

Mike

0 Kudos