MPU6050 configuration

Hi there!

I need to configure the MPU6050 to +/-16g and +/-2000º/s...

How can I set it?

Thanks in advance!

ok, i am not sure about this but

i am assuming that you are using it in dmp mode (already written code to get good out of MPU6050 https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino). if so you can use the following lines of code to check it.

Serial.println(mpu.getFullScaleGyroRange());
Serial.println(mpu.getFullScaleAccelRange());
mpu.setFullScaleGyroRange(MPU6050_GYRO_FS_2000);
mpu.setFullScaleAccelRange(MPU6050_ACCEL_FS_4);
Serial.println(mpu.getFullScaleGyroRange());
Serial.println(mpu.getFullScaleAccelRange());

you will need to install DMP6050 library tho.
setting the gyro range is quite straight (like 250, 500....) but i am not sure what to write in for Accelerometer. you can check it by printing it out on serial port. i think it returns the 0,1,2,3 acc. to data sheet (register map, page 15)

Hi
I have done this yesterday.
On the example code of the i2cdev library (https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino) on line 182

// initialize device
    Serial.println(F("Initializing I2C devices..."));
    mpu.initialize();

you have to add the 2 function suggested by anqurarora but the parameters are wrong.

// initialize device
    Serial.println(F("Initializing I2C devices..."));
    mpu.initialize();
    mpu.setFullScaleGyroRange(3); //set the gyro range to 2000
    mpu.setFullScaleAccelRange(3); //set the accelerometer sensibilty to 16g

Those are the int you can use in the function setFullScaleAccelRange()
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

and those the one you can use in the function setFullScaleGyroRange()
0 = +/- 250 degrees/sec
1 = +/- 500 degrees/sec
2 = +/- 1000 degrees/sec
3 = +/- 2000 degrees/sec

The important thing is to put them AFTER the mpu.initialize() or the MPU will be resetted on standard value (2g/200°)
If you need to check the settings you can use the getFullScaleGyroRange()/getFullScaleAccelRange() void that will return the actual value of the MPU.

I found that solution on http://www.i2cdevlib.com/docs/html/class_m_p_u6050.html
Hope it's helpfull

PS: I have tried to do this setting because the MPU i bought (the 6050) present some kind of wrong data in output for the first 20 second after I turn it on and I thought this could solve the situation (http://forum.arduino.cc/index.php?topic=242787.0) since I would have more resolution, but I couldn't solve that.
Do you had similar issues? Thanks in advance for the reply!

The device datasheet and register map document states quite clearly how to select the different sensitivity rates for the gyro readings. You should be able to verify that works by looking at the actual gyro values.

Hi!

Thanks a lot for your replies.

I changed this part from MPU6050.cpp and it works correctly.

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

Hi there,

Sorry to resurrect an old thread, but I'm currently working with a MPU6050, and I suspect the accelerometer values are not exactly expressed in G.

For example, reading the accelerometer values while moving very slowly to measure only gravity, if I set sensitivity to MPU6050_ACCEL_FS_2, after normalization I get values between -0.5 and 0.5. If I set sensitivity to MPU6050_ACCEL_FS_4, I get values between -0.25 and 0.25. Etc ...

So my understanding is that to get the real values in G, I should multiply the normalized values by (9,81 * sensitivity).

Does this sound correct ?
Thanks for any feedback.

Cheers,
Joseph

PS : I hope this has not already been answered somewhere else, but google took me here first ...

I just realized that 1g = 9,81 meters per second squared.

Please ignore my previous post as it is not relevant.

Best,

Joseph

Hi,
Did it work if you are only changing the MPU6050.cppp to

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

In my case the Arduino Monitor Displays the same values as for

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