A beginner’s guide to accelerometers

What is an accelerometer?
An accelerometer is an electromechanical device that will measure acceleration forces. These forces may be static, like the constant force of gravity pulling at your feet, or they could be dynamic - caused by moving or vibrating the accelerometer.

What are accelerometers useful for?
By measuring the amount of static acceleration due to gravity, you can find out the angle the device is tilted at with respect to the earth. By sensing the amount of dynamic acceleration, you can analyze the way the device is moving. At first, measuring tilt and acceleration doesn't seem all that exciting. However, engineers have come up with many ways to make really useful products with them.

An accelerometer can help your project understand its surroundings better. Is it driving uphill? Is it going to fall over when it takes another step? Is it flying horizontally or is it dive bombing your professor? A good programmer can write code to answer all of these questions using the data provided by an accelerometer. An accelerometer can help analyze problems in a car engine using vibration testing, or you could even use one to make a musical instrument.

In the computing world, IBM and Apple have recently started using accelerometers in their laptops to protect hard drives from damage. If you accidentally drop the laptop, the accelerometer detects the sudden freefall, and switches the hard drive off so the heads don't crash on the platters. In a similar fashion, high g accelerometers are the industry standard way of detecting car crashes and deploying airbags at just the right time.

triple axis accelerometer

How do accelerometers work?
There are many different ways to make an accelerometer! Some accelerometers use the piezoelectric effect - they contain microscopic crystal structures that get stressed by accelerative forces, which causes a voltage to be generated. Another way to do it is by sensing changes in capacitance. If you have two microstructures next to each other, they have a certain capacitance between them. If an accelerative force moves one of the structures, then the capacitance will change. Add some circuitry to convert from capacitance to voltage, and you will get an accelerometer. There are even more methods, including use of the piezoresistive effect, hot air bubbles, and light.

What things should I consider when buying an accelerometer?
Analog vs digital - First and foremost, you must choose between an accelerometer with analog outputs or digital outputs. This will be determined by the hardware that you are interfacing the accelerometer with. Analog style accelerometers output a continuous voltage that is proportional to acceleration. E.g. 2.5V for 0g, 2.6V for 0.5g, 2.7V for 1g. Digital accelerometers usually use pulse width modulation (PWM) for their output. This means there will be a square wave of a certain frequency, and the amount of time the voltage is high will be proportional to the amount of acceleration.

If you are using a BASIC Stamp, or any other microcontroller with purely digital inputs, you will most likely need to go for a digital output accelerometer. The disadvantage here is that it requires you to use the timing resources of the microcontroller to measure the duty cycle, as well as performing a computationally intensive division operation.

If you are using a PIC/AVR/OOPIC/Javelin with analog inputs, or a completely analog based circuit, analog is almost always the best way to go. Depending on the compiler, measuring analog acceleration can be as simple as acceleration=read_adc(); and can be done in a few microseconds.

Number of axes - For most projects, two is enough. However, if you want to attempt 3d positioning, you will need a 3 axis accelerometer, or two 2 axis ones mounted at right angles.

Maximum swing - If you only care about measuring tilt using earth's gravity, a ±1.5g accelerometer will be more than enough. If you are going to use the accelerometer to measure the motion of a car, plane or robot, ±2g should give you enough headroom to work with. For a project that experiences very sudden starts or stops, you will need one that can handle ±5g or more.

Sensitivity - Generally speaking, the more sensitivity the better. This means that for a given change in acceleration, there will be a larger change in signal. Since larger signal changes are easier to measure, you will get more accurate readings.

Bandwidth - This means the amount of times per second you can take a reliable acceleration reading. For slow moving tilt sensing applications, a bandwidth of 50Hz will probably suffice. If you intend to do vibration measurement, or control a fast moving machine, you will want a bandwidth of several hundred Hz.

Impedance/buffering issues - This is by far the single most common source of problems in projects involving analog accelerometers, because so few people thoroughly read the required documentation. Both PIC and AVR datasheets specify that for A-D conversion to work properly, the connected device must have an output impedance under 10kΩ. Unfortunately, Analog Devices' analog accelerometers have an output impedance of 32kΩ. The solution to this is to use a low input offset rail to rail op amp as a buffer to lower the output impedance. As far as we know, the DE-ACCM is the only accelerometer solution that takes care of this problem for you.

Where can I find more information on accelerometers?
Texas Instruments has a great accelerometer guide, including how to do some of the necessary math.
The DE-ACCM datasheet has several examples of how you can use accelerometer readings to determine tilt and acceleration values.
If you really want to get into the hardcore low level details of accelerometers, and want to try soldering surface mount packages, Analog Devices has a huge selection of datasheets covering both analog and digital PWM style devices.