georgelue321 Posted July 8, 2013 Report Share Posted July 8, 2013 Hello! I have installed Jeff Rowberg's i2cdevlib library which I can use for my MPU-6050 to make it interact with Arduino. However, I have an odd problem with one of its functions. It's got a function to turn the accelerometer & gyroscope readings into linear acceleration. This is the definition of the function: uint8_t MPU6050::dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity) { // get rid of the gravity component (+1g = +8192 in standard DMP FIFO packet, sensitivity is 2g) v -> x = vRaw -> x - gravity -> x*8192; v -> y = vRaw -> y - gravity -> y*8192; v -> z = vRaw -> z - gravity -> z*8192; return 0; } However, whenever the function is called in the example code: // display real acceleration, adjusted to remove gravity mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print("areal\t"); Serial.print(aaReal.x); Serial.print("\t"); Serial.print(aaReal.y); Serial.print("\t"); Serial.println(aaReal.z); I get values way off, when I'm not even moving my MPU-6050! These are a few of the values I get: areal -473 423 -425 areal -460 400 -450 areal -471 522 -458 areal -322 276 -582 Do you know how I can fix this? Thanks! -George lapedNok 1 Quote Link to comment Share on other sites More sharing options...
Jeff Rowberg Posted July 22, 2013 Report Share Posted July 22, 2013 Hi George, Given that these values are relatively close to 0 on the scale of 1g (~5% of 8192), this is most likely due to calibration offsets in that specific sensor. You can overcome these with manual offsets in your own code, or with the various OFFSET registers in the MPU. Quote Link to comment Share on other sites More sharing options...
shajia ikram Posted July 14, 2016 Report Share Posted July 14, 2016 Hi Jeff!! I wanted to ask some questions regarding aaReal Readings in MPU-6050 dmp6 file. --> How do we find the sensitivity of acceleration readings (what specific values did you choose?). This is because I have to divide acceleration by sensitivity factor. --> How exactly did you calculate GRAVITY VECTOR for gravity compensation?? Kindly reply ASAP.. Regards.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.