Accelerometer issues

Hello,

I am trying to get acceleration value with the use of accelerometer with Arduino.

But every time I am getting the same acceleration, the value is not changing.

I am new in Arduino. Accelerometer model no is ADXL 327.

I have also attached the code that I am using.

Can anyone help me here so that I can fix the issue.

Thanks

Accelerometer.ino (812 Bytes)

Please read the "How to use this forum" post.

What value do you get?

Post a hand drawn wiring diagram. Did you connect ground and power?

Also, always post the code using code tags, like the following (which you should try out).
Note that the map() function works with INTEGERS ONLY.

void setup()
{
  // Initialize serial communication at 115200 baud
  Serial.begin(115200);
}



void loop()
{
  // Get and print raw accelerometer data for each axis
  int rawX = analogRead(A1);
  int rawY = analogRead(A2);
  int rawZ = analogRead(A3);
  Serial.print("X: ");
  Serial.print(rawX);
  Serial.print(", Y: ");
  Serial.print(rawY);
  Serial.print(", Z: ");
  Serial.println(rawZ);
}

If the accelerometer is sitting on a bench it will read constant. If you are shaking or moving it in one direction but reading a different axis it will be fairly constant. If you are trying to measure small acceleration from a high G accelerometer it will read fairly constant. If the sensor is not powered correctly it will probably read min or max voltage all the time.

Make sure the sensor is powered. You are using 3V or 3.3V, correct? If you power the sensor with 5V it might be damaged.

With the sensor powered, measure the three output signals with a DMM. Sitting on the bench, two of them should read approximately 1/2 the supply voltage, the other should read different. Do your ADC readings agree with your measurements?