Initial report by Tom Igoe, 3 Sept. 2005

The MMA7260Q is a 3-axis accelerometer from Freescale Semiconductor. I bought mine from Sparkfun, because they sell a nice breakout board for it so you don't have to mess with surface-mount soldering yourself.


image from http://www.sparkfun.com

An accelerometer measures acceleration (change in speed) of anything that it's mounted on. Single axis accelerometers measure acceleration in only one direction. Dual-axis acceleromters, which are the most common, measure acceleration in two directions, perpendicular to each other. Three-axis accelerometers measure acceleration in three directions.

Accelerometers are very handy for measuring the orientation of an object relative to the earth, because gravity causes all objects to accelerate towards the earth. A two-axis accelerometer can be used to measure how level an object is.

(this would be a good place to fill in equations to calculate a body's angle from the X and Y accelerations on the body).

With a three-axis accelerometer, you can measure an object's acceleration in every direction.

Applications

Accelerometers are real workhorses in the sensor world because they can sense such a wide range of motion. They're used in the latest Apple Powerbooks (and other laptops) to detect when the computer's suddenly moved or tipped, so the hard drive can be locked up during movement. They're used in cameras, to control image stabilization functions. They're used in pedometers, gait meters, and other exercise and physical therapy devices. They're used in gaming controls to generate tilt data. They're used in automobiles, to control airbag release when there's a sudden stop. There are countless other applications for them.

Electrical Characteristics

MMA7260Q datasheet. The datasheet is fairly well-written and straightforward. It's a useful resource.

The MMA7260Q operates on 2.2-3.6VDC, and uses very little current (500uA). It has three analog outputs, one for each axis. Acceleration on each axis generates a voltage from 0 to approximately 3.3V.

When there's no acceleration on a given axis, the output for that axis outputs half the supply voltage, or about 1.65V. With acceleration in a positive direction along the axis, the output voltage for that axis rises. With negative acceleration along the axis, the voltage goes down. In other words:

  • at rest the voltage is in the middle;
  • at full forward acceleration, the voltage is at its highest;
  • at full backward acceleration, the voltage is at its lowest.

Pin Descriptions

These pin descriptions refer to Sparkfun's breakout board. Sparkfun has helpfully added the necesary capacitors and resistors to each output pin so you don't have to. Here is the schematic of the Sparkfun breakout board.

The pins of the accelerometer are as follows:

  1. Vcc - Voltage, 3.3V
  2. GND - Ground
  3. X - X axis output, 0 - 3.3V
  4. Y - Y axis output, 0 - 3.3V
  5. Z - Z axis output, 0 - 3.3V
  6. GS1 - G-select 1
  7. GS2 - G-select 2
  8. SLP - sleep

The GS1 and GS2 pins allow you to set the accelerometer's sensitivity, depending on how much force it will be subjected to in your application. For low-force activities like measuring the tilt of an object, the lowest setting, 1.5g, is probably enough. If it's going to be attached to a crash-test dummy, you might want to set the sensitivity to the full 6G, or get a better accelerometer. To set the sensitivity, connect the GS1 and GS2 pins as follows:

GS1GS2G-rangeSensitivity
GNDGND1.5g800mV/g
GND3.3V2g600mV/g
3.3VGND4g300mV/g
3.3V3.3V6g200mV/g

In the schematic below, the accelerometer is connected to a PIC microcontroller running on 5V, so a 3.3V zener diode and 10Kohm resistor were added to the GS1 and GS2 pins to limit the incoming voltage to 3.3V.

The sensitivity of the accelerometer can be changed on the fly, so you could connect the GS1 and GS2 pins to pins of your microcontroller and change the sensitivity by taking the appropriate microcontroller pins high or low.

The sleep pin puts the accelerometer in a low-current inactive mode. To put the accelerometer to sleep, take the sleep pin low. To activate the accelerometer, take it high (3.3v). Note: I originally had a 3.3V zener diode and 10Kohm resistor connecting the sleep pin to the PIC, but I found that I had to eliminate them in order to get consistent performance. Your mileage may vary --tigoe

Microcontroller Connections

To connect the accelerometer to a PIC, use this schematic:

Parts list:

  • MMA7260Q accelerometer on Sparkfun breakout board
  • MIC29150-3.3BT 3.3V voltage regulator
  • 2 - 10Kohm 0.25-watt resistors
  • 2 - 1N5226B-T 3.3V zener diodes

Code Sample

Here's a PicBasic Pro code sample for the accelerometer.

Typical Behavior of the Accelerometer

Using the code above, I connected a PIC 18F452 to the accelerometer, and sent the results into this Processing datalogging example. I got some the following results:

This graph shows the X axis. The accelerometer starts level, then is tilted to the left, then to the right, then level again:

This graph shows the Y axis. The accelerometer starts level, then is tilted forward, then back, then level again:

This graph shows the Z axis. The accelerometer is kept level, but raised up in a quick motion, then lowered quickly. Moving up produces a sudden increase in force (and voltage) followed by a sudden decrease when the movement's stopped, then finally the voltage levels out again. Moving down has the opposite effect.

if you were using the accelerometer to navigate in a virtual 3D space, you'd have to factor in the sudden decelerations that occur at the end of moving up or down, or the virtual object you're moving would probably have a very bouncy movement.

Application Notes

coming soon

Also, see Guy Lee's report here.