DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

A short explanation of compass function, calibration and errors.

The thread is about the compass, and is an important resource for people seeking to understand their compass.
But now the last 7 posts are about your map window and basic configuration of your phone.
No it makes no difference if you have no sim card.
You'll find Location Services in your phone settings.
The map window is relevant discussion as it’s used for checking that the nose position of the aircraft matches reality to determine if there’s been a compass and imu mismatch which would result in a yaw error (I’m certainly adding it to my checklists). In order for that check to be useful information people need to know how to get there to check it (cradle-to-grave principal of how to perform the relevant sanity check of aircraft displayed position to reality). Everyone on this forum has different levels of experience & knowledge and varying holes in said knowledge & experience. Given that many pilots are self-taught in their own vacuum and forums like these are their only connection to learn from others, they might not even use the same terms for things, or they may not have the same apps/equipment. I would advocate for using the ‘mother principal’ - is the explanation and directions something your mother could follow without you helping?

For myself, a consistent question I’ve had about the 2nd check - posts have established that it’s not available in the Fly app but is on the Go4 app, but there have not yet been instructions for finding it on the Go4 app (I still have more of this thread to read). Instructions and screen caps are WONDERFUL to provide primary personal instruction but also allow people to help someone else, e.g. like my 91 year old dad who will never use/read a forum like this and who I have to try to answer questions about his drone from 750 miles away. (He’s never had this specific issue, this is just my backhanded way of complementing and thanking the folks that have taken the extra time to answer various questions with detailed instructions and screen caps across these drone forums which have allowed me to find answers and walk him thru things overall. Sometimes, the relevance may not always be obvious but still exists and one will not always know how beneficial one’s post has been, nor to how many.)
 
BACKGROUND

The aircraft compass is often misunderstood, both in terms of function and purpose, but it is important to understand what the compass measures, why, and what happens to that information.

At the most basic level the purpose of the compass is to measure the earth’s magnetic field in order to find magnetic north relative to the aircraft heading. At any point near the earth the magnetic field is a single-valued vector quantity described by field strength and direction, and the compass comprises a 3-axis magnetometer aligned with the principal axes of the aircraft (x, y, z), independently measuring the local magnetic field components parallel to those axes.

THE EARTH’S MAGNETIC FIELD

The earth's core is magnetized due mostly to rotation, with magnetic north towards the North Pole and magnetic south towards the South Pole, although the two axes are not perfectly aligned.






In magnetic terms, the earth's north pole is actually a magnetic south pole, and the south pole a magnetic north pole, and so the magnetic field lines emanate from the magnetic south pole and return to the north pole in the classic bar magnet pattern, and so at any point on the surface of the earth the magnetic field lies at an angle to the ground, (except near the equator where it is approximately horizontal) called the inclination, and points towards the magnetic north pole.

Since the magnetic north pole and the geographic north pole are not in the same place there will, in general, be an angle between the horizontal component of the magnetic field lines (that point to magnetic north) and the direction of the geographic North Pole (true north). That angle varies by location since, as you look to the north, the apparent relative positions of magnetic north and true north depend on where you are. That offset is called the declination (or variation). So if you also know the declination (you have to know it based on your location since there is no way to measure it) then you can subtract the declination angle to determine where true north is.

Back to the compass - its only job is to determine the direction of magnetic north, and to do that it measures the direction (relative to the aircraft) of the horizontal component of the local magnetic field. If the only magnetic field that it saw were the earth's field then that would be trivial, but the aircraft, itself, has a magnetic field due to internal ferromagnetic components which will, in general, change the direction of horizontal component of the field.

Luckily, magnetic fields follow the Superposition Principle, which means that if two separate magnetic fields interact, the net field vector at any location is simply the vector sum of the individual fields. So, if the magnetic field of the aircraft can be independently measured then, with the assumption that it doesn't change as the aircraft moves around, it can simply be subtracted from the total magnetic field measured by the compass to leave just the earth's magnetic field.

COMPASS CALIBRATION

Measurement of the aircraft’s internal magnetic field at the compass location (it won’t be uniform throughout the aircraft) is achieved by the calibration process since, as the aircraft is rotated, the earth's magnetic field appears to rotate while the aircraft's magnetic field stays constant. The orthogonal rotations in the calibration process allow those two fields to be separated mathematically, and the FC now has the aircraft's magnetic field (the calibration) stored. It subtracts that from the measured field in flight, takes the horizontal component of the resulting field (now assumed to be just the earth's) and thus knows its heading relative to magnetic north.

CORRECTING TO GET TRUE NORTH

