sam5400 Posted February 26, 2018 Report Share Posted February 26, 2018 Hi!, I've been struggling with a couple of MPU-6050's and I think I've found a solution for my problem so I'd like to share this.. I'm using the teapot arduino sketch as the base for my project. After calibrating offsets (there are some topics about this on the forum) the first MPU-6050 worked really good but the other two had some problem. I'm using quaternions and most of the time it started with a Z value near zero (like 0.008830) but sometimes it started with a random Z value (like 0.403030, 0.94000, etc). I've tried compiling the skecth enabling DEBUG on MPU6050_6Axis_MotionApps20.h and the problem dissapeared. It seems that there is a timing problem on the initialization function but it only affects some modules. I've solved my problem in a quick and dirty way by disabling DEBUG and adding an small delay in each DEBUG_PRINT* function. Something like this: #ifdef DEBUG #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTF(x, y) Serial.print(x, y) #define DEBUG_PRINTLN(x) Serial.println(x) #define DEBUG_PRINTLNF(x, y) Serial.println(x, y) #else #define DEBUG_PRINT(x) delay(1) #define DEBUG_PRINTF(x, y) delay(1) #define DEBUG_PRINTLN(x) delay(1) #define DEBUG_PRINTLNF(x, y) delay(1) #endif I know it requires further investigation but for now the problem is solved, at least in my case. I Hope this is useful for someone else. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.