I am using the ADXL335 as well i go the code from somewhere else i forget where,

I am getting my readings, but they never reach 90 degrees in the X and Y...only goes up to the 87-88 area.

Is this due to the Min and MAx values i sub in?

If i dont have the exact range of the axis, then will this do this?

here is the calculations i use

Code:

//convert read values to degrees -90 to 90

int g0x;

int g0y;

int g0z;

g0x = ((maxValx - minValx)/2)+minValx;

g0y = ((maxValy - minValy)/2)+minValy;

g0z = ((maxValz - minValz)/2)+minValz;

int fx = (xRead - g0x);

int fy = (yRead - g0y);

int fz = (zRead - g0z);

float ax = fx*(3.3/(1024.0*((maxValx-minValx))/180)); //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in X axis

float ay = fy*(3.3/(1024.0*((maxValy-minValy))/180)); //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in Y axis

float az = fz*(3.3/(1024.0*((maxValz-minValz))/180)); //The 3.3V supply volt is divided by 1024 steps from the A/D converter. This value is divided by the sensitivity in Z axis

float rho = 0; //MyAngle in X Axis

float phi = 0; //MyAngle in Y Axis

float theta = 0; //MyAngle in Z Axis

rho = atan(ax/sqrt(pow(ay,2)+pow(az,2)))*(360/(2*3.1415)); //Calculate the X , Y ,Z angle.

phi = atan(ay/sqrt(pow(ax,2)+pow(az,2)))*(360/(2*3.1415)); // this used (360/(2*3.1415) to convert radians to degrees.

theta = atan(sqrt(pow(ay,2)+pow(ax,2))/az)*(360/(2*3.1415));

the sensitivity of the chip is

300mv per g TYP.

330mv per g Max

Any suggestions to why it never reaches 90?