# What does the output of ADXL335 in degrees represents?

Hello all,

I am currently doing a project which includes the accelerometer ADXL335. I have got the code from this site and it worked pretty well. But i am unable to understand the output. What does it represents in degrees? Does it represent anything related to gravity?

My code is :
#include <FileIO.h>

const int xPin = 0;
const int yPin = 1;
const int zPin = 2;

//The minimum and maximum values that came from
//the accelerometer while standing still
//You very well may need to change these
int minVal = 265;
int maxVal = 402;
//to hold the calculated values
double x;
double y;
double z;
Void setup ()
{
Serial.begin (9600);
}
void loop(){
//read the analog values from the accelerometer

//convert read values to degrees -90 to 90 - Needed for atan2
int xAng = map(xRead, minVal, maxVal, -90, 90);
int yAng = map(yRead, minVal, maxVal, -90, 90);
int zAng = map(zRead, minVal, maxVal, -90, 90);

//Calculate 360deg values like so: atan2 (-yAng, -zAng)
//atan2 outputs the value of -? to ? (radians)
//We are then converting the radians to degrees
x = RAD_TO_DEG * (atan2 (-yAng, -zAng) + PI);
y = RAD_TO_DEG * (atan2 (-xAng, -zAng) + PI);
z = RAD_TO_DEG * (atan2 (-yAng, -xAng) + PI);

//Output the calculation
Serial.print (", ");
Serial.print(x);
Serial.print (“, ");
Serial.print(y);
Serial.print (“, ");
Serial.println (z);
delay (1000);
}

My output is attached below

Looking forward to hear from you,

Regards,
Koduri

That program is intended to calculate tilt angles, but is partly nonsense. You should ignore it.

Can you say where can I find the code to find the acceleration ?

Here you read out the acceleration values.

``````   //read the analog values from the accelerometer
``````

The data sheet for the device will tell you how to interpret the numbers.

Hello,

I got the x,y,z reading with respective to "g". The thing is i have placed the accelerometer on the tip of the index finger . Now i am doing a test in which i will tap the index finger on to the thumb finger. I would like to find the distance between the index and thumb finger at respective time instants.

Is it possible?

Looking forward to hear from you,

Regards, Koduri

Theoretically, it is possible. In practise, probably not.