Skip to content

Magnetic Calibration ​

Magnetic calibration compensates hard-iron and soft-iron distortions that move rigidly with the module, and is required for accurate 9-axis absolute heading. Skip this chapter if you use 6-axis mode or a model without a magnetometer.

Scope & When to Calibrate ​

  • 9-axis mode is suitable only outdoors in open space, away from rebar, motors, and high-current cables, with the module rigidly mounted and calibrated. Indoors or near motors, the field varies over space and time and cannot be calibrated out — use 6-axis mode instead.
  • Calibrate once after final mechanical installation. Recalibrate if you remount the module, change nearby ferromagnetic parts, or see heading errors after a firmware upgrade.
  • When mounted on a PCB, metal enclosure, tripod, drone, or vehicle, rotate the entire assembly during calibration. Calibrating a loose module and reinstalling it invalidates the result.

Calibration Steps ​

CHCenter's Magnetic Calibration window handles steps 3–4 interactively; for Modbus registers, see Magnetic Calibration via Modbus. Using ASCII commands:

  1. Switch to 9-axis mode: send CONFIG ATT MODE 1 → SAVECONFIG → REBOOT, then confirm PROFILE=1 in LOG USRCONFIG (or MAIN_STATUS.MAG_AIDING=1). Follow Configuration Order to clear and redo zeroing (save RST 0 until after heading verification).
  2. Choose a clean site: preferably outdoors (> 5 m from buildings and vehicles), away from magnets, motors, steel fixtures, power cables, metal desks, and rebar.
  3. Start calibration and rotate:
    text
    CONFIG MCAL START        (3D: drones, handhelds, and vehicles that pitch/roll widely)
    CONFIG MCAL START 2D     (2D: cars, AGVs, and turntables moving mostly level; uppercase 2D)
    • 3D motion: stay in place and rotate smoothly at ~20–100 deg/s for at least 1–2 full turns around each of X, Y, and Z without dwelling in one pose.
    • 2D motion: keep level and rotate steadily around the vertical axis for more than one full turn.
    • Do not resend START while running; if progress stalls, keep rotating through uncovered angles.
  4. Poll status periodically with LOG MCAL STAT:
    text
    → LOG MCAL STAT
    ← STAT=3
    ← PROGRESS=100
    ← OK
    • STAT=0 idle; 1 running (PROGRESS is 0–99); 3 succeeded (applied and saved automatically, no SAVECONFIG needed); 4 failed.
    • Wait for STAT=3 rather than a fixed timeout. A single heading jump on completion is normal alignment.
  5. Verify heading closure: place the module level, record the initial yaw, rotate slowly through 360° back to the start, and confirm smooth motion (±180° wrap is normal) with closure error ≤ 5°. Power-cycle once and recheck to confirm persistence. Closure checks consistency only; for absolute heading, confirm the nose points near 0° when aimed at magnetic north.

Right after power-up in 9-axis mode, MAIN_STATUS.MAG_DIST may stay 1 briefly. Rotate the module in a clean environment until MAG_DIST clears before trusting yaw.

Calibration Failure & Troubleshooting ​

If STAT=4 occurs or 360° closure exceeds 5°, check the total magnetic field magnitude Btotal=Bx2+By2+Bz2 (mag_b in μT, viewable in HI91 or CHCenter) in order:

StepCheckNormal RangeAction If Out of Range
1Stationary Btotal20–65 μT<20 μT (shielded) or >65 μT (near magnet): move to a clean site and retry
2Rotation coverage3D: ≥ 360° per axis; 2D: ≥ 360° levelCover missing orientations, or switch to 2D if vehicle cannot tilt widely
3Spread of Btotal across 4 headings in placeMax − min ≤ 10 μT>10 μT indicates spatial gradient or motor currents: move away or use 6-axis mode
4Rigid mounting & fixed spotPure rotation, no translation or flexSecure the assembly and recalibrate on the spot

Last updated:

IMU · AHRS · INS · RTK Support Center