However, for navigation the FC needs the aircraft heading relative to true north, since that is the basis of the coordinate system for positioning, such as latitude/longitude. To calculate that heading it has to add the local declination value. There is a common misconception that somehow the calibration process determined declination but it should be obvious that it cannot do that. The orientation of our coordinate system is arbitrary relative to magnetic north and there is no way, as I mentioned above, to figure out the difference between true north and magnetic north with a compass; you have to know the declination separately by looking it up on a map, or calculating it approximately using spherical geometry and knowing the relative positions of the true north pole, the magnetic north pole and your location or, for the most accurate results, using your location with a global model of the earth's field.

The FC does the latter - it has a stored global magnetic field model in firmware and as soon as it gets a GPS position lock on startup it computes the declination (and inclination) from the model and adds the declination to the magnetic heading from the compass. Now it has true heading. That process is documented in the DAT file.

COMPASS INTERFERENCE

Note that all this assumes that there are no other magnetic fields present - only the earth's and the aircraft's. If there are other fields due to ferromagnetic structures, large or small, then the aircraft may or may not be able to detect their presence. The FC has field strength and magnetic field inclination criteria for acceptable measured magnetic field. On the M2, and quite possibly all the models, the total field strength is expected to be in the range 1400 - 1800 µT, as documented here and shown in the graph below. But beyond that, any local field potentially just changes the apparent direction of magnetic north and, if that error is significant, leads to all the common problems after takeoff.

View attachment 104335

The relationship between compass interference values and magnetic field strength.

Those flight problems are also not obvious in their origin - many people ask why, since very local magnetic interference will go away after takeoff, the problem only manifests afterwards during flight. The answer lies in the way that the FC actually computes heading (yaw). The primary yaw sensor in flight is not the compass - it is the rate gyros - i.e. the heading is primarily tracked inertially in flight, not magnetically. The IMU heading is initialized using the compass heading, before takeoff and after the declination has been computed. Once airborne the compass is only used to correct for drift in the rate gyro data. So if, after takeoff, the magnetic interference goes away, then the compass heading will change without the IMU ever detecting rotation of the aircraft, and the IMU and compass now disagree by far more than the drift correction algorithm can handle. That's the source of all the compass and yaw errors and, since the FC now doesn't know which way it is pointing, it cannot navigate and, unless it quickly switches to ATTI mode, will fly uncontrollably if it tries because it will try to correct for course or position deviations by applying thrust in the wrong direction. That has been the cause of almost all so-called “flyaways”. Any error over 30° or so can cause flight control problems, and anything over 45° will lead to loss of control. Around 90° leads to the classic toilet-bowl flight profile, while 180° causes a simple linear accelerating flight in exactly the wrong direction.

INTERFERENCE CORRECTION

I wondered for some time why DJI didn’t add some code to notice the compass change at takeoff from a magnetically distorted site. On takeoff, as the aircraft climbs out of the local interference but the rate gyros detect no rotation, the obvious correction is simply to re-initialized the IMU heading to the new compass heading. In fact they did exactly that with the second firmware upgrade to the Mavic 2, but previous models still don’t do that. It appears that the Mini and the Mavic Air 2 might have that functionality, but not yet confirmed.

There is also the question of "bad calibrations" - can they happen? I think there are a few scenarios in which that might occur. If the user is wearing something magnetic that may make it appear to be part of the aircraft's magnetic field. Or if the magnetic field is local enough to vary as the aircraft is rotated - that might have a similar effect.

COMPASS INTERFERENCE AND CALIBRATION MESSAGES

A persistently confusing issue is the well known message at power up: “Compass error. Move the aircraft or calibrate the compass.” It’s confusing because it often isn’t even accurate; it can mean several different things, a couple of which are not errors at all:
  1. The magnetic modulus (total magnetic field strength) is outside the expected bounds (error);
  2. The magnetic inclination is incorrect for the location (error);
  3. It is more than 30 days since the last compass calibration (M2 and newer models) - not an error - a firmware trigger;
  4. The aircraft is more than 50 km (30 miles) from its previous takeoff location - not an error - a firmware trigger.
(1) and (2) may be the result of local interference, in which case calibration is unnecessary, and moving the aircraft is appropriate. Or they may be the result of a change in the magnetic field of the aircraft itself, either due to components added/removed or components becoming magnetized due to exposure to a strong external magnetic field, in which case moving won’t help and calibration is required, or possibly even demagnetization of the aircraft.

To be fair to DJI, the causes of (1) and (2) cannot easily be distinguished and so the message is reasonable, but it would be much more helpful if (3) and (4) were explicitly spelled out with a different message.

The only way to be certain about what is going on and to establish whether it is safe to fly is:
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground;
  2. Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification.
