Hi everybody :)  I just want to ask a question... I'm working on a project in which i use the MPU6050 IMU from invensense connected to an arduino leonardo. Thanks to Jeff Rowberg's library, i could use the DMP of this chip to get yaw, pitch and roll angles, but my problem is that when i run the example code, every thing is ok, but when i just add one delay, say delay(100), the FIFO register overflows. Is there any solution for this problem??

Another problem i faced also is that when i added some extra pieces of code (related to my project), where i use the PWM to control the speed of rotation of some motors, the yaw angle readings from the MPU go nuts, is there any relation between using PWM and the FIFO in the MPU??

thank you in advance for your help.

Views: 2985

Reply to This

Replies to This Discussion

I too having same problem... You got any solutions???

In some thread they say that IMU started calibrating at faster rate than mc, so the stack is getting overflown due to that...  

i'm sorry for being so late, frankly i don't visit DIY drones frequently :D anyway, i think i know the solution for this problem ... You can control the DMP output rate by changing the last byte on line 261 of MPU6050_6Axis_MotionApps20.h, and there will be a comment in this location describing the possible rates and the bytes corresponding to them.


I had the same problem with MPU6050 on a personal project. When I used the code in this example, the data were good! But, when I added a little bit of my own code or just a delay of 50ms, the data were totally faulty!!

Many hours later, I looked the content of the fifoBuffer and I realized there were two lags. So, I decided to correct one of those lag. After the modification, the second lag was always here but it could be deleted in detecting the wrong data. 

This is the solution I found to solve 90% of the problem.

for(int i=1; i<16; i++)
fifoBuffer[i+41] = fifoBuffer[i];

for(int i=0; i<41; i++)
fifoBuffer[i] = fifoBuffer[i+16];

// recupération des données
CI.dmpGetQuaternion(&q, fifoBuffer);
CI.dmpGetGravity(&gravity, &q);
CI.dmpGetYawPitchRoll(ypr, &q, &gravity

Hope it will be helpful!

Reply to Discussion


© 2018   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service