jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.93k stars 7.51k forks source link

what is the Unit of world-frame acceleration, adjusted to remove gravity #381

Open avsingh999 opened 6 years ago

avsingh999 commented 6 years ago

what is the unit of world-frame acceleration in this file or It's raw data of accelerometer https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino

zenmanenergy commented 6 years ago

It is a scaled value of a g. I don't find that unit is very helpful. Personally what I prefer is an SI unit for acceleration, i.e. a unit of meters/second/second Try this....

float zAccel=(float(aaWorld.z)/ 8192)*9.810; if (abs(zAccel) > 3){ Serial.print(zAccel); Serial.println(); }

The if statement will just keep it from spitting out numbers constantly.

So this should output nothing if it's sitting still. But if you were to drop your device and let it fall (In the z direction) the value should equal gravity. Or rather close. When I do it on mine I see it go as high as -10.5. But it probably needs to be calibrated.

You can do this on all three axis' and it should give you a value in m/s^2 which IS useful. I'm not smart enough to understand the benefit of doing the calculations using a non-metric unit.