Full Version: Strange mpu6050 data.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Some strange readings from gyro (DEBUG 1). After start while robot is horizontal, readings are about -40 and sensitivity are OK, but when robot is placed vertical readings show around 0 and robot not balanse themself. When placed horizontal , again gyro readings are about -40 and sensitivity are OK. Gyro readings stay less sensitive at about 30degrees from horizontal (DEBUG 1 , angle_adjusted show around 10). At 60 degrees from horizontal gyro readings change very small amount and show around 2-3. Therefore more than 90 degree angle have very low sensitivity for gyro.
This is not my first robot, but now I have no ideas what to do. And why gyro is less sensitive vertical than horizontal?
MPU6050 is not faulty because on other robot with different sketch and YawPitchRoll reading it work fine and balance robot well.
Have you any solutions for this problem?
motor wiring is attached to wiring gyroscope?
If so, separate. I had similar problems, the engine was producing wiring induction into the MPU wiring. After separating the problem was solved.
Motors drivers connected to 11.1V LiPo, MPU connected to Arduino stabilised 5V. The same way as in my other robot, which works fine.
I disconnected motors, but mpu show the same results Sad
I added some code for comparison with YawPitchRoll what represent real Pitch angle. +-10degrees pitch change show result only +-1.
float dmpGetPhi() {
  mpu.getFIFOBytes(fifoBuffer, 16); // We only read the quaternion
  mpu.dmpGetQuaternion(&q, fifoBuffer);

  //-----------for test only!!!!!!!!!!!!!!
  mpu.dmpGetGravity(&gravity, &q);
  mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
  double pitch = ypr[1] * 180 / M_PI;// + 180;
  Serial.print("         Pitch= ");
  mpu.resetFIFO();  // We always reset FIFO

  //return( asin(-2*(q.x * q.z - q.w * q.y)) * 180/M_PI); //roll
  return (atan2(2 * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z) * RAD2GRAD);

For big movement it look like this

Pitch= 87.14 angle_adjusted=-95.44
Pitch= 87.06 angle_adjusted=-63.02
Pitch= 86.09 angle_adjusted=-37.09
Pitch= 84.50 angle_adjusted=-22.10
Pitch= 82.51 angle_adjusted=-13.53
Pitch= 80.22 angle_adjusted=-8.18
Pitch= 77.66 angle_adjusted=-4.65
Pitch= 74.86 angle_adjusted=-2.22
Pitch= 71.82 angle_adjusted=-0.51
Pitch= 68.59 angle_adjusted=0.70
Pitch= 65.14 angle_adjusted=1.57
Pitch= 61.53 angle_adjusted=2.18
Pitch= 57.76 angle_adjusted=2.58
Pitch= 53.85 angle_adjusted=2.85
Pitch= 49.83 angle_adjusted=3.00
Pitch= 45.69 angle_adjusted=3.06
Pitch= 41.47 angle_adjusted=3.04
Pitch= 37.17 angle_adjusted=2.95
Pitch= 32.81 angle_adjusted=2.80
Pitch= 28.39 angle_adjusted=2.61
Pitch= 23.94 angle_adjusted=2.37
Pitch= 19.45 angle_adjusted=2.09
Pitch= 14.94 angle_adjusted=1.78
Pitch= 10.43 angle_adjusted=1.45
Pitch= 5.91 angle_adjusted=1.11
Pitch= 1.39 angle_adjusted=0.79
Pitch= -3.10 angle_adjusted=0.47
Pitch= -7.55 angle_adjusted=0.18
Pitch= -11.96 angle_adjusted=-0.11
Pitch= -16.32 angle_adjusted=-0.38
Pitch= -20.62 angle_adjusted=-0.65
Pitch= -24.83 angle_adjusted=-0.93
Pitch= -28.97 angle_adjusted=-1.26
Pitch= -36.97 angle_adjusted=-2.07
Pitch= -40.82 angle_adjusted=-2.56
Pitch= -44.60 angle_adjusted=-3.11
Pitch= -48.26 angle_adjusted=-3.70
Pitch= -51.81 angle_adjusted=-4.33
Pitch= -55.22 angle_adjusted=-4.99
Pitch= -58.49 angle_adjusted=-5.67
Pitch= -61.59 angle_adjusted=-6.45
Pitch= -64.52 angle_adjusted=-7.31
Pitch= -67.24 angle_adjusted=-8.36
Pitch= -69.75 angle_adjusted=-9.62
Pitch= -72.04 angle_adjusted=-11.15
Pitch= -74.09 angle_adjusted=-12.96
Pitch= -75.91 angle_adjusted=-15.05
Pitch= -77.48 angle_adjusted=-17.34
Pitch= -79.88 angle_adjusted=-22.08
Pitch= -80.73 angle_adjusted=-24.22
Pitch= -81.37 angle_adjusted=-25.96
Pitch= -81.79 angle_adjusted=-27.19

For small fast movement angle bigger than 2.5 degree sometimes as result show smaller movement Huh
Pitch= -4.52 angle_adjusted=-3.35
Pitch= -4.21 angle_adjusted=-3.40
Pitch= -4.01 angle_adjusted=-3.42
Pitch= -3.77 angle_adjusted=-3.45
Pitch= -3.48 angle_adjusted=-3.47
Pitch= -3.17 angle_adjusted=-3.50
Pitch= -2.82 angle_adjusted=-3.53
Pitch= -2.45 angle_adjusted=-3.56
Pitch= -2.05 angle_adjusted=-3.59
Pitch= -1.63 angle_adjusted=-3.62
Pitch= -1.20 angle_adjusted=-3.65
Pitch= -0.77 angle_adjusted=-3.68
Pitch= -0.32 angle_adjusted=-3.71
Pitch= 0.11 angle_adjusted=-3.73
Pitch= 0.55 angle_adjusted=-3.75
Pitch= 0.97 angle_adjusted=-3.77
Pitch= 1.38 angle_adjusted=-3.77
Pitch= 1.78 angle_adjusted=-3.78
Pitch= 2.15 angle_adjusted=-3.79
Pitch= 2.50 angle_adjusted=-3.78
Pitch= 2.82 angle_adjusted=-3.78
Pitch= 3.11 angle_adjusted=-3.76
Pitch= 3.38 angle_adjusted=-3.75
Pitch= 3.61 angle_adjusted=-3.73
Pitch= 3.81 angle_adjusted=-3.71
Pitch= 3.98 angle_adjusted=-3.69
Pitch= 4.12 angle_adjusted=-3.67
Pitch= 4.21 angle_adjusted=-3.65
Pitch= 4.28 angle_adjusted=-3.62
Do you have connected the GND from your Arduino to all other components, e.g. Gyro, Stepper Driver, Arduino and Lipo?
Reference URL's