Compass Calibration
Calibrate phone compass: compare magnetometer with sensor-fusion heading, capture true north reference, measure deviation after figure-8 motion.
About Compass Calibration
Compass Calibration monitors raw magnetometer headings versus the device orientation reported by the sensor fusion pipeline. By capturing a manual north reference, you can quickly spot interference or drift.
- Tap Start calibration and grant motion/magnetometer access when prompted.
- Follow the on-screen guide: perform a figure-eight and rotate the phone through multiple axes.
- Point the handset toward a known north reference and tap Set north reference.
- Check the heading deviation card. Repeat the motion routine until the drift stays low.
Frequently Asked Questions
The tool compares two independent estimates of your phone's heading: the magnetometer-derived bearing (from the absolute magnetic field) and a gyroscope-integrated bearing (relative rotation measured over time). After you optionally capture a "true north" reference, you perform a guided motion sequence — usually a figure-8 in the air — and the tool measures how much the two estimates diverge. The deviation tells you whether the magnetometer is accurately reading the Earth's field or whether it is being thrown off by ferromagnetic objects, charged DC currents, or simple uncalibrated hard-iron and soft-iron offsets in the sensor itself. The output gives a numeric heading error and qualitative status (well calibrated, needs calibration, or stuck).
The phone's magnetometer is sensitive to two error sources. Hard-iron bias comes from permanent magnets within the phone (speakers, vibration motor) and metal cases — these add a constant offset to all three magnetic axes. Soft-iron distortion comes from ferromagnetic materials that warp the field around them when the phone rotates — these scale and tilt the apparent field. Both errors accumulate as the phone is jostled and as nearby magnetic environment changes. Without calibration, your compass may point 20–60° off true heading. Phone operating systems run continuous background calibration but only succeed when you rotate the device enough. This tool gives you a deliberate check rather than waiting for ambient motion to do it.
Practical interpretation of the deviation between magnetometer and gyroscope heading after a figure-8 calibration motion: under 3° is excellent, the kind of accuracy needed for AR navigation and surveying apps; 3–7° is good and acceptable for hiking, geocaching, and casual navigation; 7–15° is mediocre and will cause noticeable drift in outdoor route-finding; over 15° means your phone needs immediate recalibration via OS settings or a stronger figure-8. The standard outdoor compass needs about 2° accuracy to be useful at 10 km distance — a 2° heading error projects to 350 meters of position uncertainty. Magnetic declination (the difference between true and magnetic north) varies by location and adds 0–20° on top depending on where you are, so most compass apps apply a declination correction from a World Magnetic Model lookup.
The Earth's magnetic field is about 25–65 μT depending on latitude. Any nearby ferromagnetic mass distorts that field locally. A laptop on the desk, a metal lamp, a refrigerator, the steel rebar in a concrete floor, or even a kitchen knife in a drawer can shift your magnetometer reading by 5–50 μT at close range. Moving across the room moves you between these distortion zones, changing your apparent magnetic heading even though your gyroscope correctly reports no actual rotation. This is why phones often instruct you to calibrate "away from electronics and metal objects" — the calibration only works well if it averages over many orientations in a roughly uniform field. Outdoor calibration in open ground always produces tighter deviation than indoor calibration.
The figure-8 motion in the air sweeps the phone through three-dimensional orientations that span all six "octants" of orientation space (the sphere of all possible phone attitudes). Hard-iron bias appears as a constant offset on the magnetic vector — the figure-8 lets the calibration algorithm fit a sphere to your magnetometer readings, and the center of that sphere is the hard-iron offset that needs subtracting. Soft-iron distortion is more complex — it warps the sphere into an ellipsoid, and the algorithm fits an ellipsoid then computes the linear transform that re-spheres it. Without a 3D motion, calibrating only by spinning around the vertical axis cannot find the vertical hard-iron component or the soft-iron tilt. The figure-8 typically takes 5–10 seconds of relaxed wrist movement.
Magnetometer readings are absolute (always referenced to Earth's field) but noisy and slow to update because the field is small. Gyroscope readings are relative (only measure rotation rate) but very fast and clean. Sensor fusion algorithms — Mahony, Madgwick, and Kalman filter variants — combine them with complementary filtering: at high frequencies (fast motion), trust the gyroscope; at low frequencies and over seconds, drift the gyroscope estimate back toward the magnetometer reading to prevent unbounded drift. The fusion runs at 100–400 Hz and produces a smooth, low-latency heading that handles both rapid turns and slow long-term stability. iOS and Android both run this fusion at the OS level using the Apple A-series motion coprocessor or Qualcomm Sensor Hub respectively.
Yes, but only with strong magnets. A typical refrigerator magnet (around 5 mT field at the surface) is too weak to permanently affect the sensor, though it will obviously throw off readings while nearby. Neodymium magnets used in phone cases or VR headsets (50–500 mT) can permanently magnetize the iron components inside the phone, creating a permanent hard-iron bias that calibration must work around. MRI machines (1.5–7 T) will absolutely destroy a magnetometer's calibration and may damage other sensors — never bring a phone into an MRI suite. Apple's MagSafe magnets (around 30 mT) are tuned to be just under the threshold for permanent magnetization. If your phone permanently shows a 50–100 μT bias even after careful calibration, a magnet has likely passed too close.
The World Magnetic Model (WMM) is the joint product of the US National Geophysical Data Center and the British Geological Survey, updated every five years (current edition WMM2025 valid through 2029). It models the geomagnetic main field as a degree-12 spherical harmonic expansion and provides declination, inclination, total intensity, and horizontal intensity at any location and date. Aviation and marine compass standards (ISO 25862 for marine compasses, FAA TSO-C-46a for aircraft) require ±2° accuracy after calibration. Phone magnetometers typically meet ±5° after calibration when far from metal. The MEMS chips themselves (Bosch BMM150, ST LIS3MDL, AKM AK099xx) follow industrial sensor standards like JEDEC JESD22 for shock survival. The Web Generic Sensor API exposes calibrated magnetometer readings already corrected by the OS for hard-iron offsets.

