Your AirPods Are Now a Mouse

MousePods turns your AirPods into a hands-free mouse, letting you control your computer's cursor just by moving your head.

Nick Bild
3 days ago β€’ Wearables

Apple's AirPods are primarily designed for listening to music and taking calls, but they're also packed with sensors that can track your movements. So why not put those sensors to work doing something completely different? That's the idea behind MousePods, an open source project that turns a pair of AirPods into a hands-free mouse for Linux computers. Instead of moving a mouse around your desk, you can move your head to control the cursor.

Developed by Matteo Gaudioso, MousePods is a Python-based application that works with AirPods 3 and AirPods Pro. It uses the earbuds' built-in motion sensors to track head movements, which are then translated into mouse movements. Users can also hold an earbud in their hand and wave it around like an air mouse.

Getting this to work was easier said than done, however. While Apple introduced head tracking with the AirPods 3 back in 2021, accessing their motion sensors outside of Apple's ecosystem has been a challenge. Other open source projects have managed to retrieve this data from newer AirPods models, but the third-generation earbuds have remained largely unsupported.

Gaudioso eventually discovered why. Unlike newer AirPods, which use a protocol called SensorDataWX to communicate motion data, the AirPods 3 rely on Apple's RemoteHID protocol. This method of accessing their sensors hadn't previously been publicly documented, so it took a lot of reverse engineering work to understand.

Another problem was Linux's default Bluetooth L2CAP maximum transmission unit (MTU) of 672 bytes. This was too small for the AirPods to announce their motion sensors, effectively hiding them from the computer. Increasing the MTU to 2582 bytes, matching the value used by iOS, exposed all eight virtual sensor devices.

With this worked out, Gaudioso was able to retrieve motion data from AirPods 3 at rates of up to 210 Hz. By comparison, the AirPods Pro 2 were verified to deliver data at 25 Hz using the existing SensorDataWX protocol.

MousePods processes the gyroscope, accelerometer, and gravity data to determine how the earbuds are moving, then translates that information into cursor movements. It works with both Wayland and X11 desktops without requiring an Apple device or root privileges.

There are three control modes available. Mouse mode lets users move the cursor by turning or tilting their heads, or by holding an earbud in their hand. Pointer mode is designed to let users aim directly at the screen after calibrating two corners, while an experimental glide mode allows an earbud to be slid across a table like a traditional mouse.

The application includes a graphical interface in the style of the macOS Settings app with battery information, live 3D orientation tracking, calibration tools, and adjustable settings. Users can click by pressing an earbud stem, tilting their heads, or holding the cursor in place.

The source code and documentation for MousePods are available on GitHub for anyone interested in giving it a try.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.

Comments

Please log in or sign up to comment.

Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles