April 11, 2026
MagTrack
MagTrack is a head tracking system that uses a magnetometer and passive neodymium magnets — no camera, no batteries on the user — to track head position in real time. I was initially inspired by Johnny Lee's Wiimote Head Tracking demo.
Hardware
DFRobot BMM350 breakout board (3-axis magnetometer)
ESP32 DevKit
28 N52 neodymium magnets embedded in 3D printed glasses
How It Works
The idea is very simple. The hardware only streams 3-axis magnetic field readings over serial. The host-side Python script subtracts the ambient background field, then inverts the change in magnetic field to a 3D position using the magnetic dipole equation. A Kalman filter smooths the output. That's the entire pipeline.
Calibration takes about 10 seconds: record the background field with no magnet present, then hold the magnet at a known distance so the system can characterize its strength.
Demo 1 — The Johnny Lee Moment

The first thing I built was a modernized version of Johnny Lee's 3D targets demo: an OpenGL room with cubes floating at different depths. The system uses the tracked head position to render the scene from the user's perspective using off-axis projection.
Demo 2 — Gaze-Aware Audio Control

This is my favorite application of MagTrack. I never thought "gaze-aware audio control" would be useful until I experienced it.
Two monitors. YouTube on the left, Spotify on the right. When I look at YouTube, the music quietens. Then I turn my head, and the YouTube audio automatically gets quiet, and the music gets louder. It felt like magic.
The system auto-detects which audio app is on which physical display, then uses MagTrack to classify my gaze into "monitor 1", "monitor 2", or "away". Volume control happens through FineTune, a free app that provides per-app volume control for macOS. It's hard to feel in a GIF. Definitely check out the demo video.
Demo 3 — A Privacy-Safe Center Stage

You've probably seen Apple's Center Stage — the auto-cropping webcam feature that keeps your face centered during video calls. It works by running a face detection ML model on every frame of your camera feed. MagTrack gives you the same visual result with better privacy (no image processing) and lower computational overhead (no neural networks).
Wrap-Up — How Does MagTrack Compare?
There are three main head tracking approaches out there: IR sensing (e.g. Johnny Lee's Wiimote approach), IMU-based tracking, and computer vision. MagTrack has real tradeoffs against all of them.
Limitations
I'll be honest here. Because magnetic field strength falls off as 1/r³, the effective tracking range is fairly limited with commercially available magnets — though stronger magnets can extend the play area well beyond what I've shown here. And with a single magnetometer, precise positional accuracy is modest.
But for desk-space applications, it's more than enough. The gaze-aware audio control doesn't need millimeter precision, and the camera tracker doesn't need a 2-meter range. For the things you'd actually want to do at a desk, the accuracy and range are there.
Advantages
The advantages are HUGE. Unlike IR and IMU sensing, the user-worn device doesn't need any battery — it's a passive magnet. Compared to computer vision, MagTrack is free from occlusion and completely eliminates the privacy concern of exposing camera streams to an ML model.