šŸ’„ Free to play in your browser. No install, no sign-up.
Open the game
7 min read May 2026

How your phone actually knows you're shaking it (a friendly tour of accelerometers)

Smartphone frozen mid-shake against a black backdrop with three hot pink motion-blur trails along the X, Y, and Z axes

Inside every smartphone is a piece of silicon roughly the size of a grain of rice that measures acceleration on three axes hundreds of times per second. It costs about 30 cents to manufacture and it's responsible for everything from the auto-rotate on your photos to the step counter on your fitness app to the shake-the-phone party game your friend keeps sending you scorecards from.

Here's how it works — without the math degree.

What's actually inside (the 30-second version)

The component is called a MEMS accelerometer — Micro-Electro-Mechanical System. Imagine a tiny weight suspended between four springs in a sealed chamber, with electrical contacts at each end. When the phone moves, the weight lags behind, the springs stretch slightly, and the electrical resistance changes. That resistance change is converted into a number that tells the phone "you just moved this much in this direction."

The phone does this three times — once for each axis (X, Y, Z) — and reports back a triplet like (0.2, 9.8, 0.1). That triplet means "barely moving sideways, gravity is pulling you down on the Y axis, barely moving forward/back." That's a phone sitting flat on a table.

Extreme macro photograph of a MEMS accelerometer chip on a smartphone circuit board, lit by a single hot pink LED

Three axes, one shake

Every phone uses the same axis convention:

The accelerometer reports values in m/s² (meters per second squared) or in multiples of "g" (gravity, which is 9.8 m/s²). A phone at rest reads about 1g of downward acceleration because gravity is always pulling. A vigorous shake registers 2-5g peaks. A catastrophic drop hits 50-100g.

Shake games don't care about the direction you're shaking — they care about how much total acceleration you're producing. So the first thing every shake game does is collapse three axes into one number using the magnitude formula:

magnitude = √(x² + y² + z²)

That gives you a single "how energetic is this motion right now" number. Subtract 1g (gravity) and you have the actual acceleration the user is putting in.

See it in action
ShakeGasm shows you a live readout of your peak g while you play. Surprisingly satisfying to watch.
Open ShakeGasm →

Sampling rate — why 100 reads per second isn't enough

Your phone's accelerometer can be polled at different rates. iOS lets developers choose between 10 Hz (slow), 60 Hz (normal), and up to 200 Hz (fast). Android is similar — typically 100 Hz by default, up to 400 Hz on some devices.

For a step counter, 10 Hz is fine — you don't take more than ten steps per second. For a shake game, you need at least 60 Hz. Here's why: a "shake" is roughly a quarter-second of back-and-forth motion. If you only sample four times per second, you miss the peaks and the troughs and your "magnitude" reading averages out to something useless.

ShakeGasm polls at 60 Hz and applies a small smoothing window so single-frame spikes don't register as "you shook the phone." The trade-off is responsiveness vs. noise — too smooth and the game feels laggy, too raw and a single bumpy footstep registers as a shake.

The "shake event" detection problem

There's no built-in OS event called "shake happened." Both iOS and Android expose the raw accelerometer stream, and it's the developer's job to interpret it.

The classic algorithm:

  1. Calculate the magnitude every frame
  2. Subtract gravity baseline (~9.8 m/s²)
  3. Pass through a high-pass filter to ignore slow drift
  4. Look for "zero crossings" — moments where the acceleration changes direction
  5. Count crossings over a sliding 1-second window — that's your shake rate

The result is a number like "8 shakes per second" or "peak g of 3.2." Map those to your game's sweet-spot zones, render the meter, fire the haptic, play the audio — and you have a shake game.

The hardest part isn't the detection — it's the calibration. A vigorous shake on one phone is a gentle shake on another. iPhone accelerometers tend to be smoother than Android. Older devices undersample. ShakeGasm has to be tuned against a matrix of phones to feel right everywhere.
Want to see your own peak g?
ShakeGasm shows a live readout while you play. 2g is gentle. 5g is going. 8g+ is showing off.
Check your peak g →

What "Beast mode" actually changes

People often assume "harder difficulty" in a shake game means "shake harder." It's almost always the opposite. The sweet-spot zone narrows. The drain rate when you're outside the zone accelerates. The detection algorithm gets more sensitive to overshake.

In ShakeGasm specifically:

On Beast mode you actually have to shake gentler and more precisely, not harder. People who try to brute-force it lose every time.

Why some shake games feel "broken" — sensor differences

Two phones rarely report the same acceleration for the same gesture. Phone weight matters (heavier phones generate higher peaks for the same motion because of inertia). Case material matters (a thick case absorbs some of the shake before it reaches the sensor). Even battery level matters slightly (a fuller battery shifts the phone's center of mass).

The biggest variable, though, is the sensor model itself. Phones from 2018 used much noisier accelerometers than 2023+ phones. A game tuned only on a Pixel 8 might feel weirdly oversensitive on a Samsung Galaxy S21.

The fix is per-device auto-calibration: read the first few seconds of motion when the game starts, establish a baseline, and scale the sensitivity to match. ShakeGasm does this in the "Warming Up" phase — the first 3-5 seconds of every round.

The future: pressure-sensitive backs, IMUs, and AI motion classification

Where shake detection goes next is interesting. Newer phones have gyroscopes (rotational motion) in addition to accelerometers (linear motion), which lets you detect things like "the phone is being twisted" or "the phone is being tilted while shaken." Combined, the two sensors form an IMU — inertial measurement unit — that can describe gesture in much richer detail.

Some 2025 phones added pressure sensors on the back panel, opening up "squeeze-while-shake" as a viable game input. And on the software side, on-device ML models can now classify gesture patterns ("this looks like a flick, this looks like a circular motion") without needing a hand-tuned algorithm.

For shake games, the practical implication is that the next generation of these games is going to feel a lot more nuanced. Not just "shake harder or softer" but "shake with this rhythm" or "shake while tilted forward." The phone is finally catching up to what your wrist can express.

Stop reading. Start shaking.

Five stages. One climax. Free in your browser, free on Android — voice packs optional.

Play ShakeGasm now
Shake your phone. See what happens. Free, browser-based.
Play ShakeGasm →