ADXL335 accelerometer callibration

Hi

i have a ADXL335 accelerometer

i m looking for a code to convert the reading from sesnor to Acceleration

i find this code there a connst quantity equal to 67.584 i dont what is this

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int Xread;

int Xrest;

int Yread;

int Yrest;

int Zread;

int Zrest;

double Gx;

double Gy;

double Gz;

int xpin = 0;

int ypin = 1;

int zpin = 2;

int t1;

void setup()

{

Serial.begin(9600);

lcd.begin(16, 2);

digitalWrite(13,HIGH);

delay(1000);

Xrest=analogRead(xpin);

Serial.print(Xrest);

Yrest=analogRead(ypin);

Serial.print(Yrest);

Zrest=analogRead(zpin);

Serial.print(Zrest);

digitalWrite(13,LOW);

}

void loop()

{

Serial.print("Time ");

t1=millis();

Serial.println(t1*0.001);

Xread = analogRead(xpin)-Xrest;

Yread=analogRead(ypin)-Yrest;

Zread=analogRead(zpin)-Zrest;

Gx=Xread/67.584;

Gy=Yread/67.584;

Gz=Zread/67.584;

Serial.print(“Acceleration X :”);

Serial.print(Gx);

Serial.print(“Acceleration Y :”);

Serial.print(Gy);

Serial.print(“Acceleration Z :”);

Serial.print(Gz);

Serial.print(“\n”);

lcd.setCursor(0, 0);

lcd.print(“gx:”);

lcd.print(Gx);

lcd.setCursor(8, 0);

lcd.print(“gy:”);

lcd.print(Gy);

lcd.setCursor(0, 1);

lcd.print(“gz:”);

lcd.print(Gz);

delay(1000);

lcd.clear();

}

Where did you get the code from? The person that wrote it would know why that constant was chosen and how it relates to output. You’re probably going to need to find out what voltage the accelerometer is supposed to be operating at to make sense of the output.

At rest, the Z axis would be outputting a voltage that corresponds to 1G and the X and Y axes would be outputting 0G.

You could graph those two points and use the slope of that line to determine G force above 1G and below 0G.

The ADXL335 data sheet explains how to convert the output values to acceleration units.