(1) should be regarded as an essential pre-flight check - every flight. It would cut flyaways to nearly zero. But neither of those checks is recommended by DJI, which is rather unfortunate. If the app is going to recommend just one essential check before takeoff - it really should be the orientation arrow which is far more likely to be a problem than an incorrect home point.

If the magnetometer interference readings are high or the aircraft orientation arrow is incorrect then there is magnetic interference at the compass - either external or internal - and moving the aircraft or calibrating will be required. If the interference values are low and the arrow is correct then the message was due to (3) or (4). You can recalibrate as requested but the aircraft is good to fly, and you can actually ignore the message - it will go away on motor start, but come back on the next power up.

Of course the question still remains - why do some models request periodic recalibration? Previous models didn’t do that. Worse still, the user manuals for DJI aircraft have been completely random on the subject in the past - some recommended only calibrating when requested and some recommended calibrating when moving any significant distance. Time was not previously a stated reason. The distance recommendation led many people to assume, incorrectly, that it had something to do with compensating for magnetic declination, but of course that’s physically impossible. So it's currently unclear why this was implemented. It could be that the DJI engineers decided that transport was one common cause of exposure to magnetic fields, or that periodic calibration might help to keep the compass performing closer to nominal. There is certainly no obvious physics-based reason.
BACKGROUND

The aircraft compass is often misunderstood, both in terms of function and purpose, but it is important to understand what the compass measures, why, and what happens to that information.

At the most basic level the purpose of the compass is to measure the earth’s magnetic field in order to find magnetic north relative to the aircraft heading. At any point near the earth the magnetic field is a single-valued vector quantity described by field strength and direction, and the compass comprises a 3-axis magnetometer aligned with the principal axes of the aircraft (x, y, z), independently measuring the local magnetic field components parallel to those axes.

THE EARTH’S MAGNETIC FIELD

The earth's core is magnetized due mostly to rotation, with magnetic north towards the North Pole and magnetic south towards the South Pole, although the two axes are not perfectly aligned.






In magnetic terms, the earth's north pole is actually a magnetic south pole, and the south pole a magnetic north pole, and so the magnetic field lines emanate from the magnetic south pole and return to the north pole in the classic bar magnet pattern, and so at any point on the surface of the earth the magnetic field lies at an angle to the ground, (except near the equator where it is approximately horizontal) called the inclination, and points towards the magnetic north pole.

Since the magnetic north pole and the geographic north pole are not in the same place there will, in general, be an angle between the horizontal component of the magnetic field lines (that point to magnetic north) and the direction of the geographic North Pole (true north). That angle varies by location since, as you look to the north, the apparent relative positions of magnetic north and true north depend on where you are. That offset is called the declination (or variation). So if you also know the declination (you have to know it based on your location since there is no way to measure it) then you can subtract the declination angle to determine where true north is.

Back to the compass - its only job is to determine the direction of magnetic north, and to do that it measures the direction (relative to the aircraft) of the horizontal component of the local magnetic field. If the only magnetic field that it saw were the earth's field then that would be trivial, but the aircraft, itself, has a magnetic field due to internal ferromagnetic components which will, in general, change the direction of horizontal component of the field.

Luckily, magnetic fields follow the Superposition Principle, which means that if two separate magnetic fields interact, the net field vector at any location is simply the vector sum of the individual fields. So, if the magnetic field of the aircraft can be independently measured then, with the assumption that it doesn't change as the aircraft moves around, it can simply be subtracted from the total magnetic field measured by the compass to leave just the earth's magnetic field.

COMPASS CALIBRATION

Measurement of the aircraft’s internal magnetic field at the compass location (it won’t be uniform throughout the aircraft) is achieved by the calibration process since, as the aircraft is rotated, the earth's magnetic field appears to rotate while the aircraft's magnetic field stays constant. The orthogonal rotations in the calibration process allow those two fields to be separated mathematically, and the FC now has the aircraft's magnetic field (the calibration) stored. It subtracts that from the measured field in flight, takes the horizontal component of the resulting field (now assumed to be just the earth's) and thus knows its heading relative to magnetic north.

CORRECTING TO GET TRUE NORTH

However, for navigation the FC needs the aircraft heading relative to true north, since that is the basis of the coordinate system for positioning, such as latitude/longitude. To calculate that heading it has to add the local declination value. There is a common misconception that somehow the calibration process determined declination but it should be obvious that it cannot do that. The orientation of our coordinate system is arbitrary relative to magnetic north and there is no way, as I mentioned above, to figure out the difference between true north and magnetic north with a compass; you have to know the declination separately by looking it up on a map, or calculating it approximately using spherical geometry and knowing the relative positions of the true north pole, the magnetic north pole and your location or, for the most accurate results, using your location with a global model of the earth's field.

