MMA7260Q Accelerometer, Arduino and Processing

Introduction

Accelerometers can measure acceleration and tilt (angle). They are used in many devices nowadays such as Mobile phones (iPhone), Gaming consoles and gadgets (Nintendo Wii), Navigation (GPS navigators, Airplanes), and etc. In physical computing accelerometers are used to measure device’s position relative to the ground.  A simple Accelerometers can measure acceleration along one axis. Here, a simple program is presented that interfaces a 3-axis MMA7260Q accelerometer from Sparkfun to an Arduino board.

Circuit

Use a MMA7260Q “triple Axis Accelerometer Breakout board” from Sparkfun. Connect the board as shown below to an Arduino board:

Be careful while making connections to your Arduino, not to misconnect the Negative and Positive supply.

Code

Download the code for Processing and Arduino in a zip package here*. Unzip and upload the code provided for the Arduino to your Arduino board. Then run the code provided for Processing. Press ‘X’, ‘Y’, ‘Z’ key on your keyboard to see the real time graph for the corresponding axis on your screen.

The Arduino code sends three consecutive bytes by serial baudrate of 9600. On the computer side the processing program gets the data and translates the bytes (each byte for one axis[X,Y,Z]) into a graph representation.

*.The code is taken from here(Thanks to Daniel Goncalves)

Output of the program in Processing

More info

You can read how accelerometers work Here. For a more Interactive guide please check this link.

Advertisements

Comments are closed.