Calculate G Force from Single Axis Accelerometer

Hi Everyone, Im new to the arduino system. I was hoping to get some advice on how to calculate the gforce from a single axis accelerometer. I have the ADXL193 breakout board. I cant get a decent formula for calculating the gforce. Please do reply if you can as this would really help my project in school.

Thanking you, Ani

Look at the datasheet for the device, it will give the sensitivity in mV/g or counts/g. Simple arithmetic and calibration using gravity will tell you if you're on the right track

Thanks for the reply. The g limit is +/-250g. when i enter the max reading which is 1024 it shows me a max g of 510..and when i enter 0 it shows 1.thats the reason i think it is false . I was hoping to get a new formula. Please do let me know if you are aware of one. I found calculations for a 3 axis accelerometer but not for the single axis.

A three axis accelerometer is just three single axis devices - the arithmetic is the same.
I don’t understand “when I enter…” - what are yoou entering, and into what?
Can you post your sketch?
[edit]120g? What are you trying to measure? Forget what I said about calibrating using gravity - without amplification, you’d be unable to resolve 1g on this device with the Arduino.[/edit]

If you check out AnalogRead() for the arduino, you find it returns a value between 0 and 1023 for input voltage in the range 0 to 5Volts.

The ADXL193 is a high g device so has a fairly low mv/g due its range of +/- 250g. With temperature drift and noise, normal low g calibration and test method using gravity will be limited. This device is for crash and impact detection not orientation.

Also impacts in this high range will "hopefully" be of short duration, so remember the A2D on the arduino it takes 100us to read the analog input.

im measuring the impact a helmet experiences during a crash. Its close to 250g's over a time period of 0.3 secs. Its a controlled experiment. So i bought the adxl193 so tht it has a wide range. i am controlling the experiment to a single axis drop.

heres the sketch. Im using processing at the moment…

import processing.opengl.*;
import processing.serial.*;

Serial serial;
int WIDTH = 1440;

PFont font;

void setup() {
  size(WIDTH,900,OPENGL);
  font = loadFont("Helvetica-Bold-20.vlw");
  textFont(font,20);
  textAlign(TOP,LEFT);
  serial = new Serial(this, Serial.list()[0], 115200);
  background(255);
  smooth();
}

int val = 0;

void draw() {
  background(255);
  fill(0);
  stroke(0);
  while (serial.available() > 0) {
    int c = serial.read();
    if (c >= '0' && c <= '9') {
      val = val * 10 + ((int)c - (int)'0');
    } else if (c == '\n') {
      next(val);
      val = 0;
    }
  }
  renderBuffer();
  text("max: " + maxInBuffer(),40,40);
  text("min: " + minInBuffer(),40,90);
}

float minInBuffer() {
  float min = 99999;
  for (int i = 0; i < WIDTH; i++) {
    if (min > buffer[i])
    min = buffer[i];
  }
  return min;
}

float maxInBuffer() {
  float max = 0;
  for (int i = 0; i < WIDTH; i++) {
    if (max < buffer[i])
    max = buffer[i];
  }
  return max;
}

int index = 0;
float buffer[] = new float[WIDTH];

float min = 511.0;
float max = 509.0;
float m = 2.0/(max - min);
float b = 1.0 - m * max;

void next(int val) {
  if (pause)
    return;

  float gz = m * val + b;
  
  buffer[index] = gz;
  index = (index + 1) % WIDTH;
}

boolean pause = false;

void keyPressed() {
  if (key == 's') {
    saveFrame("snapshot.png");
    pause = true;
  }
  if (key == 'p' || key == ' ') {
    pause = !pause;
  }
}

void renderBuffer() {
  int in = WIDTH-1;
  float last = 0;
  for (int i = index; i < WIDTH; i++, in--) {
    line(in,height/2+buffer[i],in+1,last);
    last = height/2+buffer[i];
  }
  for (int i = 0; i < index; i++, in--) {    
    line(in,height/2+buffer[i],in+1,last);
    last = height/2+buffer[i];
  }
}

If you click on the "modify" label on the top right of your last post, then highlight all the code, then click on the "#" button on the toolbar, you'll enclose your code in a nice neat grey box.

Are you buffering the readings over the target 300ms on the Arduino?

[edit]Can you post your Arduino code? I'm guessing that you're taking an analogue reading and printing the decimal value to the serial port. Depending how you're doing this, you may be getting an unstable sample rate.[/edit]