ADXL330 accelerometer help

I have an ADXL330 accelerometer (XYZ) and an Arduino Diecimila board.... I downloaded the code that was on this site for this item but my values appear to be constant. I hooked it up just like shown on the site.... also messed with the delay taking it from the initial value of 1000 to 50 but I still get nothing but the following.....

1023 1022 1023
1022 1022 1023
1022 1022 1022
1023 1022 1023

Any Ideas ?????

The setup I followed means the ADXL is getting 5v which is above it's range of 1.8v to 3.6v. Could this be doing it ??

I am pathetic at electronics so whatever guidance you give, dummy it down a bunch. ;D Thanks for any help you can give !

HERE'S THE CODE:

int groundPin = 18; // analog input pin 4
int powerPin = 19; // analog input pin 5
int xpin = 3; // x-axis of the accelerometer
int ypin = 2; // y-axis
int zpin = 1; // z-axis (only on 3-axis models)

void setup()
{
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()
{
Serial.print(analogRead(xpin));
Serial.print(" ");
Serial.print(analogRead(ypin));
Serial.print(" ");
Serial.print(analogRead(zpin));
Serial.println();
delay(1000);
}

When you get 1023 this is the maximum value from a 10 bit variable with all the bits set to 1.
In other words there is no real output from you sensor and the pins are seeing the full 5V.
Try disconnecting one of the input pins and putting it to GND so you see one input change.

However, taking a device above it's voltage rating is almost always guaranteed to fry it. At the very least stop it working correctly.

Feed it with the proper voltage first but if no joy it looks like you will have to get another one.

The setup I followed means the ADXL is getting 5v which is above it's range of 1.8v to 3.6v. Could this be doing it ??

The ADXL330 requires 1.8 to 3.6V power supply . Powering with 5V will very likely destroy it, although the datasheet also says damage only occurs above 7V (see page 4 under "absolute maximum ratings"). In any case, you need to get the proper 3.3V supply on it.

D

Dear Freinds

I'm using ADXL330 for measuring tilt,but I can't find a formula for convert output voltage of sensor to angle (degree).

How can I calculate it.

TNX

joodi_abot@ymail.com

Hey.. I can looking for the same exact thing. i.e. formula to covert the analog sensor values to tilt angle.

Any luck so far??

Thanks a lot. Really appreciate it.

Depends which axis you're using, but you might want to look at the "sine" function.
Don't forget to work in radians.