Compass calibration is the procedure that measures the magnetic distortions caused by the aircraft itself and stores correction values so that the magnetometer reports an accurate heading. In drones, it is a core part of navigation & sensors, because the flight controller combines the compass heading with GNSS position and inertial data to hold position, fly waypoints and return home.
A miscalibrated compass rarely causes an immediate crash. Instead, it produces subtle heading errors that grow into circling drift, poor position hold or, in severe cases, a fly-away. Understanding what the calibration actually corrects, and what it cannot correct, is therefore essential for any pilot or technician.
What a drone compass measures and why it needs correcting
A drone compass is a three-axis magnetometer that measures the local magnetic field vector, typically in microtesla. The flight controller projects that vector onto the horizontal plane, using attitude from the IMU, to derive magnetic heading, and then applies the magnetic declination for the current location to obtain true heading.
The raw reading is never clean. Steel screws, motor magnets, battery currents and wiring all add their own fields that rotate with the airframe. These contributions fall into two classic categories, hard-iron and soft-iron distortion, and the calibration routine exists to estimate both.
The table below summarizes the error sources a calibration addresses and those it does not.
| Error source | Typical cause | Corrected by calibration |
|---|---|---|
| Hard-iron offset | Permanent magnets, magnetized steel parts | Yes, as a constant bias per axis |
| Soft-iron distortion | Ferrous material that bends the Earth field | Yes, as a scaling and cross-axis matrix |
| Current-induced field | High battery and motor current near the sensor | Only with a separate motor or current compensation |
| External interference | Rebar, vehicles, power lines, metal decks | No, it changes with location |
| Sensor misalignment | Compass mounted at an angle to the airframe | Partly, larger errors need an orientation setting |
How the calibration routine works
During calibration, the pilot rotates the aircraft through as many orientations as possible, usually a horizontal spin followed by a vertical spin with the nose pointing down. The Earth field stays constant while the airframe rotates, so an ideal sensor would trace a perfect sphere centered on zero when its samples are plotted in three dimensions.
In practice, hard-iron offsets shift the center of the sphere, and soft-iron effects stretch it into an ellipsoid. The firmware fits an ellipsoid to the samples, then computes an offset vector and a correction matrix that map it back to a centered sphere. Open-source autopilots such as ArduPilot and PX4 report a fitness value that expresses the residual error; commercial systems simply show success or failure.
The steps and their purpose differ slightly between platforms, but the logic is the same.
| Step | Pilot action | Purpose |
|---|---|---|
| 1. Prepare | Remove metal objects, move away from vehicles | Ensure only the Earth field and the airframe are measured |
| 2. Horizontal rotation | Turn the drone 360 degrees level | Sample the horizontal axes |
| 3. Vertical rotation | Turn 360 degrees with the nose down | Sample the vertical axis |
| 4. Fit and store | Wait for confirmation | Save offsets and the correction matrix |
| 5. Verify | Compare heading with a known direction | Confirm the result before flight |
Calibration quality depends on sample coverage. A routine that only sees a narrow band of orientations produces an ellipsoid fit with large uncertainty, which is why some autopilots require rotation about every axis before they accept a result.
Compass calibration compared with related procedures
Compass calibration is often confused with other sensor setup tasks and with the in-flight symptoms of a bad heading. Each one addresses a different error, and performing the wrong procedure wastes time without fixing the fault.
| Procedure or concept | What it addresses | Relation to compass calibration |
|---|---|---|
| IMU calibration | Gyroscope and accelerometer bias | Separate task; a poor IMU degrades heading projection |
| Motor compensation | Field from motor and battery current | Complements calibration on high-current builds |
| Magnetic declination | Angle between magnetic and true north | Applied after calibration, usually from a world model |
| Magnetic interference warning | Disturbance at the current location | Indicates a site problem, not a calibration problem |
| Toilet bowl effect | Circling drift during position hold | Classic symptom of a heading error |
Modern flight controllers also fuse heading from GNSS velocity and dual-antenna GNSS where available. These sources reduce dependence on the magnetometer, but at hover and low speed the compass usually remains the primary heading reference.
When to calibrate and when not to
Manufacturers of consumer drones now advise calibrating only when the app requests it or after hardware changes, rather than before every flight. Recalibrating in a disturbed environment can store wrong offsets and make an accurate compass worse.
| Situation | Recommended action | Reason |
|---|---|---|
| First flight of a new aircraft | Calibrate in an open field | Establish a baseline for that airframe |
| Hardware change near the sensor | Recalibrate | New parts alter hard-iron and soft-iron terms |
| Travel of several hundred kilometers | Calibrate if prompted | Field strength and inclination differ |
| Warning on a parking lot or roof | Move to a clean site first | Local steel, not the airframe, is the cause |
| Normal flight at a familiar site | Do not recalibrate | A good stored result is better than a risky new one |
A clean calibration site is open ground at least several meters from cars, reinforced concrete, metal fences, buried pipes and power lines. Pilots should also remove phones, keys and watches from their hands, because a magnet near the sensor during the spin directly corrupts the hard-iron estimate.
Limitations, failure modes and common mistakes
Calibration corrects only distortions that rotate with the aircraft. Fields fixed in the environment cannot be removed, and the firmware cannot tell them apart from the airframe during the spin. This is the most common reason a drone flies well at one site and drifts at another.
- Calibrating next to a vehicle bakes the car’s field into the offsets, producing a heading error at every other location.
- Takeoff from a steel surface can disturb the initial heading; the drone may then begin a toilet bowl pattern after lifting off.
- Ignoring a large offset value hides a magnetized part or a misplaced cable that should be fixed physically.
- Repeated calibration as a ritual increases the chance of storing a bad result without adding accuracy.
- Dismissing an interference warning and switching to ATTI mode without preparation can leave the pilot with no position hold.
Even a perfect calibration leaves a residual heading error of about one to three degrees on typical consumer hardware. That is acceptable for position hold, but survey and mapping work relies on RTK and better sensor fusion rather than on the magnetometer alone.
Explained without jargon
A drone has a small digital compass that tells it which way it is facing. The problem is that the drone itself contains magnets and metal, and these push the needle slightly off, a bit like a hiking compass held next to a belt buckle.
Compass calibration is a short routine in which you turn the drone around in several directions. The drone notices how its own parts bend the reading and remembers how to cancel that effect. The key point is simple: calibrate in a clean, open place, because the drone cannot tell its own metal apart from a nearby car.
A typical use case
An inspection technician replaces the gimbal and a landing leg on a mid-size quadcopter used for roof surveys. On the first test hover in the company yard, the aircraft slowly circles instead of holding position, and the app shows a heading warning. The yard has parked vans and a steel container nearby.
The technician carries the drone to a grass field about 50 meters from any vehicle, removes a phone and keys from the pockets, and performs the horizontal and vertical rotation. The app accepts the result, and a comparison with a hand compass shows less than two degrees of difference. The next hover is steady, and the circling disappears.
The lesson the team records is that the new hardware changed the airframe field, and that the recalibration had to happen away from the vans to be valid.