Smartphones do a lot of things that we never think twice about. For example, you can just turn your phone sideways and it knows how to rotate what’s on the screen. It’s super useful, but how does it actually work?
It’s no mystery that smartphones contain a lot of sophisticated sensors. There’s a sensor for everything from brightness to room mapping. There are actually three sensors responsible for detecting the orientation of your phone. Let’s take a look at what they do.
RELATED: How does auto-brightness work on a phone or laptop?
The accelerometer is the sensor that most people may be familiar with. As its name suggests, it detects acceleration. The accelerometer detects acceleration in three directions: side-to-side, up/down, and forward/backward.
Acceleration is the rate at which velocity changes over time. Essentially, the accelerometer detects movement. Motion is detected with respect to gravity. This means that the accelerometer data would only be 0 in freefall. The actual output is gravity + actual acceleration.
This is why the accelerometer alone is not enough to detect phone rotation. Once the phone starts moving, gravity skews the data. So the accelerometer actually detects what is called “perceived gravity”. To get real acceleration, he needs help.
The gyroscope is used to measure how much the device has been rotated and in which direction. Unlike the accelerometer, the gyroscope doesn’t care about gravity. Its position refers only to itself.
This causes some problems. Each time your device is rotated in a certain direction, it is compared to the previous rotation that occurred. Over time, this causes “drift” to build up, making the errors bigger and bigger over time.
Enter the accelerometer. The rotation information from the gyroscope along with the gravity information from the accelerometer allows the device to calculate the true acceleration. The accelerometer is also used to reset the drift that occurs from the gyroscope.
RELATED: How to Manually Rotate Your iPhone or iPad Screen Without Tilt
The last sensor of the trifecta is the magnetometer. A magnetometer is basically a compass, it can tell you which direction is north. This sensor is used to detect in which direction the device is moving relative to the ground.
However, a magnetometer needs rotational information to calculate the direction the phone is facing. So when combined with the gravitational information and the actual acceleration, you get a complete picture of the orientation of the device.
RELATED: How to Lock Your iPhone or iPad Screen Orientation
Three sensors working as one
Pretty cool stuff, right? I think many of us assume that there is only one sensor that can detect the orientation of the phone, but it’s much more complicated than that. There are three sensors that constantly correct each other and work together.
It just goes to show that the technology inside smartphones is incredibly sophisticated. The things we take for granted and use many times a day are done so thanks to finely tuned sensors and complex calculations. You’ll get a new respect the next time you turn on your phone to watch a YouTube video.