The FC does the latter - it has a stored global magnetic field model in firmware and as soon as it gets a GPS position lock on startup it computes the declination (and inclination) from the model and adds the declination to the magnetic heading from the compass. Now it has true heading. That process is documented in the DAT file.

COMPASS INTERFERENCE

Note that all this assumes that there are no other magnetic fields present - only the earth's and the aircraft's. If there are other fields due to ferromagnetic structures, large or small, then the aircraft may or may not be able to detect their presence. The FC has field strength and magnetic field inclination criteria for acceptable measured magnetic field. On the M2, and quite possibly all the models, the total field strength is expected to be in the range 1400 - 1800 µT, as documented here and shown in the graph below. But beyond that, any local field potentially just changes the apparent direction of magnetic north and, if that error is significant, leads to all the common problems after takeoff.

View attachment 104335

The relationship between compass interference values and magnetic field strength.

Those flight problems are also not obvious in their origin - many people ask why, since very local magnetic interference will go away after takeoff, the problem only manifests afterwards during flight. The answer lies in the way that the FC actually computes heading (yaw). The primary yaw sensor in flight is not the compass - it is the rate gyros - i.e. the heading is primarily tracked inertially in flight, not magnetically. The IMU heading is initialized using the compass heading, before takeoff and after the declination has been computed. Once airborne the compass is only used to correct for drift in the rate gyro data. So if, after takeoff, the magnetic interference goes away, then the compass heading will change without the IMU ever detecting rotation of the aircraft, and the IMU and compass now disagree by far more than the drift correction algorithm can handle. That's the source of all the compass and yaw errors and, since the FC now doesn't know which way it is pointing, it cannot navigate and, unless it quickly switches to ATTI mode, will fly uncontrollably if it tries because it will try to correct for course or position deviations by applying thrust in the wrong direction. That has been the cause of almost all so-called “flyaways”. Any error over 30° or so can cause flight control problems, and anything over 45° will lead to loss of control. Around 90° leads to the classic toilet-bowl flight profile, while 180° causes a simple linear accelerating flight in exactly the wrong direction.

INTERFERENCE CORRECTION

I wondered for some time why DJI didn’t add some code to notice the compass change at takeoff from a magnetically distorted site. On takeoff, as the aircraft climbs out of the local interference but the rate gyros detect no rotation, the obvious correction is simply to re-initialized the IMU heading to the new compass heading. In fact they did exactly that with the second firmware upgrade to the Mavic 2, but previous models still don’t do that. It appears that the Mini and the Mavic Air 2 might have that functionality, but not yet confirmed.

There is also the question of "bad calibrations" - can they happen? I think there are a few scenarios in which that might occur. If the user is wearing something magnetic that may make it appear to be part of the aircraft's magnetic field. Or if the magnetic field is local enough to vary as the aircraft is rotated - that might have a similar effect.

COMPASS INTERFERENCE AND CALIBRATION MESSAGES

A persistently confusing issue is the well known message at power up: “Compass error. Move the aircraft or calibrate the compass.” It’s confusing because it often isn’t even accurate; it can mean several different things, a couple of which are not errors at all:
  1. The magnetic modulus (total magnetic field strength) is outside the expected bounds (error);
  2. The magnetic inclination is incorrect for the location (error);
  3. It is more than 30 days since the last compass calibration (M2 and newer models) - not an error - a firmware trigger;
  4. The aircraft is more than 50 km (30 miles) from its previous takeoff location - not an error - a firmware trigger.
(1) and (2) may be the result of local interference, in which case calibration is unnecessary, and moving the aircraft is appropriate. Or they may be the result of a change in the magnetic field of the aircraft itself, either due to components added/removed or components becoming magnetized due to exposure to a strong external magnetic field, in which case moving won’t help and calibration is required, or possibly even demagnetization of the aircraft.

To be fair to DJI, the causes of (1) and (2) cannot easily be distinguished and so the message is reasonable, but it would be much more helpful if (3) and (4) were explicitly spelled out with a different message.

The only way to be certain about what is going on and to establish whether it is safe to fly is:
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground;
  2. Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification.
(1) should be regarded as an essential pre-flight check - every flight. It would cut flyaways to nearly zero. But neither of those checks is recommended by DJI, which is rather unfortunate. If the app is going to recommend just one essential check before takeoff - it really should be the orientation arrow which is far more likely to be a problem than an incorrect home point.

