Categories

MMA7455 accelerometer example

The MMA7455 accelerometer is a 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 requires VCC, GND , SCA and SCL to be connected.

Here is a picture of the sensor breakout.

 

MMA7455 Accelerometer Sensor Module

MMA7455 Accelerometer Sensor Module

Here is how to wire the MMA7455 accelerometer to your Arduino

Schematic/Layout

 

MMA7455 Accelerometer to arduino

MMA7455 Accelerometer 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

Share

Comments are closed.