Hand holding phone with axis.
Miss Namfon Samart/Shutterstock.com

Smartphones do a lot of things that we never think twice about. For example, you can simply turn your phone sideways and it knows to rotate what’s on the screen. That’s super useful, but how does it actually work?

It’s no mystery that smartphones contain a lot of fancy 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?

Accelerometer

The accelerometer is the sensor that most people may be familiar with. As the 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 with time. Essentially, the accelerometer is detecting movement. The movement is detected in relation to gravity. That means the accelerometer data would only be at 0 in a free fall. The actual output is gravity + true acceleration.

This is why the accelerometer alone isn’t enough to detect the phone’s rotation. Once the phone starts moving, gravity skews the data. So the accelerometer is actually detecting what is called “perceived gravity.” To get true acceleration, it needs some help.

Gyroscope

The gyroscope is used to measure how much the device has been rotated and in which direction. Unlike the accelerometer, the gyroscope doesn’t worry about gravity. Its position is only referenced to itself.

Advertisement

This causes a few problems. Every time your device is rotated in a certain direction it is compared to the previous rotation that occurred. Over time, this causes “drift” to accumulate, which makes the errors get bigger and bigger over time.

Enter the accelerometer. The rotational information from the gyroscope along with the accelerometer’s gravity information enables 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 Display without Tilting

Magnetometer

The last sensor of the trifecta is the magnetometer. A magnetometer is essentially a compass, it can tell you which direction is north. This sensor is used to detect which direction the device is moving in relation to the ground.

However, a magnetometer needs rotational information to calculate which direction the phone is facing. So when it’s combined with the gravitational information and true acceleration, you get the complete picture of which orientation the device is in.

RELATED: How to Lock Your iPhone or iPad's Screen Orientation

Three Sensors Working as One

Gyroscope, accelerometer, compass
Gyroscope, accelerometer, compass, and barometer on one board. Igor Podgorny/Shutterstock.com

Pretty cool stuff, right? I think many of us assume there is just one sensor that can detect the orientation of the phone, but it’s much more complicated than that. There are three sensors constantly correcting each other and working together.

Advertisement

It just goes to show that the technology inside smartphones is incredibly sophisticated. Things we take for granted and use multiple times a day are thanks to finely-tuned sensors and complex calculations. You’ll have a new respect the next time you turn your phone to watch a YouTube video.

Profile Photo for Joe Fedewa Joe Fedewa
Joe Fedewa is a Staff Writer at How-To Geek. He has been covering consumer technology for over a decade and previously worked as a News Editor at XDA Developers. Joe loves all things technology and is also an avid DIYer at heart. He has written thousands of articles, hundreds of tutorials, and dozens of reviews.
Read Full Bio »