A smartphone is also a small measuring lab. Inside the case are sensors that detect movement, rotation, magnetic fields, air pressure, light and the proximity of objects. Every time the screen rotates, the step counter ticks up or the map turns to face the right way, one of these sensors is at work. Knowing them helps you understand what the phone can do and why some readings are less reliable than they look.
Motion sensors: MEMS
Most motion sensors are built with MEMS technology (micro-electromechanical systems): tiny mechanical structures etched into silicon that move by fractions of a micrometre. Their movement is measured electrically, usually as a change in capacitance.
Accelerometer
It measures acceleration along three axes. At rest it detects the acceleration of gravity, which lets it work out how the phone is tilted: it's the sensor that decides whether the screen should rotate. On the move it picks up bumps and vibrations, and it's the basis of the step counter, which recognises the rhythmic pattern of walking.
Gyroscope
It measures the rate of rotation around the three axes. It's essential for augmented reality, games controlled by tilting the phone and photo stabilisation. It has a typical flaw: drift. If you add up the rotation rate over time to get an angle, small errors accumulate and the calculated orientation slowly wanders away from the real one.
Magnetometer
It measures magnetic fields, including the Earth's: it's the compass. It's very sensitive to interference: magnets in cases, speakers, metal structures, cars. When an app asks you to move the phone in a figure of eight, it's calibrating the magnetometer to compensate for that interference.
Other common sensors
| Sensor | What it measures | Typical use |
|---|---|---|
| barometer | air pressure | changes in altitude, floors climbed |
| proximity | an object close by | turning off the screen during calls |
| ambient light | light intensity | auto-brightness |
| fingerprint | features of the finger | unlocking and authentication |
The barometer is interesting: pressure changes only slightly from one floor to the next, but the sensor is sensitive enough to notice. That's why some fitness apps count floors climbed. Absolute altitude, however, also depends on the weather, because pressure varies with atmospheric conditions.
Sensor fusion: working together
No single sensor is perfect:
- the accelerometer gives a steady reference pointing down, but every movement disturbs it;
- the gyroscope is accurate in the short term, but drifts over time;
- the magnetometer points north, but suffers from magnetic interference.
Sensor fusion combines the three readings with filtering algorithms so that each compensates for the others' weaknesses. The result is a stable, responsive orientation, which operating systems offer to apps as a ready-made "virtual" sensor. Navigation apps also add satellite positioning; augmented reality apps use the camera.
Power consumption
Keeping sensors running costs battery. That's why phones often have a small dedicated processor, sometimes called a sensor hub, which reads the sensors at low power while the main processor sleeps. Step counting, the raise-to-wake gesture and activity detection work this way all day without weighing too heavily on battery life.
Sensors and privacy
Location, camera and microphone permissions are very visible; motion sensor permissions much less so. Yet motion data reveals a lot: walking habits, sleep times, car journeys. Operating systems have introduced limits, such as lowering the sampling rate for apps that don't justify a higher one, and specific permissions for physical activity. It's worth checking which apps have access to physical activity and motion data, and revoking it from those that don't need it.
Practical uses and curiosities
- Some apps use the accelerometer as a spirit level or to measure an appliance's vibrations.
- With a suitable app, the magnetometer can help locate metal pipes or cables in a wall, with approximate results.
- A light sensor covered by a screen protector or a badly cut case drives auto-brightness haywire: a common and often overlooked cause.
- A dirty or covered proximity sensor makes the screen switch off during calls when it shouldn't, or stay on when it should switch off.
When a sensor isn't working
- Restart the phone: many problems are software-related.
- Remove the case and screen protector, especially near the top of the screen.
- Use the manufacturer's diagnostic menu, if there is one, or an app that shows raw values.
- Recalibrate the compass away from metal objects.
In short
- Accelerometer, gyroscope and magnetometer are MEMS sensors that measure movement, rotation and magnetic fields.
- Each sensor has weaknesses: sensor fusion combines them into a reliable orientation.
- The barometer detects changes in altitude, but absolute altitude also depends on the weather.
- Cases, screen protectors and magnets are frequent causes of wrong readings.
- Motion data is personal data: it's worth checking which apps can access it.