Hi,
I am very new to the whole Arduino community, I recently started working on a project that would monitor the motion of a persons chest, basically what I am planning on doing is using an accelerometer that would be placed on the persons chest (while they are laying down) and measure the z component to figure out how much movement is occurring.
Since I don't know much about what I am doing yet, I'm trying to take babysteps till I can accomplish this. The accelerometer I have is a Modern Device MMA7260QT 3-axis accelerometer but mine looks like this one:
I found this datasheet for it: http://www.freescale.com/files/sensors/doc/data_sheet/MMA7260QT.pdf
What I've done so far is hooked it up like this : (Sorry I don't have an image of it. I saw a link somewhere on how to generate a picture of the schematic but now I can't seem to find it!)
Arduino Accelerometer
3v3 Vin
3v3 GS1
GND GS2
GND GND
Analog 0 X0
Analog 1 Y0
Analog 2 Z0
I also have Sl not hooked up to anything.
It seems to be working "fine" when I run this code:
int x0;
int y0;
int z0;
void setup()
{
Serial.begin(9600);
}
void loop ()
{
x0 = analogRead(0);
y0 = analogRead(1);
z0 = analogRead(2);
Serial.print("X: ");
Serial.print(x0);
Serial.print(" Y: ");
Serial.print(y0);
Serial.print(" Z: ");
Serial.println(z0);
delay(100);
}
I get these outputs:
X: 276 Y: 310 Z: 195
X: 278 Y: 310 Z: 195
X: 275 Y: 311 Z: 194
X: 278 Y: 310 Z: 193
X: 278 Y: 311 Z: 196
X: 277 Y: 309 Z: 194
X: 277 Y: 310 Z: 195
X: 278 Y: 310 Z: 194
X: 265 Y: 311 Z: 196
X: 292 Y: 311 Z: 195
X: 279 Y: 311 Z: 195
X: 278 Y: 310 Z: 195
X: 277 Y: 310 Z: 196
These are from the sensor just sitting on my desk without any movement
I've spent the last few days searching arduino.cc and google on accelerometers and how to work with them and everything and I've found a few insightful websites but I can't seem to generate anything that corresponds to their examples.
I've read through this a few times: http://www.instructables.com/id/Accelerometer-Gyro-Tutorial/?ALLSTEPS (focussing on just the accelerometer part) but when I try to do this equation:
Rz = (AdcRz * Vref / 1023 - VzeroG) / Sensitivity
which would be:
Rz = (195 * 3.3 / 1023 - 1.65) / .6
Rz = -1.7
Like wise if I would do this with X (277) and Y (310) I get -1.2 for X and -1.08 for Y. Yet in the article he gets:
Rx = 0.5g
Ry = 0.79g
Rz = 0.33g
How come my initial numbers (that I see directly from the accelerometer displayed in the serial monitor) are so low that they turn out negative? or are they not that low. Everywhere I look online seems that people are having much higher readings than mine! I don't know what I'm doing wrong if anything I can't seem to figure this out!
I guess what I am trying to do is take the readings from the accelerometer and then be able to calculate a distance of how much movement occurred when the persons chest raised/lowered.
One last question, being that this accelerometer has a range of sensitivity modes, 1.5g, 2g, 4g, and 6g, what would you reccomend I use for the type of measurement I am monitoring.
Thanks for your time!
-Will