Home ArduinoArduino Tutorials Arduino and a MMA7455 accelerometer

Arduino and a MMA7455 accelerometer

by iainhendry71

The MMA7455 accelerometer is a fairly low cost sensor that can measure acceleration in three axes. This sensor is commonly available as a breakout board that you can connect to your Arduino. It only requires VCC, GND , SCA and SCL to be connected.

The wiring diagram is underneath but here is the picture of the sensor breakout we bought which is available from many sources.

 

MMA7455 Accelerometer Sensor Module

MMA7455 Accelerometer Sensor Module

Schematic/Layout

 

MMA7455 Accelerometer Sensor Module to arduino

MMA7455 Accelerometer Sensor Module to arduino

Code

You will need a copy of the MMA_7455 library to make your life easier. Download and copy to your Arduino -> Libraries folder

This example simply displays the X, Y and Z axes settings in the serial monitor

 

#include <Wire.h> //Include the Wire library
#include <MMA_7455.h> //Include the MMA_7455 library

MMA_7455 mySensor = MMA_7455();

char xVal, yVal, zVal;

void setup()
{
Serial.begin(9600);
delay(500);
Serial.println(“MMA7455 Accelerometer Test.”);
mySensor.initSensitivity(2);
}

void loop()
{
xVal = mySensor.readAxis(‘x’); //Read the ‘x’ Axis
yVal = mySensor.readAxis(‘y’); //Read the ‘y’ Axis
zVal = mySensor.readAxis(‘z’); //Read the ‘z’ Axis
Serial.print(“X = “);
Serial.print(xVal, DEC);
Serial.print(” Y = “);
Serial.print(yVal, DEC);
Serial.print(” Z = “);
Serial.println(zVal, DEC);
delay(1000);
}

Links

MMA7455 Accelerometer Sensor Module on Amazon UK

MMA7455 Accelerometer Sensor Module on Amazon US

You may also like