Using MAVLink Inspector to Compare Dual Magnetometer Health
Objective
Use Mission Planner's MAVLink Inspector to compare the outputs from two onboard magnetometers and identify:
- Compass disagreement
- Magnetic interference
- Excessive noise
- Calibration issues
- Potential sensor failures
The goal is not to prove that either compass is perfectly accurate, but rather to verify that both compasses are reporting similar magnetic field measurements and that the EKF is not detecting significant disagreement between them.
Equipment
- Aircraft powered and stationary
- Mission Planner connected to the flight controller
- Adequate GPS lock and EKF initialization
- Aircraft positioned away from large metal objects, vehicles, tools, or reinforced concrete structures whenever possible
Procedure
1. Open MAVLink Inspector
In Mission Planner:
Flight Data
↓
Ctrl+F
↓
MAVLink Inspector
The Inspector window displays live MAVLink messages broadcast by the flight controller.
2. Locate Compass Data
Expand the available sensor messages.
Depending on the flight controller and firmware version, compass data may appear within:
RAW_IMU
SCALED_IMU
SCALED_IMU2
SCALED_IMU3
Look for magnetic field values such as:
xmag
ymag
zmag
Example:
Compass 1
xmag = 245
ymag = -112
zmag = 387
Compass 2
xmag = 251
ymag = -108
zmag = 391
Exact values are not expected to match perfectly.
3. Enable Graphing
Select or graph the corresponding magnetic-field components from both compasses.
Example:
Compass1.X
Compass2.X
or
Compass1.Z
Compass2.Z
Plot only one axis initially to simplify interpretation.
The graph should show both values updating continuously.
4. Perform a Slow Yaw Rotation
Slowly rotate the aircraft through approximately 360 degrees of yaw.
Observe the graph during the rotation.
Normal behavior:
Compass1 /\/\/\/\/\
Compass2 /\/\/\/\/\
Both traces should follow a similar pattern and remain generally aligned.
Small offsets are normal.
5. Perform Pitch and Roll Movements
Slowly tilt the aircraft:
- Nose Up
- Nose Down
- Left Roll
- Right Roll
Observe whether both compass signals respond similarly.
The magnitude and shape of the response should be comparable.
Interpreting Results
Healthy Compass Agreement
Indicators:
- Similar graph shapes
- Similar amplitudes
- Smooth signal transitions
- Stable values when motion stops
Example:
Compass1 X = 320
Compass2 X = 305
Small differences like this are normal.
Result:
- ✅ Good agreement
- ✅ No obvious interference
- ✅ Sensors likely operating correctly
Moderate Compass Disagreement
Indicators:
- Similar shape
- Noticeable offset
- Increased noise on one compass
Example:
Compass1 X = 300
Compass2 X = 250
while rotating.
Possible causes:
- Imperfect calibration
- Minor local interference
- Mounting differences
Result:
- ⚠ Requires further observation but may still be acceptable.
Significant Compass Disagreement
Indicators:
- Different graph shapes
- Large value separation
- Sudden spikes
- One compass reacting differently than the other
Examples:
Compass1 X = 310
Compass2 X = 900
or
Compass1 = smooth
Compass2 = noisy and erratic
Possible causes:
- Magnetic interference
- Failed compass
- Wiring problem
- Improper orientation configuration
- Corrupted calibration
Result:
- ❌ Troubleshooting required
Look for EKF Warnings
While performing the test, monitor:
Messages Tab
for warnings such as:
Compass Variance
EKF Variance
EKF Lane Switch
Compass Failure
These warnings indicate the flight controller detects disagreement between compass measurements.
In practical terms, the EKF's opinion is often more important than the raw magnetometer numbers themselves.
Additional Validation
After completing the test:
Flight Data
↓
Status
Monitor:
yaw
heading
Perform another slow 360-degree rotation.
Verify:
- Heading changes smoothly
- Heading remains stable when stationary
- No sudden jumps occur
Unexpected heading jumps often indicate that the EKF is switching between compasses or rejecting one of them.
Practical Acceptance Criteria
For routine flight-line checks, the onboard compasses can generally be considered healthy when:
- Both magnetometers update continuously.
- Both traces follow similar patterns during movement.
- No abnormal noise or spikes are observed.
- No Compass Variance or EKF warnings are present.
- Heading remains smooth and stable throughout a full aircraft rotation.
For a flight technician, this is essentially the compass equivalent of comparing two GPS receivers. You are less concerned with the absolute raw number and more concerned that both sensors "see the world" the same way. When two compasses agree with each other and the EKF is happy, the magnetometer system is usually performing correctly.