Magnetometer
Live magnetic field readings for compass-related diagnostics, with combined and per-axis graphs.
Overview
The magnetometer measures the local magnetic field around the device. It is used for compass heading and can be affected by nearby metal objects or electronics.
Table of Contents
- Overview
- Tabs
- Toolbar Controls
- Overview Tab
- Graphs Combined Tab
- Graphs Per Axis Tab
- Notes And Limitations
Tabs
- Overview
- Graphs (combined)
- Graphs (per axis)
Toolbar Controls
All motion-sensor tools share the same toolbar controls:
- Play / Pause: start or pause sensor updates.
- Clear: clear history buffers used by the graphs.
- Refresh rate: cycle between Faster, Fast, and Slow sampling rates.
Overview Tab
The Overview tab shows:
- A detailed compass visualization with:
- A stationary outer ring with cardinal (N, E, S, W) and intercardinal (NE, SE, SW, NW) direction markers. North is displayed in red.
- Tick marks every 5 degrees, with three levels of prominence (30-degree marks tallest, 15-degree marks medium, 5-degree marks shortest).
- A rotating inner compass rose that turns opposite to the heading direction.
- A stationary triangle heading indicator at the top.
- A field strength indicator at the center -- an XY-plane dot that moves based on X and Y field values, surrounded by a ring that scales with total field magnitude (capped at 100 uT).
- Live values for magX, magY, magZ (in microtesla,
uT). - A computed heading in degrees (calculated as
atan2(y, x), converted to clockwise-from-north: 0 = North, 90 = East, 180 = South, 270 = West). Heading rotation is smoothed to avoid abrupt jumps.
Graphs Combined Tab
This tab overlays X/Y/Z history on a single graph (X = red, Y = green, Z = blue) and shows the current auto-scaled range. The Y-axis range is dynamically calculated based on the maximum absolute value across all readings, with 20% margin and a minimum of +/-100 uT. Current values use split-precision formatting. The graph retains up to 300 readings (larger than the 100 used by accelerometer and gyroscope).
Graphs Per Axis Tab
This tab shows three separate panels (X, Y, Z), each with its own independently auto-scaled range and the current value displayed alongside the axis label.
What You Can See
- Magnetic field strength on the X/Y/Z axes (commonly in microtesla, uT)
- Total field magnitude (if available)
- Optional compass/heading view (if available)
Notes
- Readings are sensitive to interference (cases with magnets, speakers, laptops).
- Compass accuracy can degrade indoors or near large metal structures.
Notes And Limitations
- Magnetometer availability varies by device and platform. On visionOS, the magnetometer is not available.
- If readings look wrong, remove magnetic accessories and move away from large metal objects.