If the magnetometer interference readings are high or the aircraft orientation arrow is incorrect then there is magnetic interference at the compass - either external or internal - and moving the aircraft or calibrating will be required. If the interference values are low and the arrow is correct then the message was due to (3) or (4). You can recalibrate as requested but the aircraft is good to fly, and you can actually ignore the message - it will go away on motor start, but come back on the next power up.

Of course the question still remains - why do some models request periodic recalibration? Previous models didn’t do that. Worse still, the user manuals for DJI aircraft have been completely random on the subject in the past - some recommended only calibrating when requested and some recommended calibrating when moving any significant distance. Time was not previously a stated reason. The distance recommendation led many people to assume, incorrectly, that it had something to do with compensating for magnetic declination, but of course that’s physically impossible. So it's currently unclear why this was implemented. It could be that the DJI engineers decided that transport was one common cause of exposure to magnetic fields, or that periodic calibration might help to keep the compass performing closer to nominal. There is certainly no obvious physics-based reason.
Dear Sir

I found your explanation about magnetic fields and flyaways very correct and interesting. I have an additional theory that I would like to discuss with you about another possible cause of flyaways. Keep in mind that the IMU contains MEMS gyroscopes and accelerometers, these are micro-mechanical electronic components. The aircraft engines produce vibrations in the structure, and in certain scenarios can cause a vibration frequency phase-in and shock the IMU's accelerometers and gyroscopes. For this reason, flyaways disappeared from YouTube videos starting with the DJI Phantom 3 model, since this model and its successors designed an IMU isolation system using rubber dumpers. What do you think of my theory?

I have noticed that DJI has abandoned the dual IMU and dual compass system, eliminating the redundancy of this important system in a drone, and the problems of drunken horizons and cases of flyaway are occurring again in this model. There is also no data in the BIAS App of the IMU and the compass. I don't understand why DJI has done this on a $5000 drone.

I would also like to know your opinion about the drunk horizon problem in some DJI units.

Best Regards
Alex GH
 
For this reason, flyaways disappeared from YouTube videos starting with the DJI Phantom 3
I think that using "flyaway" videos on YouTube has given you false impression.
Almost all are cases of operator confusion and not an indication of a hardware issue.
Actual fly away incidents are (and always have been) very rare.
 
Last edited:
I enjoyed your well-written and concise insight into compass and IMU. Bravo!

My A2s w/ RC Pro asked for compass calibration before first flight.

I am adding your no. 1 to my pre-flight checklist, as follows.

Many thanks!
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground
 
  • Like
Reactions: sar104
BACKGROUND

The aircraft compass is often misunderstood, both in terms of function and purpose, but it is important to understand what the compass measures, why, and what happens to that information.

At the most basic level the purpose of the compass is to measure the earth’s magnetic field in order to find magnetic north relative to the aircraft heading. At any point near the earth the magnetic field is a single-valued vector quantity described by field strength and direction, and the compass comprises a 3-axis magnetometer aligned with the principal axes of the aircraft (x, y, z), independently measuring the local magnetic field components parallel to those axes.

THE EARTH’S MAGNETIC FIELD

The earth's core is magnetized due mostly to rotation, with magnetic north towards the North Pole and magnetic south towards the South Pole, although the two axes are not perfectly aligned.






In magnetic terms, the earth's north pole is actually a magnetic south pole, and the south pole a magnetic north pole, and so the magnetic field lines emanate from the magnetic south pole and return to the north pole in the classic bar magnet pattern, and so at any point on the surface of the earth the magnetic field lies at an angle to the ground, (except near the equator where it is approximately horizontal) called the inclination, and points towards the magnetic north pole.

Since the magnetic north pole and the geographic north pole are not in the same place there will, in general, be an angle between the horizontal component of the magnetic field lines (that point to magnetic north) and the direction of the geographic North Pole (true north). That angle varies by location since, as you look to the north, the apparent relative positions of magnetic north and true north depend on where you are. That offset is called the declination (or variation). So if you also know the declination (you have to know it based on your location since there is no way to measure it) then you can subtract the declination angle to determine where true north is.

Back to the compass - its only job is to determine the direction of magnetic north, and to do that it measures the direction (relative to the aircraft) of the horizontal component of the local magnetic field. If the only magnetic field that it saw were the earth's field then that would be trivial, but the aircraft, itself, has a magnetic field due to internal ferromagnetic components which will, in general, change the direction of horizontal component of the field.

Luckily, magnetic fields follow the Superposition Principle, which means that if two separate magnetic fields interact, the net field vector at any location is simply the vector sum of the individual fields. So, if the magnetic field of the aircraft can be independently measured then, with the assumption that it doesn't change as the aircraft moves around, it can simply be subtracted from the total magnetic field measured by the compass to leave just the earth's magnetic field.

