Go Down

Topic: Odd accelerometer problem (Read 1 time) previous topic - next topic

fuzzball27

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?
fuzzball27 >>-->

AWOL

Have you checked that gravity is working normally where you are?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

fuzzball27

What do you mean? Are you joking?
fuzzball27 >>-->

xl97

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.


fuzzball27

Do you mean accounted for in programming or hardware? I'm displaying raw analog values with
Code: [Select]
Serial.println(analogRead(either x,y,or z pin));
fuzzball27 >>-->

fuzzball27


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.
fuzzball27 >>-->

xl97

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..

fuzzball27

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.
fuzzball27 >>-->

liudr

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.

fuzzball27


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.
fuzzball27 >>-->

fuzzball27

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...?
fuzzball27 >>-->

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 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?

fuzzball27


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?
Quote
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.)
fuzzball27 >>-->

liudr

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.

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.
I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Go Up