Our Playground

Using Accelerometer as Inertial Measurement Unit

Posted in Control Engineering, Microelectronics by Zulkarnaen on August 13, 2009

Before I start, I am going to answer some question that might pop-up in your mind when you read the title.

Q: What is accelerometer?

A: For the sake of simplicity accelerometer is a device that measures acceleration including gravitation and vibration.

Q: Where can we find it?

A: Decades ago this technology was affordable only for highly funded industries like defense and aerospace, but nowadays we can find it almost everywhere such as iPhone, Wii gamepad, digital camera, car airbag and many more. Thanks to the advancement in MEMS technology. MEMS is abbreviation for Micro-Electro Mechanical System. This technology enables you to build electro mechanical device in a microscopic scale. The picture below might give you the idea about MEMS. The spider mite size is around 0.5 mm to 1 mm.

Mite Approaching the Gear Chain, Courtesy of Sandia National Laboratories, SUMMiTTM Technologies, www.mems.sandia.gov

Q: How does it work?

A: At first it was just a water tube containing air bubble which indicates the direction of the acceleration. Nowadays MEMS accelerometer can be classified to several types based on its sensing elements and principle of operation. The one that I am using is based on polysilicon surface-micromachined sensor. A good further reference about how an accelerometer works can be found here.

Q: Now, what is Inertial Measurement Unit?

A: Inertial Measurement Unit (IMU), which is the combination of accelerometer and gyroscope, senses motions that occur to it. Accelerometer provides us linear acceleration while gyroscope provides us rate angular. By combining those data we can know the angle, that’s basically how tilt measurement in iPhone and Wii gamepad, although those devices only use accelerometer.

Well that’s it for introduction, for further basic information you can search it through website =). What I am going to explain in this article is about how to measure pitch, roll, or yaw using accelerometer.

To measure tilt, you can follow these steps:

  1. You need at least 2 axis accelerometers. Two axis accelerometer means that you are going to need two accelerometers that measure two different axis. Try this ADXL203. This sensor already embedded two accelerometers inside a single IC.

  2. Read the output from both axis. Usually you need Analog to Digital Converter (ADC) to get digital value of the output.
  3. Normalize the data. The output from the sensor is always positive. You can check it at their datasheet if you don’t believe me =). Here, I’ll give you a snapshot from the datasheet.

    As you noticed from the picture above when the sensor experiencing 0g, the output of the sensor would be 2.5 V*. Let’s say you are using 10 bit ADC, at 0g you’ll get the reading of 512. So all you have to do to normalize the data is by subtracting the ADC data with 512.

    ADCx,norm = ADCx,sampled – ADC@0g

    ADCy,norm = ADCy,sampled – ADC@0g

  4. The next step is using a simple trigonometry equation. See the picture below.

    We can find θ by using

    θ = arctan(ax / ax)

    θ = arctan((ADCx,norm . Const) /
    (ADCx,norm . Const))**

    θ = arctan(ADCx,norm /ADCx,norm)

    or in C language

    θ = atan2(ADCx,norm, ADCy,norm)

The graphic below is an example of data that was taken from a two axis accelerometer. The accelerometer was rotated clockwise and counterclockwise.

The data seemed good enough, but you will notice that if the condition a little bit changed the data would become bad. The graphic below was taken when the accelerometer was rotated clockwise and counterclockwise plus translation movement.

As you can see, the tilt measurement is disturbed when there is translation movement due to measurement of linear translation by the sensor. We can’t compensate this disturbance if we only have accelerometer. The key to overcome this disturbance is by combining this data with data from gyroscope, which I will cover in another article.

*) The 2.5 V at 0g is not always true. It depends on several factor, one of them is the voltage of you power supply.

**) Const is used to transform from ADC data to acceleration (ax and ay) in (m/s2).

Reference:

  1. http://www.memsuniverse.com/?page_id=1548
  2. http://www.analog.com/static/imported-files/data_sheets/ADXL103_203.pdf
  3. http://www.sensr.com/pdf/practical-guide-to-accelerometers.pdf
Tagged with: , ,

Leave a Reply