Accelerometer – MMA7260Q

Check out accelerometer comparison from sparkfun

The MMA7260Q is a 3-axis accelerometer from Freescale Semiconductor with a low power shut-down mode and high sensitivity output with selectable ranges (±1.5, 2, 4, and 6g)

The MMA7260QT is a 3.3V part and outputs an analog voltage for each of the three outputs. This voltage is in ratio to the measured acceleration and to the supply voltage (ratiometric).

Some of the text here is based on Tom Igoe’s tutorial for the MMA7260Q.

THIS IS A 3.3V PART!

DO NOT CONNECT THIS STRAIGHT TO THE BU0836 JOYSTICK CONTROLLER! THE BU0836 OPERATES AT 5V AND WILL FRY THIS SENSOR IF CONNECTED TO IT!

DO NOT CONNECT THIS TO THE 5V PIN ON THE ARDUINO! USE THE 3.3V PIN TO POWER THIS SENSOR!

Arduino Connection

  • VCC to 3V3
  • GND to GND
  • X to Analog In 0
  • Y to Analog In 1
  • Z to Analog In 2
  • GS1 – GND or 3V3 (see below for explanation)
  • GS2 – GND or 3V3 (see below for explanation)
  • SLP (sleep) – 3V3 (see below for explanation)

You can adjust the sensitivity of the sensor with the GS1 and GS2 pins. The higher the G-range the more force you can apply to the sensor. For low-force applications like sensing the tilt of an object 1.5G or 2G is enough. Connect the pins according to your needs by following this table.

GS1 GS2 G-range Sensitivity
GND GND 1.5g 800mV/g
GND 3.3V 2g 600mV/g
3.3V GND 4g 300mV/g
3.3V 3.3V 6g 200mV/g

The sleep pin puts the accelerometer in a low-current inactive mode. To put the accelerometer to sleep, take the sleep pin low (connect to GND). To activate the accelerometer, take it high (connect to 3.3v).

Arduino Code

    // Reads values from an accelerometer with X, Y and Z connected to analog
    // inputs 0, 1 and 2 respectively and prints out the values via the serial port.
    int x, y, z;
    void setup()
    {
    Serial.begin(9600);           // sets the serial port to 9600
    }
    void loop()
    {
    x = analogRead(0);       // read analog input pin 0
    y = analogRead(1);       // read analog input pin 1
    z = analogRead(2);       // read analog input pin 2
    Serial.print("accelerations are x, y, z: ");
    Serial.print(x, DEC);    // print the acceleration in the X axis
    Serial.print(" ");       // prints a space between the numbers
    Serial.print(y, DEC);    // print the acceleration in the Y axis
    Serial.print(" ");       // prints a space between the numbers
    Serial.println(z, DEC);  // print the acceleration in the Z axis
    delay(100);              // wait 100ms for next reading
    }