Pages: [1] 2   Go Down
Author Topic: Odd accelerometer problem  (Read 1312 times)
0 Members and 1 Guest are viewing this topic.
United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26273
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What do you mean? Are you joking?
Logged

fuzzball27 >>-->

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1243
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged


United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1243
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

fuzzball27 >>-->

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Worcester, MA
Offline Offline
God Member
*****
Karma: 3
Posts: 623
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Pages: [1] 2   Go Up
Jump to: