You're on the subway, phone tilted toward the map, and the screen just... sits there. Wrong orientation. Then it snaps correct, about half a second too late. You blame the software, which is fair. But the actual argument was happening one layer deeper, between two sensors with completely different opinions about which way was up.
Your phone runs at least two motion-sensing components simultaneously. They disagree constantly. The accelerometer measures linear force, gravity included, so it always has a rough sense of "down." The gyroscope measures rotational velocity, so it knows how fast the device is spinning around each axis. Neither one is complete without the other. Together, they are also occasionally a mess.
Why Each Sensor Lies in Its Own Specific Way
The accelerometer is accurate about orientation across long stretches but terrible in the short term. Shake the phone and it cannot separate "the device is moving" from "the device is tilting." Both register as a force vector. Ask it to track a quick wrist-flick and it reports nonsense for the entire duration of the motion.
The gyroscope is the opposite problem.
It captures rapid rotation with real precision, logging small angular changes up to 200 times per second on a typical modern chip. But gyroscopes drift. Leave one running and its reported angle wanders away from reality by a degree or two per minute, sometimes faster, because tiny integration errors compound over time. Think of it as a sprinter with no internal compass: fast, decisive, gradually lost.
So you have one sensor that holds up over time but flinches at sudden movement, and one that's razor-sharp in the moment but slowly hallucinates. The phone needs both, and it needs something to referee.
The Referee in the Middle
That referee is a complementary filter, or its more mathematically demanding cousin, the Kalman filter. Both do roughly the same conceptual job: blend the two sources by weighting each one according to what it handles well.
At high frequencies (fast movements, short time windows) the filter trusts the gyroscope almost exclusively. At low frequencies (slow drift, long time windows) it leans on the accelerometer to correct the gyroscope's wandering baseline. The crossover point typically sits around 0.1 Hz. Anything slower than one full cycle every ten seconds gets handed to the accelerometer for final judgment.
A concrete scenario. You pick up your phone from a table and rotate it 90 degrees in about a quarter of a second to read a notification. Fast movement: the gyroscope handles it, reporting smooth angular velocity the whole way. Then you hold the phone still. Over the next two seconds, the gyroscope would normally drift a fraction of a degree. The accelerometer, now reading a stable gravity vector, quietly pulls the fused angle back to true. You never see the correction. The entire negotiation happened in firmware, probably on a dedicated motion coprocessor drawing a few milliwatts. Apple has handled this on a separate low-power chip since the M7. Android devices from Google, Samsung, and others use equivalent hardware, often called a sensor hub or sensor fusion processor. The main CPU never wakes up for any of it.
What People Consistently Misread
The common assumption is that one sensor is the "real" one and the other is a backup. That framing is wrong, and it matters. This is not a hierarchy. It's a weighted average that shifts its weights in real time based on signal frequency. Neither sensor wins outright. The orientation number your apps actually read is a synthetic value that neither sensor ever produced on its own. It's a calculated compromise, and calling one sensor primary just muddles the picture.
Which brings up something most reviews completely ignore: two phones with identical sensor chips can behave very differently, because the filter coefficients (the exact weightings and crossover frequencies) are tuned by the manufacturer. A phone optimized for gaming might weight the gyroscope more aggressively for low-latency response. One tuned for battery life might run the fusion algorithm at a lower update rate. Same parts, different feel. The spec sheet tells you almost nothing useful here.
So, if your phone's orientation tracking feels sluggish or drifty, is a broken sensor actually your problem? Almost certainly not. It's usually calibration: the filter's baseline has drifted and needs a reference reset. Most phones let you fix this by placing the device flat on a surface and running a calibration routine, typically buried a few menus deep in settings. Thirty seconds, done.
The sensors themselves are almost certainly fine. They're just two unreliable witnesses whose combined testimony, weighted correctly, happens to tell the truth.