Feedback!

MMA8453 Accelerometer Library

Views: 3337 Difficulty: 2 Status: Development
Screenshot_2014-06-29_14.18.51

An arduino library for the MMA8453 Triple Axis Accelerometer

The MMA8453Q is a cute little surface-mount triple-axis accelerometer chip from Freescale Semiconductor. It communicates over the I2C protocol so it is easy to interface with many microcontrollers especially Arduinos! Here we have an Arduino library, which abstracts away many of the nasty details of talking to the chip. It just gives you the values you want, namely the X, Y and Z accelerations. We use these bad boys all the time for eample in our Wearable Wayfinder, Leo Gamer and HID3D projects. The example code prints these values out on the serial port. You can use accelerometers as a tilt sensors.

The MMA8453Q From Freescale Semiconductor

Screenshot_2014-06-29_14.18.51
The accelerometer chip!

Arduino Code for The MMA8453 Accelerometer

Here is a little code snippet to spit the values of the MMA8453 Accelerometer out on the Serial port. Make sure to include the I2C library and the MMA8453 library in the sketch. You can download them both lower down on this page!
#include "I2C.h"
#include "MMA8453Q.h"

MMA8453Q accelerometer;
Now get accelerometer readings with the functions getX(), getY(), and getZ(), as in:
int x  = accelerometer.getX();
The values can be positive or negative and range from -512 to 512. See the entire example sketch below.
#include <I2C.h>
#include <MMA8453Q.h>

MMA8453Q accelerometer;

void setup()
{
  Serial.begin(9600);
}
 
void loop()
{
  Serial.print("X:");
  Serial.print(accelerometer.getX());
  Serial.print(", Y:");
  Serial.print(accelerometer.getY());
  Serial.print(", Z:");
  Serial.print(accelerometer.getZ());
  Serial.println();
  delay(300);
}

MMA8453Q Accelerometer Arduino Library

A clean and simple library for interfacing with the MMA8453Q chip built on top of Kerry Wong's post and ninjablocks work. We had to change the address to:
const byte I2C_ADDR = 0x1C; //SA0=0
previously it had been 0x1D. Download the MMA8453Q Accelerometer library from Github!

I2C Arduino Library

Similar to the wire library but more flexible. You may wonder why we cannot use the standard Arduino Wire library, it is because the MMA8453Q uses a repeated start condition for the read operations and the default Wire library cannot handle those without modification.
Click Here to Download: I2C Arduino Library
Permalink: http://lucidtronix.com/tutorials/61
The Wearable Wayfinder is a totally programmable, beautiful little computer for your wrist packed wit...
Here is another arduino library to handle Hue, Saturation, and Brightness as well as Red, Green, and ...
A library to interface Arduino code with the 3 Axis L3G4200D gyroscope....
3d view of a face using an SD card, accelerometer and a TFT LCD Screen...
Play pong on a little LCD screen with two big joysticks....
32 buttons for a fully-functioning hand-held USB keyboard....
Wearable digital compass displays the direction in green LEDs....
Coupling the HMC5883L Compass with our color library turns the Wearable Wayfinder into a handy naviga...