MPU6050/MPU6500/MPU9150/MPU9250 library over I2c

Hey guys,

I am getting some really large values:

flag=0, yaw=1113416067, pitch=-1037714598, roll=1113299994
flag=0, yaw=1113416553, pitch=-1037714800, roll=1113299207
flag=0, yaw=1113416335, pitch=-1037714964, roll=1113299377
flag=0, yaw=1113416579, pitch=-1037715221, roll=1113298567
flag=0, yaw=1113416122, pitch=-1037715394, roll=1113299198
flag=0, yaw=1113415981, pitch=-1037715258, roll=1113299644
flag=0, yaw=1113415786, pitch=-1037715344, roll=1113299659

But I can see they change according to the angles, and go back to the original value when they return to original position. What's wrong here, can anyone point me a direction? Thanks

Edit #1:
I was using long to store the output and it should be float. Now I need to figure out how to fix the drifting.

Edit #2:
Not just the problem with drifting. Values from three axis change at the same time from ypr[].
When the IMU is rotating around z axis, yaw, roll, pitch change at the same time like from 0 to 180. It's yaw for gyro that changes.
When the IMU is rotating around x axis, only roll changes as it's supposed to like from 0 to 90, and yaw and pitch goes +- 3 degrees. gyro pitch changes.
When the IMU is rotating around y axis and yaw changes from 0 to 90, pitch change by 30 and roll change by 50 degrees. For gyro[], it's pitch that changes.
What is wrong here?

Edit #3:
I found I was using DMP_FEATURE_LP_QUAT which should be DMP_FEATURE_6X_LP_QUAT. I guess the quaternion formula is for 6X mode only.

Edit #4:
Weird I am testing out the angles, when the IMU is rotated around the y axis in one way for 90 degrees, it gets about 90 degrees, but when it's rotated in the other direction for 90 degrees, it gets only to 60. Does anyone get this?

Hi All
Any Luck to solve ''READ ERROR''?

Thanks

Here's some observations from my own experiments.

  1. My READ ERROR was an I2C thing. Probably because I'm on breadboard. Try:
Fastwire::setup(200,0);

in AvrCopter.ino L14. Worked for me.

  1. Once it goes wrong, it will freeze without recovering. You can check this by adding something like:
case 2: err_o++; Serial.println(err_o); return;

at L47

It is possible to recover from some buffer overflow freezes by clearing the FIFO buffer. To do this, add the following line to mpu.h:

int mympu_clearfifo();

then change L47 to this:

case 2: err_o++; ret = mympu_clearfifo(); err_o++; Serial.println(err_o); return;

Hi
It works perfectly!
The only problem is: No matter what the Serial.begin (Baud rate) is, It always serial.print with the same speed! How can I increase the baud rate?!

Thanks

Hi, I do not see any reason why you shouldnt be able to increase the Serial speed. Sorry

Hi
I tried to use your library with multiple sensors but it was not working. Is there any method.

Thank you for the library- very helpful!

I am pretty new to this and am hoping to use the EM MPU9250 breakout with my Arduino Uno, unfortunately I'm having an issue finding the device. When I run the i2c scanner, I see the following:

I2C Scanner
Scanning...
No I2C devices found

I don't quite know how to address this problem and hope you might offer some insight.

Thank you

Hello! Using AvrCopter project to run the arduino Uno with MPU 9150.
It runs ok. But for a few seconds only I get some results, after that I receive the following error:

Seems like the quaternion check fails. its out of range. and never comes to normal range. So

ret = mympu_update();

after few seconds starts returning 3.

Before there was an issue with firmware compare failure. Which I fixed by setting Fastwire speed from 400 to 200.

No trying to understand the nature of this error I saw the following comments:

  • We can detect a corrupted FIFO by monitoring the quaternion data and
  • ensuring that the magnitude is always normalized to one. This
  • shouldn't happen in normal operation, but if an I2C error occurs,
  • the FIFO reads might become misaligned.
  • Let's start by scaling down the quaternion data to avoid long long
  • math.
    */

How can I find out if there was a I2C error (if that was the cause)?
In any case how can I resolve the issue?

Hi,
I'm trying to use this software with a MPU6500 that has the address 0x1c instead of 0x68. I tried to change the MPU6050.h file by changing everywhere I found 0x68 with the new value but no luck...
Result is:
Testing device connections...
MPU6050 connection failed
a/g: 67 -4965 -930 17388 -25604 24072
......

I'm new with arduino, can someone to help me? Thank you!

I could not get this sketch working with my MPU9255 chip at first.

I have tried that slightly modified sketch and it worked : GitHub - moderndevice/MotionPlug: Motion Plug demo sketch

I went back to the avrcopter sketch and inexplicably it sudently it work. I am scratching my head.

Be careful : long SDA and SLC cable (or poor connection) an cause problem. Use pull up resistor if you use 5V board - see Motionplug.ino intro remarques for more info.