I purchased my sensor from Amazon. This was by far my worst online shopping experience. The first sensor that I received was broken. The new sensor came in a reasonable amount of time however they sent me a different kind of sensor. On Amazon they advertise a MMA"7260" 3-
Axis accelerometer. I was sent a MMA"7361" 3 axis accelerometer


I am not sure what the big difference is between the two. The 7361 sensor has 10 pins and the 7260 has 8 pins. I had a lot more difficulty finding a tutorial online that focused on the 7361 sensor. But this YouTube video helped me figure out what pins did what.
I was able to test the sensor readings with a code I found on the Arduino site.
Arduino code
const int groundpin = 18; // analog input pin 4 -- ground
const int powerpin = 19; // analog input pin 5 -- voltage
const int xpin = A3; // x-axis of the accelerometer
const int ypin = A2; // y-axis
const int zpin = A1; // z-axis (only on 3-axis models)
void setup()
{
// initialize the serial communications:
Serial.begin(9600);
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
pinMode(groundpin, OUTPUT);
pinMode(powerpin, OUTPUT);
digitalWrite(groundpin, LOW);
digitalWrite(powerpin, HIGH);
}
void loop()
{
// print the sensor values:
Serial.print(analogRead(xpin));
// print a tab between values:
Serial.print("\t");
Serial.print(analogRead(ypin));
// print a tab between values:
Serial.print("\t");
Serial.print(analogRead(zpin));
Serial.println();
// delay before next reading:
delay(500);
}
The accelermoeter isn't too sensitive but its just right for my project.

My Fritzing diagram isn't too clear. My MMA7361 sensor wasn't an option. The wiring is still accurate.

No comments:
Post a Comment