Jump to content
I2Cdevlib Forums

Recommended Posts

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

 

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 2 years later...

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..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...