Telling tilt orientation with accelerometer

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

Do you ever wonder how your cell phone or tablet knows when you have tilted it? They “have always” known which way is up and act accordingly. Even some cameras will rotate your pictures if you took it with the camera sideways. Well, let’s see what help they got.

In the not so distant past,one can tell orientation with a simple tilt sensor. If you have peeked inside of an old thermostat, you must have seen a springy coil and a glass container with shiny liquid inside it. The liquid is mercury.

Here is an awesome periodic table of elements: http://www.periodictable.com/index.html

Here is mercury: http://www.periodictable.com/Elements/080/index.html

Mercury is a metal and is in its liquid state under room temperature. It is a good conductor for electricity. Mercury is sealed inside of a glass tube. Metal contacts are brought inside of the tube. In the above picture, if you tilt the switch clockwise, mercury will flow to the right, making the two metal prongs connect, and a circuit will be closed (turn on the heat). If you tilt it counterclockwise enough, mercury will flow to the left end of the tube, breaking contact between the two metal prongs and opening the circuit (turn off the heat). If you mount this switch on top of a bi-metal metal coil, you will get a temperature control mechanism to control room temperature.

Another type of tilt sensor is a ball sealed inside of a tube. It is essentially the same as the mercury in a glass tube but is much safer now that people know how bad mercury is.

Some early products that had tilt sensing must have used these. The sensitivity is low and you need to debounce to get a reliable reading.

The tilting sensing capability that our current-day devices have come from accelerometers, micro-machined structures that respond to accelerations in general, gravitation in specific. Imagine a mass suspended below a spring. This is how we weight a product with a spring scale. The weight of an object is proportional to its mass and the spring will stretch proportional to force applied to it. We tell weight from how much stretch we see on the spring. Without the earth gravity, the mass will have zero weight, and won’t stretch the spring. If you take the spring scale and suddenly yank it upwards, the spring stretches even more than when it’s staying still with the mass. If you did the opposite, giving the spring a downward acceleration, the spring stretches less than when it’s still.

Using this mechanism and micro-machining, this spring and mass can be shrunk so much that it fits in a small chip less than the size of your finger tip. As many as three of these structures can be made together to give the chip 3-D sensing on its acceleration.

Here is an image of an accelerometer from sparkfun, which I used in a project. It is able to detect acceleration due to gravity.

When the accelerometer is staying statically, it senses the gravitational acceleration and its projection or components along the board’s x-y-z axes. You need basic vector concept to find out the angle of tilt from the components of acceleration measured by the accelerometer. The most basic information that one could get is, which side is up. Say if you read the accelerometer and your x acceleration is exactly one g, then x axis must be facing downwards, making -x direction facing upwards. The cell phones and tablets can then readjust their display to adapt the rotation.

I have started a project of a music box, which contains an accelerometer. You can tap on the box to play a tone that is written on the top of the box. You want another tone, turn the side of the box with that tone upward and tap, the box plays the tone. I have made a prototype last night and will explore ways to make it good looking and more responsive.

When the accelerometer is accelerating with the object that is attached to it, it measures the combined acceleration of the earth and the apparent motion. An application of this is the Nintendo Wii remote controller. One can swing the controller, shake it or else to swing a sword or else in a video game. You can also measure acceleration of an amusement park ride or a car taking a high way exit or racing on a race track. I plan to post a project that uses the accelerometer in explaining physics, in the near future.

One Response to Telling tilt orientation with accelerometer

  1. Pingback: Music box « Liudr's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: