Accelerometer X and Y axis reading meaning

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

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)

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?

Noise, poor grounding, long wires, malicious gravity.

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

I don't know - I can't see your sketch, code, schematic or results.

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.

Here is the code I am using,

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

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.

Thanks that does give me more workable values. :slight_smile:

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?

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.

AWOL:
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? :slight_smile:

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.

AWOL:

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! :slight_smile:

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

You can only determine the angle at which the accelerometer is in relation to the vertical if it is not accelerating in a horizontal plane. The the acceleration you read from the X and Y sensors should be:

g * sin(phi)

where g is the acceleration due to gravity (about 9.81ms^-2) and phi is the angle by which the axis you are reading (X or Y) is off the horizontal.