DEV Community

Cover image for Accelerometer vs Gyroscope: What's the Difference? (Test Both in Your Browser)
keyboardTester.Click
keyboardTester.Click

Posted on • Originally published at keyboardtester.click

Accelerometer vs Gyroscope: What's the Difference? (Test Both in Your Browser)

The short version: an accelerometer measures linear acceleration plus gravity, so it answers "which way is down, and am I being moved?". A gyroscope measures angular velocity, so it answers "how fast am I rotating around each axis?". Your phone fuses both into one stable orientation estimate.

You can verify each sensor in about a minute, no app install: run the browser accelerometer test with the phone flat on a table (Z should read about 9.8 m/s²), then rotate the phone in the gyroscope test and watch alpha, beta, and gamma move.

Full guide with the fix list and FAQ:

Accelerometer vs Gyroscope: What's the Difference? (Test Both in Your Browser)

The comparison at a glance

Accelerometer Gyroscope
Measures Linear acceleration + gravity Rotation rate (angular velocity)
Units m/s² deg/s or rad/s
Reading at rest ~9.8 m/s² on the "down" axis ~0 on all axes
Answers "Which way is down? Am I being moved?" "How fast am I turning right now?"
Weakness alone Jittery moment to moment Drifts over time
Typical jobs Auto-rotate, step counting, lift-to-wake, shake gestures Gyro aiming, AR anchoring, video stabilization, panoramas

Neither sensor is good enough alone. Accelerometer-only orientation jitters as you walk; gyroscope-only orientation drifts as small rate errors accumulate. Phones fuse the two (plus the magnetometer for heading) into the alpha/beta/gamma angles that browsers report through DeviceOrientationEvent.

Test the accelerometer (60 seconds)

  1. Open the accelerometer test on your phone.
  2. Lay the phone flat and still: expect roughly +9.8 m/s² on Z and near zero on X and Y.
  3. Tilt the phone and watch gravity shift between axes.

Failure patterns are just as clear. All axes stuck at zero usually means denied motion permission or a dead sensor. One axis pinned to a fixed value in every orientation is a hardware fault. Values jumping past 100 m/s² while the phone rests on a table point to a calibration or driver problem.

Test the gyroscope

Open the rotate-your-phone gyroscope test and rotate the phone around each axis. Alpha tracks flat spinning (like a compass needle), beta tracks front-to-back tilt, and gamma tracks left-to-right tilt. The on-screen 3D cube should follow your hand smoothly, without lag, jumps, or frozen angles.

Auto-rotate broken? Work down this list

Most "broken accelerometer" reports are software, not hardware:

  1. Check the rotation lock (Android Quick Settings auto-rotate; iPhone Portrait Orientation Lock).
  2. Restart the phone to clear stuck sensor services.
  3. Recalibrate with a figure-8 motion, then rest the phone on a flat surface.
  4. Try safe mode on Android to rule out a third-party app forcing orientation.
  5. On Samsung, dial *#0*# and open the Sensor panel for live values.
  6. If the browser test and the diagnostic panel still show flat or frozen values, the IMU chip or board connection has likely failed, often after a drop or screen replacement.

One boundary case worth knowing: if motion readings are fine but the screen taps itself or has dead spots, the problem is the digitizer, not the motion sensors. A touch screen test maps phantom taps and dead zones so you do not blame the wrong component.

Related browser checks

Everything runs in the browser through standard DeviceMotion and DeviceOrientation APIs, so it works on Android and iPhone without installing anything.

Top comments (0)