Setting up ADXL213EB Accelerometer with Arduino ISSUE

:slight_smile: Hello :slight_smile:

I'm a newbie to using arduino or any electronics whatsoever...

I am currently trying to test out the ADXL213EB accelerometer I have purchase from Analog Devices.
The code I am using is:
const int xpin = A1;
const int ypin = A0;

void setup()
{
Serial.begin(9600);
}

void loop()
{
Serial.print(analogRead(xpin));
Serial.print("\t");
Serial.print(analogRead(ypin));
Serial.println();
delay(100);
}

Accelerometer spec sheet:
http://www.analog.com/static/imported-files/eval_boards/53621793629198ADXL213EB_0.pdf

I have attached a photo of the setup that I have right now.
The green wire is connected to the positive probe of a 5 V power supply.
The top red wire is connected to the negative probe of a 5 V power supply.
The blue wire is connected to ground of the arduino and accelerometer evaluation board.
The white wire is for x-axis.
The bottom red wire is for y-axis.

Using this setup with the code above, I am getting a reading but only 2 values (1023 and 0) are showing for both x and y axis.

When this setup is used with a oscilloscope, I get proper duty cycle reading.

What is the problem?

THANKS IN ADVANCE!

bump

Hi, have you moved and turned and twisted the unit to see if you get any changes, don't forget you have 1g acceleration all the time in the down direction.
To test if you are reading input correctly, connect each analog input to gnd then 5V, you should see 0 for 0v and 1023 for 5V.

Tom.... :slight_smile:

I have tried moving and turning and twisting the unit to see if there are any changes.
When the unit is set down as shown in the picture the values alternate from 1023 to 0 repeatedly. When it is tilted one way, the value for x-axis or y-axis, depending on the direction it was tilted will maintain showing 0 or 1023 without changing repeatedly.

What I need to figure out is to show the exact angle that the unit is tilted at..so I need to see various values and not just 0 or 1023.