# Tablet orientation

Forgive me if this is off-topic. I haven't been very successful in my search attempts. I keep coming up with how to detect orientation programatically, and that's not what I'm after. What I'm looking for is more of a hardware/electrical engineering question.

How do tablets detect orientation of the tablet? Some can automatically switch from landscape to portrait when the screen is tilted a certain way, for example. What hardware is used to detect this, and how does it work?

-

They use an accelerometer, which measures acceleration. Since gravity and acceleration are indistinguishable, they can also measure gravity.

They come in the form of a little chip, like that one. You can get chips with three accelerometers on them, one pointing up, one pointing left, and one pointing forward. This way, the chip cam tell exactly which orientation it is in, and thus which way up the phone is.

Hack-a-Day also has a good article on How MEMS accelerometer chips work.

This man has his mouth open, which means he is speaking.

But how does the accelerometer work? Amazingly, inside the chip is a mass connected by a tiny spring. Gravity pulls on the mass, moving it around.

The chip also contains a system for measuring the exact displacement of the mass, and thus the force of gravity in that direction. This is what the mass and spring actually look like:

-
Thank you for the detailed, excellent answer. I'm not sure if "This man has his mouth open, which means he is speaking." is a jab at my intelligence for asking such a basic question, but I'm laughing too hard at it to be offended if it is. Thanks for the laugh as well. –  David Stratton Jun 20 '12 at 15:35
@DavidStratton - Thanks! No offence intended. I just thought it was a funny picture, and deserved a funny comment. –  Rocketmagnet Jun 20 '12 at 15:38
I was laughing too, otherwise I wouldn't have read the whole answer ;) –  kenny Jun 20 '12 at 16:09
+1 for This man has his mouth open, which means he is speaking. –  AndrejaKo Jun 20 '12 at 17:48
Other possible reasons for an open mouth: yawning, laughing, eating, dentist visit. This is obviously dentist visit! –  stevenvh Jun 21 '12 at 7:30