All posts Technology

The sensor that thinks: event engines inside the IMU

In short

The pen's motion sensors are not passive data pumps. They contain small built-in event engines, finite state machines, that watch the raw signal for patterns like a tap, a free-fall or a pick-up, and raise a flag only when one occurs.

Delegating these reflexes to the sensor lets the main processor sleep deeply yet react instantly, and gives the pen gestures with near-zero power cost.

The short version. The full post has the detail and the why.

In this post

  1. A state machine the size of a grain of salt
  2. The pen's reflex vocabulary
  3. Why not just do it in software
  4. Designing good events is the real work

A state machine the size of a grain of salt

Inside each motion sensor, alongside the actual measuring elements, sits a small programmable logic block: a finite state machine. It steps through simple states, watching thresholds and timers over the live signal. Above this acceleration for that long, move to the next state; signal quiet again too soon, fall back. Reach the final state and the sensor raises an interrupt line. No code on the main processor runs at all until that moment.

The pen's reflex vocabulary

With those engines the pen recognises a practical vocabulary of physical events. A sharp tap on the barrel, a bookmark gesture. A double tap. Free-fall, the signature of a drop, detected while the pen is still in the air. The jolt of being picked up. Sustained stillness, the cue to wind down. Each is detected inside the sensor, for microamps, whether the processor is awake or not.

quiet spikeseen quietagain TAP!wake CPU sharp jolt within limits a tap detector as a chain of states, running entirely inside the sensor
A simplified tap detector: the sensor's internal state machine walks quiet, spike, quiet-again, and only the final state wakes the main processor.

Why not just do it in software

The processor could detect all of these in firmware, and during active writing it does refine them. The energy economics of idle are the problem: software detection requires the processor awake, examining hundreds of samples a second, around the clock. The sensor's engine does the watching at a vanishing fraction of the cost, and wakes the processor only for the interesting moments, which are rare. Reflexes belong in the spinal cord, not the brain.

Designing good events is the real work

The hard part is not enabling these engines; it is tuning them against real life. A pen rides in backpacks, rolls off desks and gets waved around in conversation. Every threshold is a negotiation between sensitivity and false alarms, and the tuning is validated on recorded real-world motion, so a bumpy bus ride does not become a hundred phantom taps.

Key takeaways

  • Motion sensors carry programmable state machines that detect events on their own.
  • Taps, double taps, drops, pick-ups and stillness are recognised for microamps.
  • Delegation lets the processor sleep deeply while the pen stays instantly responsive.
  • The engineering effort is tuning thresholds against messy real-world motion.

The elegant systems are the ones where each part thinks at the level it should. The sensor handles reflexes; the processor saves itself for thought.

Read next