You turn the phone and the screen rearranges itself. You go for a walk and it counts your steps. You set it face down on the table and the display goes dark. None of that involved a photo or a network request: inside there is a mechanical silicon part, less than a millimetre across, and it moves. It literally moves, by a few nanometres, every time you move the phone.
A mass hanging from silicon springs
The part is called a MEMS device, short for micro-electromechanical system: movable structures between one and ten micrometres thick, built on a silicon wafer with the same techniques used for chips. Polysilicon layers are deposited, patterned by photolithography and then released with deep reactive ion etching (DRIE), which digs vertical trenches and leaves the piece hanging, held only by thin silicon beams that behave like springs.
In an accelerometer that piece is a proof mass of a few micrograms attached to the substrate by folded springs. Beside it sit two interdigitated comb electrodes: one fixed to the substrate, one moving with the mass. Each tooth forms a capacitor with its partner. When the mass shifts, the gap between teeth changes, and so does the capacitance.
Measuring in attofarads
The formula is the ordinary parallel-plate one: C = ε·A/d, capacitance equal to permittivity times area divided by distance. With gaps of one or two micrometres and a base capacitance of a few hundred femtofarads, an acceleration of 1 g moves the mass only tens of nanometres and changes capacitance by something on the order of attofarads, a millionth of a billionth of a farad.
Spotting that takes electronics unlike anything in a household sensor. The chip uses charge amplifiers and switched-capacitor sigma-delta modulators: they turn the imbalance between the two combs (differential, so thermal noise and common drift cancel out) into a bitstream whose density encodes acceleration. Good phone accelerometers have an equivalent noise of tens of microg per root hertz and a selectable full scale from ±2 to ±16 g, digitised at 16 bits.
Gravity never goes away
One detail that confuses many people: an accelerometer does not measure acceleration relative to the Earth, it measures proper acceleration, the one a scale would feel. Sitting still on a table, the sensor reads 1 g upward, because the table is pushing it. In free fall it reads zero, which is how a phone knows it has been dropped: the vector collapses, then comes the impact spike, then rest.
Because gravity is an absolute reference, three axes are enough to compute tilt with an arc tangent of the components. What an accelerometer cannot do is tell how far you have turned around the vertical axis: with the phone flat, spinning it on the table does not change the gravity vector at all.
The gyroscope does not spin, it vibrates
That is what the gyroscope is for, and here comes the elegant part: the one in a phone has no wheel and no spinning rotor. It is a miniature tuning fork. Two masses are driven to oscillate in opposition, closing in and moving apart, at their resonant frequency, typically between 20 and 40 kHz, with an amplitude of a few micrometres.
When the device rotates at angular velocity Ω, the Coriolis force appears: F = -2m·Ω×v. Since the masses already carry a velocity v, the rotation pushes them sideways, at right angles, with an amplitude proportional to how fast you turn. Sense electrodes pick up that lateral motion, again as a capacitance change, and the electronics demodulate it synchronously with the drive signal to separate it from noise and from quadrature error, the unwanted mechanical coupling that arrives 90 degrees out of phase.
The whole assembly is sealed in vacuum, at a pressure of thousandths of a millibar, so the tuning fork keeps a high quality factor and goes on vibrating on very little energy. Typical ranges run from ±125 to ±2000 degrees per second.
Drift, noise and sensor fusion
Neither sensor works alone. The gyroscope responds fast but drifts with temperature and time: tens of degrees per hour of bias instability in consumer parts. The accelerometer gives an absolute gravity reference, but fills with noise as soon as the phone moves or vibrates. The magnetometer supplies north, and therefore heading, though any speaker or metal case disturbs it and it must be calibrated.
The answer is fusion: a Kalman filter, or lighter variants such as Madgwick, blending both sources at tens or hundreds of hertz, correcting the integrated gyroscope with measured gravity and estimating the gyroscope bias on the fly. Orientation is carried in quaternions to avoid the gimbal lock of Euler angles. In augmented reality the camera joins in: visual feature tracking and the inertial unit correct each other, with the IMU filling the gaps between frames.
From pocket to car
The same technology, under a different qualification, sits in car airbags and stability control: ±50 g ranges, continuous self-test, automotive-grade temperature tolerance and redundancy, because a pretensioner firing depends on that reading. In a drone, the control loop reads the IMU between 1,000 and 8,000 times per second. And in a phone camera, optical stabilisation uses the gyroscope signal to shift the lens with a voice-coil actuator and cancel hand shake within milliseconds.
Why it sometimes gets it wrong
A pedometer band-pass filters the signal between half a hertz and three hertz, looks for peaks with hysteresis and estimates stride length from cadence. That is why it sometimes counts steps while you ride a bike. Screen rotation combines gravity tilt with angular rate; lie down and gravity says landscape while you want portrait, hence the rotation lock. And with the phone flat on a table, without a magnetometer there is no way to tell which way you spin it: all you have is gravity pointing down.
In the end, the gadget that decides how your screen looks is a real machine: a silicon mass hanging from springs, oscillating in vacuum and shifting less than the thickness of a bacterium. It is probably the most manufactured mechanism in history, and almost nobody knows it is there.






