Jump to content
I2Cdevlib Forums

MPU6050 pausing it

Recommended Posts


I am pretty sure Jeff's MPU6050 library is the best in the internet to retrieve ypr angles from MPU6050 using the DMP on arduino. It's a really good library but it's not easy to beginners cause the way the basic Arduino code to retrieve ypr from the DMP is a little complicated.

Anyway, after spending almost 3 months I am confident I understand very well the code and it works really fine. But I found a problem: sometimes I really need to execute some routine that can take up to 3 to 10 seconds and Jeff's code simply crashes. Sometimes Arduino freezes and no FIFO OVERFLOW error message is displayed, other times the error message is displayed. I know that using DMP relies on interrupt and my code must be really really really optimize in order to not hang arduino for too long.

So I decided that before doing my routine I should do mpu.setDMPEnabled(false) and after I finish my routine I should do mpu.setDMPEnabled(true);. But there is a problem: after I execute mpu.setDMPEnabled(true); the MPU6050 restarts its internal "calibration" algorithm and takes at least 5 to 8 seconds to get solid readings to ypr.

Doing the method above I can at least prevent fifo overflow or my arduino to freeze, but it creates another problem cause now my new readings (after mpu.setDMPEnabled(true);) are not precise anymore for at least 5-8 seconds.

Is there someway to ignore DMP readings without overflowing the buffer and at the same time doing something else so in the future I can start to pay "attention" again to DMP and keep reading its angles without any recalibration?

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.

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.


  • Create New...