Pages: [1] 2   Go Down
Author Topic: Accelerometer X and Y axis reading meaning  (Read 1975 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I am trying to use the Tinkerkit Accelerometer with my Arduino board and am able to successfully read the values of X and Y axis from it, but am having trouble wrapping my head around what these values mean.

What do the changes in X and Y values mean? Which is the X axis and Y Axis from a real world view? Any help greatly appreciated.

TIA
Logged

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

X and Y are relative.
If the device is on a flat, horizontal surface, conventionally (Cartesian coordinate system) x positive is to the right, x negative is to the left, y positive is forwards (away from the observer), and y negative is backwards (towards the observer)
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply.
However I notice that I continuously get different values for these 2 even when the accelerometer is at rest. Any ideas why?
Logged

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

Noise, poor grounding, long wires, malicious gravity.
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.

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm... ok so that isn't normal then?
Any ideas/suggestions how to work around that?
Logged

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

I don't know - I can't see your sketch, code, schematic or results.
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.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33374
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
ok so that isn't normal then?
It is normal to get a signal that changes all the time by a bit. However as you have not said by how much we can't tell if it is normal.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the code I am using,
Quote
int yAxisValue = 0;           // value read from the accelerometer's y-axis
int prevY = 1023;

void setup()
{
  // initialize serial communications at 9600 bps
  Serial.begin(9600);
}

void loop()
{
  // read the joystick x-axis values:
  yAxisValue = accelerometer.getYAxis();

  if (prevY != yAxisValue) {
    // print the results to the serial monitor:
    Serial.print("Y=");                   
    Serial.println(yAxisValue);

    //Serial.write(yAxisValue);
    prevY = yAxisValue;
  }

  // wait 50 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(50);   
}
The results I see on the serial monitor are Y=3xx range numbers (from 310 to 350 etc.), BTW, could someone please let me know how I may capture the output from the /dev/tty.. device to a file.

TIA
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33374
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Use the code tag icon, the # not the quote next to it when posting code.

You can average say ten readings to get a more stable number.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks that does give me more workable values. smiley

BTW, I am trying to use this accelerometer for a simple game 'Ping Pong' to move the paddle on the screen, but am beginning to wonder if an accelerometer should be used here in the first place?  Can accelerometer values be used to represent movement?
Logged

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

Remember that a body at constant velocity is not accelerating, so you can't tell if your device is stationary or moving at 100 kmh-1; you can only detect changes of velocity.
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.

Dallas, TX
Offline Offline
Sr. Member
****
Karma: 10
Posts: 318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Remember that a body at constant velocity is not accelerating, so you can't tell if your device is stationary or moving at 100 kmh-1; you can only detect changes of velocity.
What about if it's changing direction but maintaining velocity?  smiley
Logged

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

Quote
What about if it's changing direction but maintaining velocity?
That isn't possible.
Velocity is a vector; a direction and a rate of displacement.
If you change either, the velocity has changed.
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.

Dallas, TX
Offline Offline
Sr. Member
****
Karma: 10
Posts: 318
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What about if it's changing direction but maintaining velocity?
That isn't possible.
Velocity is a vector; a direction and a rate of displacement.
If you change either, the velocity has changed.

Sorry, you're absolutely right. I was thinking about a constant speed and a changing direction which is a change in acceleration. Carry on! smiley
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How can I use the received values to determine the angle at which the accelerometer is at any moment?
Logged

Pages: [1] 2   Go Up
Jump to: