A few benefits to the MMA7361 Acceleromter are that it can be set to detect +/- 1.5g or +/-6g. I also have a very low power consumption and its small size even with the breakout board makes it an ideal fit for any project. Not to mention the relatively low cost.
Step 1: Materials
1x MMA7361 Acceleromter - Sparkfun has one with a breakout board
1x Proto shield/perf board
The every project extras:
Sleep - 13
SelfTest/STP - 12
ZeroG/0G - 11
Gselect/GSel - 10
X axis - A0
Y axis - A1
Z axis - A2
VDD - 3.3 V
Next attach 2 buttons and 2 more LEDs on 4 other pins
Step 3: Programming
You will also need to add the accelerometer library. If you have not added a library before create a folder called "libraries" in your Arduino sketch folder and then drop the accelerometer folder inside of the attached libraries folder into your new "libraries" folder.
total_points - controls the number of recorded data points
const unsigned long loop_time - controls how often data is recorded ex. 5 corresponds to 5ms.
In order for the program to properly work the AcceleroMMA7361 library must be added to your Arduino library folder and the program restarted.
The maximum number of data points that can be collected on the Arduino SRAM is 700. Additional data points may be collected with a SD card or additional storage.
The scaling factor for the values found "x" is: ((x/100)-1)/acceleration due to gravity). Acceleration to gravity roughly equals 9.8 . The scaled values are in units of m/s^2.
To change how often data points are collected open the program file and change the constant integer loop_time to your desired time. This number is in milliseconds.
The LEDs correspond to each of the buttons and the following action. The button farthest from the accelerometer turns the green LED on and records values. The LED will turn off when pressed again and values will stop being collected. The red LED corresponds to the button closest to the accelerometer and lights up when values are being transmitted to the serial monitor.
The red LED will flash twice at the beginning to indicate that the start up loop and calibration has completed and data can now now be collected.
The most basic code for this to make sure everything is working is:
When rested flat on something the Z axis should read roughly 1 and the X and Y axis 0 each.
accelero.begin(13, 12, 11, 10, A0, A1, A2);
accelero.setARefVoltage(5); //sets the AREF voltage to 3.3V
accelero.setSensitivity(LOW); //sets the sensitivity to +/-6G
x = accelero.getXAccel();
y = accelero.getYAccel();
z = accelero.getZAccel();
Serial.print(" \ty: ");
Serial.print(" \tz: ");
delay(500); //make it readable
Step 4: Upload and Use
There are also several programs that came with the library which you can test and out modify yourself. I hope you enjoy this and please let me know your results!