COMPASS CALIBRATION

Measurement of the aircraft’s internal magnetic field at the compass location (it won’t be uniform throughout the aircraft) is achieved by the calibration process since, as the aircraft is rotated, the earth's magnetic field appears to rotate while the aircraft's magnetic field stays constant. The orthogonal rotations in the calibration process allow those two fields to be separated mathematically, and the FC now has the aircraft's magnetic field (the calibration) stored. It subtracts that from the measured field in flight, takes the horizontal component of the resulting field (now assumed to be just the earth's) and thus knows its heading relative to magnetic north.

CORRECTING TO GET TRUE NORTH

However, for navigation the FC needs the aircraft heading relative to true north, since that is the basis of the coordinate system for positioning, such as latitude/longitude. To calculate that heading it has to add the local declination value. There is a common misconception that somehow the calibration process determined declination but it should be obvious that it cannot do that. The orientation of our coordinate system is arbitrary relative to magnetic north and there is no way, as I mentioned above, to figure out the difference between true north and magnetic north with a compass; you have to know the declination separately by looking it up on a map, or calculating it approximately using spherical geometry and knowing the relative positions of the true north pole, the magnetic north pole and your location or, for the most accurate results, using your location with a global model of the earth's field.

The FC does the latter - it has a stored global magnetic field model in firmware and as soon as it gets a GPS position lock on startup it computes the declination (and inclination) from the model and adds the declination to the magnetic heading from the compass. Now it has true heading. That process is documented in the DAT file.

COMPASS INTERFERENCE

Note that all this assumes that there are no other magnetic fields present - only the earth's and the aircraft's. If there are other fields due to ferromagnetic structures, large or small, then the aircraft may or may not be able to detect their presence. The FC has field strength and magnetic field inclination criteria for acceptable measured magnetic field. On the M2, and quite possibly all the models, the total field strength is expected to be in the range 1400 - 1800 µT, as documented here and shown in the graph below. But beyond that, any local field potentially just changes the apparent direction of magnetic north and, if that error is significant, leads to all the common problems after takeoff.

View attachment 104335

The relationship between compass interference values and magnetic field strength.

Those flight problems are also not obvious in their origin - many people ask why, since very local magnetic interference will go away after takeoff, the problem only manifests afterwards during flight. The answer lies in the way that the FC actually computes heading (yaw). The primary yaw sensor in flight is not the compass - it is the rate gyros - i.e. the heading is primarily tracked inertially in flight, not magnetically. The IMU heading is initialized using the compass heading, before takeoff and after the declination has been computed. Once airborne the compass is only used to correct for drift in the rate gyro data. So if, after takeoff, the magnetic interference goes away, then the compass heading will change without the IMU ever detecting rotation of the aircraft, and the IMU and compass now disagree by far more than the drift correction algorithm can handle. That's the source of all the compass and yaw errors and, since the FC now doesn't know which way it is pointing, it cannot navigate and, unless it quickly switches to ATTI mode, will fly uncontrollably if it tries because it will try to correct for course or position deviations by applying thrust in the wrong direction. That has been the cause of almost all so-called “flyaways”. Any error over 30° or so can cause flight control problems, and anything over 45° will lead to loss of control. Around 90° leads to the classic toilet-bowl flight profile, while 180° causes a simple linear accelerating flight in exactly the wrong direction.

INTERFERENCE CORRECTION

I wondered for some time why DJI didn’t add some code to notice the compass change at takeoff from a magnetically distorted site. On takeoff, as the aircraft climbs out of the local interference but the rate gyros detect no rotation, the obvious correction is simply to re-initialized the IMU heading to the new compass heading. In fact they did exactly that with the second firmware upgrade to the Mavic 2, but previous models still don’t do that. It appears that the Mini and the Mavic Air 2 might have that functionality, but not yet confirmed.

There is also the question of "bad calibrations" - can they happen? I think there are a few scenarios in which that might occur. If the user is wearing something magnetic that may make it appear to be part of the aircraft's magnetic field. Or if the magnetic field is local enough to vary as the aircraft is rotated - that might have a similar effect.

COMPASS INTERFERENCE AND CALIBRATION MESSAGES

A persistently confusing issue is the well known message at power up: “Compass error. Move the aircraft or calibrate the compass.” It’s confusing because it often isn’t even accurate; it can mean several different things, a couple of which are not errors at all:
  1. The magnetic modulus (total magnetic field strength) is outside the expected bounds (error);
  2. The magnetic inclination is incorrect for the location (error);
  3. It is more than 30 days since the last compass calibration (M2 and newer models) - not an error - a firmware trigger;
  4. The aircraft is more than 50 km (30 miles) from its previous takeoff location - not an error - a firmware trigger.
