SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By dstpcm
#180504
I feel as though this is a fairly foolish question, but I can't find any answers online.
I am attempting to use an ADXL377 accelerometer connected to an arduino to measure impact forces. I have the accelerometer programmed to print the data in g's, and the accelerometer seems to simply measure changes in orientation of the accelerometer, not changes in velocity in linear directions. For example, if I shake it back and forth while it's laying flat on a table there is no change in the numbers. Is my interpretation of what an accelerometer's capabilities are mistaken or is there some sort of code I have to upload to the microcontroller to change what the accelerometer measures?

Thanks to anyone who can provide some insight.
By dstpcm
#180515
I just used code from the arduino website http://arduino.cc/en/Tutorial/ADXL3xx

/*
ADXL3xx

Reads an Analog Devices ADXL3xx accelerometer and communicates the
acceleration to the computer. The pins used are designed to be easily
compatible with the breakout boards from Sparkfun, available from:
http://www.sparkfun.com/commerce/categories.php?c=80

http://www.arduino.cc/en/Tutorial/ADXL3xx

The circuit:
analog 0: accelerometer self test
analog 1: z-axis
analog 2: y-axis
analog 3: x-axis
analog 4: ground
analog 5: vcc

created 2 Jul 2008
by David A. Mellis
modified 30 Aug 2011
by Tom Igoe

This example code is in the public domain.

*/

// these constants describe the pins. They won't change:
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(100);
}
By Valen
#180522
If it is sliding while flat on the table gravity is still the major acceleration pulling downwards, and your accelerating motion is directed sideways. So yeah, by means of vector addition of the X,Y,Z components this could look like tilting the device. Remember, the accelerometer measures the sum of all forces acting upon it along each axis.