Odd accelerometer problem

I have the Sparkfun Breakout of the ADXL335 triple axis accelerometer. http://www.sparkfun.com/products/9269 I have it configured on my UNO according to the Arduino tutorial. http://www.arduino.cc/en/Tutorial/ADXL3xx The problem I am experiencing is that the readings are not behaving anything at all like expected. Initially, if I tilted the accelerometer forward or back, the y reading would increase or decrease respectively, the z reading would decrease in either direction, and the x reading would not be affected. If I tilted the accelerometer right or left, the x reading would decrease or increase respectively, the z reading would decrease in both situations, and the y reading would not be affected. Now, when I tilt the accelerometer in any direction, all three readings decrease.

Any ideas as to why the change in behavior?

Have you checked that gravity is working normally where you are?

What do you mean? Are you joking?

on accelerometers.. (that I have played with).. in the datasheets.. it explains that the force of gravity (g) will always have a 'pull' on the chip..

usually these values/threshold needs to be zero'd (accounted for) out to get a firm/correct reading

not sure if this will help or not.. since your stating the same behavior is NOW giving different results.

Do you mean accounted for in programming or hardware? I'm displaying raw analog values with Serial.println(analogRead(either x,y,or z pin));

xl97: In the datasheets.. it explains that the force of gravity (g) will always have a 'pull' on the chip..

Just to be clear: I understand that x, y, and z will always give readings.

You'd have to check you specific accelerometer datasheet..

but the one I used to play with..

yes.

(depending on the orientation/location/mounting of the accelerometer).. you get readings on the board while doing nothing. this is gravity doing its job I guess.

You will need to account for/subtract (whatever) this 'constant' G-force in your code..

(unless you need/want it of course)

I can play with mine more once I get home..

Oh yes I see what you're saying. Using the data sheet was actually how I found out my accelerometer isn't working as expected.

I had an adxl321, I think, and then I shorted it. It died. No more reading in any axis. Is that a possibility? That was painful $30 loss for not disconnecting power while making changes.

liudr: It died. No more reading in any axis. Is that a possibility?

Fortunately I'm still getting consistant readings. The problem is that they are all at their maximum reading when the accelerometer is level, and they all drop if I tilt the accelerometer in any direction.

I tried switching from the AnalogOut Power configuration (from the directions in the Arduino tutorial) to the 3.3v port configuration. The x and z pins are now working as expected, but the y pin is still behaving strangely. It is increasing and decreasing as if it were the x pin...?

AnalogOut or maybe more appropriately called EXTERNAL will require you to connect a voltage to AREF pin otherwise all readings are 1023. That explained your previous observation. For the z axis, I'm not sure. What happens if you swap the channels between the z and x or y? Will the reading still be changing as if it were the x-axis?

liudr: AnalogOut or maybe more appropriately called EXTERNAL will require you to connect a voltage to AREF pin otherwise all readings are 1023. That explained your previous observation.

For future reference, I'm assuming that it would be appropriate to attach 3.3v pin to the AREF pin for the AnalogOut feature to use 3.3v?

For the z axis, I'm not sure. What happens if you swap the channels between the z and x or y? Will the reading still be changing as if it were the x-axis?

Unfortunately the y pin has changed it's behavior for the worse. It gives random values from an average by ±200 (raw value). It's behavior is the same when I switch the z and y pins (to be clear, I remembered to switch the way I read the serial monitor, and I checked that all hardware was wired in accordance with the programmed pins.)

Yes, your way of using the AREF is correct. For the large fluctuation, I am suspecting poor contact between the output and the input. Are you using a breadboard arduino? How are you connecting your wires? Pictures will save 1K words.

Since it's an analog accelerometer, the easiest way to test it is to connect the power (3.3v) to the accelerometer and put a meter on the X, Y and Z pins. If the readings are stable on the meter and vary according to tilt then you can be fairly sure the accelerometer is working and the problem lies in your interface. If the readings are not consistent with what the datasheet says then there is a problem with the accelerometer.

wayneft: Since it's an analog accelerometer, the easiest way to test it is to connect the power (3.3v) to the accelerometer and put a meter on the X, Y and Z pins. If the readings are stable on the meter and vary according to tilt then you can be fairly sure the accelerometer is working and the problem lies in your interface. If the readings are not consistent with what the datasheet says then there is a problem with the accelerometer.

Good point. Hope OP has a multimeter and be careful not to short pins with the meter.

liudr:
Are you using a breadboard arduino? How are you connecting your wires? Pictures will save 1K words.

!(http://Photo on 11-10-11 at 7.53 AM)
The power pins are attached to the GND and 3.3v ports. The analog pins are attached to their respective ports from the program. ST is not hooked up.

wayneft:
Since it’s an analog accelerometer, the easiest way to test it is to connect the power (3.3v) to the accelerometer and put a meter on the X, Y and Z pins. If the readings are stable on the meter and vary according to tilt then you can be fairly sure the accelerometer is working and the problem lies in your interface. If the readings are not consistent with what the datasheet says then there is a problem with the accelerometer.

I tested each pin with my voltmeter. Y did not give any signal at all; so there’s the problem! Thank you all for your help. I appreciate it.

Photo on 11-10-11 at 7.53 AM.jpg

It could be just a bad connection on the Y pin. Another thing you can try is to connect the ST pin to 3.3v and see if you measure -0.325, +0.325 and +0.550 respectively on the X, Y and Z axis. That will tell you if it’s a problem with one or all the axis.