(1) and (2) may be the result of local interference, in which case calibration is unnecessary, and moving the aircraft is appropriate. Or they may be the result of a change in the magnetic field of the aircraft itself, either due to components added/removed or components becoming magnetized due to exposure to a strong external magnetic field, in which case moving won’t help and calibration is required, or possibly even demagnetization of the aircraft.

To be fair to DJI, the causes of (1) and (2) cannot easily be distinguished and so the message is reasonable, but it would be much more helpful if (3) and (4) were explicitly spelled out with a different message.

The only way to be certain about what is going on and to establish whether it is safe to fly is:
  1. Check the aircraft orientation arrow on the map - it should be pointing in the same cardinal direction as the aircraft on the ground;
  2. Check the magnetometer interference values in the app - if they are low (green) then the magnetometer readings are within specification.
(1) should be regarded as an essential pre-flight check - every flight. It would cut flyaways to nearly zero. But neither of those checks is recommended by DJI, which is rather unfortunate. If the app is going to recommend just one essential check before takeoff - it really should be the orientation arrow which is far more likely to be a problem than an incorrect home point.

If the magnetometer interference readings are high or the aircraft orientation arrow is incorrect then there is magnetic interference at the compass - either external or internal - and moving the aircraft or calibrating will be required. If the interference values are low and the arrow is correct then the message was due to (3) or (4). You can recalibrate as requested but the aircraft is good to fly, and you can actually ignore the message - it will go away on motor start, but come back on the next power up.

Of course the question still remains - why do some models request periodic recalibration? Previous models didn’t do that. Worse still, the user manuals for DJI aircraft have been completely random on the subject in the past - some recommended only calibrating when requested and some recommended calibrating when moving any significant distance. Time was not previously a stated reason. The distance recommendation led many people to assume, incorrectly, that it had something to do with compensating for magnetic declination, but of course that’s physically impossible. So it's currently unclear why this was implemented. It could be that the DJI engineers decided that transport was one common cause of exposure to magnetic fields, or that periodic calibration might help to keep the compass performing closer to nominal. There is certainly no obvious physics-based reason.
Brilliantly written!!
 
  • Like
Reactions: sar104
Thanks to your very clear explanation I feel that I finally understand compass calibration. It seems likely that my old Mavic 1 required frequent calibration due to firmware inadequacies, but my M3 never requires calibration. I will be sure to check the compass direction on my map as I initialize flight as part of my SOP.
 
  • Like
Reactions: sar104
In a different life, the time/distance associated with compass calibration (or what I would call a compass swing) was to compensate for changes to the local magnetic field, the aircraft magnetic field and/or to acknowledge that the compass itself like any moving part, needs periodic inspection/verification after use in the "harsh aviation environment."
Totally agree. Part of our checklist when returning an aircraft to service after inspections, was to swing the compass utilizing a compass rose on the tarmac.
 
Hi Sar104,
I was sitting on the throne reading your well written “Compass”editorial, I fell asleep and found my self on the floor, but don’t worry Im OK. I Calibrated my compass and all is well.
In all seriousness, your Compass article was excellent and after reading it, I have added an item to my Pre Takeoff checklist.
B52-D
Blue Skys and Happy Contrails ➿
1668613867986.png
 
  • Like
Reactions: sar104
I'm glad I found this explanation and what to look for when getting ready to fly! I've had strange problems with multiple drones, M2Pro, Mini 3 Pro, Phantom 3 Pro when flying at my sons building site. I stay away from all building materials and a container that is on site. Fly from a gravel turnaround on his property.

I get all sorts of strange errors on all the drones. Nothing consistent: IMU, compass, Main Controller Data Errors. But, why I fly at my home, 40 miles west, zero problems. I can't replicate any of these that happen at my sons property.
Keep all the firmware on drones and batteries as well as the flysafe databases current.

Also, used an app called Physics Toolbox and checked both properties for magnetic issues, both properties were about the same in the 46 uT range

Since the area that his property is on was once mined for coal and minerals, could that be causing all the issues? Any suggestions on how to avoid these issues.
 
I've had strange problems with multiple drones, M2Pro, Mini 3 Pro, Phantom 3 Pro when flying at my sons building site. I stay away from all building materials and a container that is on site.

I get all sorts of strange errors on all the drones. Nothing consistent: IMU, compass, Main Controller Data Errors.

