Hi,
I'm working with the ADXL335 and I would like to convert the xyz values to g-force.
It is my understanding that this is done thusly:
(1) SomeAxis = Vout * Vs / 1023.0; //The analog inputs are 10 bits right?
(2) Vdelta = SomeAxis - ZeroG
(3) SomeAxis = Vdelta / Sensitivity;
Here is how I'm doing it:
double sensitivity[3] = {0.270, 0.300, 0.330}; //The ADXL335 datasheet gives 270, 300, and 330 mV/g @ 3v
//Get raw value
accelRead[X] = analogRead(xAxis);
accelRead[Y] = analogRead(yAxis);
accelRead[Z] = analogRead(zAxis);
//Convert to V
accelRead[X] = accelRead[X] * 3.3 / 1023;
accelRead[Y] = accelRead[Y] * 3.3 / 1023;
accelRead[Z] = accelRead[Z] * 3.3 / 1023;
//Determine change in V
deltaV[X] = accelRead[X] - (3.3 / 2.0);
deltaV[Y] = accelRead[Y] - (3.3 / 2.0);
deltaV[Z] = accelRead[Z] - (3.3 / 2.0);
//Convert to G-Force
accelRead[X] = deltaV[X] / sensitivity[X];
accelRead[Y] = deltaV[Y] / sensitivity[Y];
accelRead[Z] = deltaV[Z] / sensitivity[Z];
Unfortunately the readings are inaccurate. They correlate properly with movement, but it is certainly not gs. I know this because I'm geting readings like -0.66 when it should be 1.0 and -0.83 when it should be 0.5. I am using a voltage divider to ensure 3.3v power supply (I'm actually getting 3.31v rather than 3.29 in the 3.3v pin).
What I need to know is (1)Do I understand the conversion process correctly? (2)Does anyone know a better zero g than Vs / 2.0 for 3.3v power supply? (3)Does anyone know the sensitivity of each axis with a 3.3v power supply? (4)Does anyone have experience with the situation I'm in?
I would like to get this working properly. Any help would be greatly appreciated! (Even if you can't answer my questions.)
Here is the datasheet of the breakout I'm using if that helps: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/BreakoutBoards/ADXL335_v13.pdf