Reading the undocumented MEMS accelerometer on Apple Silicon MacBooks via iokit

Published: (February 20, 2026 at 12:06 AM EST)
2 min read

Source: Hacker News

What is this

Apple Silicon chips (M1/M2/M3/M4) have a hard‑to‑find MEMS accelerometer managed by the Sensor Processing Unit (SPU).
It isn’t exposed through any public API or framework. This project reads raw 3‑axis acceleration data at ~800 Hz via IOKit HID callbacks.

  • Only tested on MacBook Pro M3 Pro so far – it might work on other Apple Silicon Macs, but there are no guarantees.

More information: read the article on Medium

demo

How it works

The sensor lives under AppleSPUHIDDevice in the IOKit registry, on vendor usage page 0xFF00, usage 3.
The driver is AppleSPUHIDDriver, which is part of the SPU.

  1. Open the device with IOHIDDeviceCreate.
  2. Register an asynchronous callback via IOHIDDeviceRegisterInputReportCallback.
  3. Data arrives as 22‑byte HID reports; X/Y/Z are int32 little‑endian at byte offsets 6, 10, 14.
  4. Divide each value by 65536 to obtain acceleration in g.
  5. Callback rate is ~100 Hz.

You can verify the device exists on your machine with:

ioreg -l -w0 | grep -A5 AppleSPUHIDDevice

Quick start

git clone https://github.com/olvvier/apple-silicon-accelerometer
cd apple-silicon-accelerometer
pip install -r requirements.txt
sudo python3 motion_live.py

Root privileges are required because IOKit HID device access on Apple Silicon needs elevated permissions.

Code structure

  • spu_sensor.py – Core: IOKit bindings, device discovery, HID callback, shared‑memory ring buffer.
  • motion_live.py – Vibration‑detection pipeline, heartbeat BCG, terminal UI, main loop.

The sensor‑reading logic is isolated in spu_sensor.py, so you can reuse it independently.

Heartbeat demo

Place your wrists on the laptop near the trackpad and wait 10–20 seconds for the signal to stabilize.
This uses ballistocardiography—the mechanical vibrations from your heartbeat transmitted through your arms into the chassis. It’s experimental, not reliable, and intended as a fun showcase of what the sensor can capture.

  • BCG band‑pass: 0.8–3 Hz
  • BPM estimated via autocorrelation on the filtered signal

Notes

  • Experimental / undocumented AppleSPU HID path
  • Requires sudo
  • May break on future macOS updates
  • Use at your own risk
  • Not for medical use

Tested on

  • MacBook Pro M3 Pro, macOS 15.6.1
  • Python 3.14

License

MIT

Not affiliated with Apple or any employer.

0 views
Back to Blog

Related posts

Read more »