eli5: Hiw do devices know which way is “downwards” for it to know where to rotate


How do devices like phones or ipad know which way is “down” for them to auto rotate?

In: 13

I understand that they have in a chip a microscopic magnetic (?) gyroscope.

A phone uses a combination of sensors to determine which way is “downwards.” The most common sensors used for this purpose are the accelerometer and the magnetometer.

An accelerometer is a device that measures the acceleration of a device along a certain axis. In a phone, the accelerometer is used to measure the acceleration of gravity along the vertical axis, which allows the phone to determine the direction of “downwards.”

A magnetometer, also known as a digital compass, is a device that measures the strength and direction of the magnetic field in a certain point. In a phone, the magnetometer is used to measure the Earth’s magnetic field and determine the direction of magnetic north. By comparing the direction of magnetic north to the direction of gravity, the phone can determine its orientation in space.

Together these sensors are used to determine the phone’s orientation and position.

For a long time now phones have had 3-way accelerometers on them. These detect acceleration in each of the 3 dimensions. The assumption they make to detect rotation is that the phone is generally sitting still not experiencing any acceleration except for the force pushing it off the ground against the force of gravity. By looking at which direction the largest acceleration comes from the phone assumes this direction is down. Of course with a smoothing filter so that any random quick accelerations do not result in the screen rotating.

Although not needed for just getting the phone screen to rotate phones also come with a 3-axis gyroscope. This is more accurate at detecting rotation so that moving the phone side to side or such does not get mistakengly detected as rotating the phone. However it have no way of knowing exactly which way is down. The phones therefore use the accelerometer to constantly calibrate the gyroscope. But although this technique is used for more advanced motion tracking I do not think it is done for screen rotation because of the delay it usually take for the screen to rotate after you rotate your phone.

There are accelerometers in there that will measure how to phone moves. They will also measure gravity which it how it knows where down is.

Imagine a tiny box made of silicone. Then imagine that you carve away some of the box to leave a hollow section that has a long stick jutting into it. Like a hair or a toothbrush bristle. When your phone turns to the side, the little hair drops down and touches the side of the hollow section, and that little touch lets your phone know it is turned to that side.