Jump to content
I2Cdevlib Forums
SmartBomb

Convert DMP Values to G-Force

Recommended Posts

I was under the impression that the default range for the MPU-6050 accelerometer was +/-2g, but after doing some datalogging I'm beginning to think that is only the case for the raw values (i.e. using MPU6050_raw.ino)  and not true when using the DMP (i.e. using DMP6050_DMP6.ino). The values I obtained are half of what I believe they should be, leading me to believe that with DMP the default range is +/-4g.

 

I found a line in MPU6050_6Axis_MotionApps20.h that only confuses me more:

// get rid of the gravity component (+1g = +8192 in standard DMP FIFO packet, sensitivity is 2g) 

If the sensitivity is 2g, doesn't 1g = 16,384? Or am I reading the datasheet incorrectly? At this point I'm pretty confused and hopefully somebody can clear it all up for me... 

Share this post


Link to post
Share on other sites

Just to add some additional information: I'm outputting the REALACCEL acceleration values and dividing them by 16,384, as indicated in the datasheet for +/-2g sensitivity. If the sensitivity when using the DMP is actually +/-4g, I should only be dividing by 8,192. This will double the 'g-force' numbers that I am currently logging, putting them more in line with what I expect.

Share this post


Link to post
Share on other sites

Im having the exact same problem. Shouldnt 1g =( 2^16)/2 = 16384 ?

Is it showing correct looking linear acceleration values through some offset register hocus pocus or is 1g really equal to 8192?

 

Its confusing because inworld accelerations appear to be free of any gravity component even though 8192 is used.

Share this post


Link to post
Share on other sites

Is the DMP limited to a 4g sensitivity? I tried changing the sensitivity, but it still outputs 8192...

 

I changed this line:

setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
into

setFullScaleAccelRange(MPU6050_ACCEL_FS_8);
And it didn't change anything on the DMP...

Share this post


Link to post
Share on other sites

Same issue here.

After: (MPU6050.ccp)

void MPU6050::initialize() {
    setClockSource(MPU6050_CLOCK_PLL_XGYRO);
    setFullScaleGyroRange(MPU6050_GYRO_FS_250);
    setFullScaleAccelRange(MPU6050_ACCEL_FS_2);
    setSleepEnabled(false); // thanks to Jack Elston for pointing this one out!
}

...

 * <pre>
 * AFS_SEL | Full Scale Range | LSB Sensitivity
 * --------+------------------+----------------
 * 0       | +/- 2g           | 8192 LSB/mg
 * 1       | +/- 4g           | 4096 LSB/mg
 * 2       | +/- 8g           | 2048 LSB/mg
 * 3       | +/- 16g          | 1024 LSB/mg
 * </pre>

So the MPU6050_6Axis_MotionApps20.h expands...
 

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;
}

But the MPU 6050 Product Specification says:

MPU6050.JPG.b982cefe40cc000900a7af4da7d500c5.JPG

 

If the values are queried with the Rowberg-Skript, they are to low. But if I divide the "output_readable_realaccel" aaReal by 8192 instead 16384 it seems to be correct.

How to fix it correctly?

Sorry for take up the old topic, but its pretty confusing.

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×