Since the area that his property is on was once mined for coal and minerals, could that be causing all the issues? Any suggestions on how to avoid these issues.
It's not possible to say much without more information to understand what the problems were and seeing the data from the problem flights.
It sounds very unusual, and it's hard to believe that the geographic location could cause so many problems..
 
I looked at all my data and there is no consistency that would allow a decent analysis. I was just wondering if anyone had experienced strange anomalies and found a way to work around them.

I think it is some sort of magnetic interference and think the next time I go there, I will not fly from the gravel drive but move over to a grassy area, still on the property. That area is away from everything metal and there is no gravel.

Appreciate the response.
 
Since the area that his property is on was once mined for coal and minerals, could that be causing all the issues?
Possibly.

You could download phyphox into your phone and look at the magnetometer readings as you slowly move it around landing sites to see if there are any anomalies.


The banded iron deposits in Michigan were discovered when a surveyor noticed that his compass was pointing 90° off, so certainly some minerals can affect the compass quite a bit. There might also be buried iron or steel equipment.

Another option would be taking off from a table or milk crate — something to put the drone above the ground. Or hand-launch, if you're up for that (I'm not, but many swear by it). Magnetic field strength drops as the square of the distance (twice the distance is a quarter the strength), so it shouldn't take much distance to have an effect.
 
  • Like
Reactions: RodPad
Appreciate both of your feedback. I'll download the app and try it next week when I go over. Will also try launching from something, non metallic to see what happens.

I forgot to mention in my original post that my Mini 3 Pro was loosing connection at ~95' up and ~ 200' away today. Nothing in between it and myself. It is normally a rock solid device and worked perfectly when I came back home.
What I will do is start a new thread after I go over and try again next week if I have something interesting. I will also contact my son, who has a degree in geology and see what suggestions he has on interference.

Appreciate the feedback from all.
 
I forgot to mention in my original post that my Mini 3 Pro was loosing connection at ~95' up and ~ 200' away today.
That's not magnetic interference from a ground deposit.

Assuming you've flown in many locations, and this only happens at one, my guess would be that there's a source of powerful EM interference nearby. Has to be active, not passive. Is there industrial equipment in the area?
 
Possibly.

You could download phyphox into your phone and look at the magnetometer readings as you slowly move it around landing sites to see if there are any anomalies.


The banded iron deposits in Michigan were discovered when a surveyor noticed that his compass was pointing 90° off, so certainly some minerals can affect the compass quite a bit. There might also be buried iron or steel equipment.

Another option would be taking off from a table or milk crate — something to put the drone above the ground. Or hand-launch, if you're up for that (I'm not, but many swear by it). Magnetic field strength drops as the square of the distance (twice the distance is a quarter the strength), so it shouldn't take much distance to have an effect.
That looks like fun app!
I was going to say go out there with a standard compass and walk around.👌

Rod
 
Well, spent some time looking for cell towers, radio or TV towers and nothing close. His property is 20 acres out in the country. Only things around are others with similar sized plots. Also looked for HAM towers and repeaters and didn't see anything. There is a small grass airstrip a few miles away, but no control tower.
Also, I've been flying out there for months and not had issues like this, so will continue to try and figure out what has changed.
Appreciate the feedback!
 

Attachments

  • Image 4-14-23 at 3.37 PM.jpeg
    Image 4-14-23 at 3.37 PM.jpeg
    770.1 KB · Views: 5
Well, spent some time looking for cell towers, radio or TV towers and nothing close. His property is 20 acres out in the country. ... Also looked for HAM towers and repeaters and didn't see anything. There is a small grass airstrip a few miles away, but no control tower.
None of those things would be expected to cause flight problems.Youwould be better trying to identify the actual issues than searching for some mystery external influence.
 
  • Like
Reactions: RodPad
"I get all sorts of strange errors on all the drones. Nothing consistent: IMU, compass, Main Controller Data Errors. But, why I fly at my home, 40 miles west, zero problems. I can't replicate any of these that happen at my sons property.
Keep all the firmware on drones and batteries as well as the flysafe databases current."

Your last post #117, I was ready to post it is not a RF problem it is a magnetic problem.

Then I saw this.
"Also, I've been flying out there for months and not had issues like this, so will continue to try and figure out what has changed."

You really got my attention now, you got to let us know.
The thing I don't like, is making this thread longer...

Anyways

Rod
 
  • Like
Reactions: Cadillac2012
I’ll go back next week and see what happens. I’ve got over 300 flights over the past years, so a bit embarrassed not understanding this yet. But, will post when I have more data.
 
  • Like
Reactions: RodPad
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
131,122
Messages
1,560,038
Members
160,095
Latest member
magic31