I tested an MPU-6050 (GY-521) using an Arduino Nano. I used the I2CDevLib and opened the MPU6050_DMP6.ino with the Arduino IDE. I opened the MPUTeapot.pde Processing-file with Processing. A few changes was necessary to make it work:

MPU6050 mpu;

was changed into:

MPU6050 mpu(0x68);

Additionally I commented out this line:


and uncommented this line:


When turning everything on, the arrow (Processing) would turn with 5 degrees/s clockwise around the z-axis (plus a very small amount around the other two axes). After about 20 seconds, it would stop, and turn around the x-axis pretty fast for 3 seconds. Then it would stop. Now, the gyroscope+accelerometer would work perfectly. This happens every time I test it.

This happens only when the gyroscope is perfectly still on the ground. It does not stabilize if I move it around. Only after it is left completely still, it'll stabilize after 23 seconds.

Is this how it should work, or is it a problem with the gyroscope? Could it even be caused by the I2CDevLib? Can anybody else confirm this?

  • According to the datasheet, that was conveniently linked in your question, there is a temperature sensor in the device. Does your code compensate for temperature, because it does seem to be heating up. What happens when you warm the device with your finger once it is stable?
    – jippie
    Commented Mar 29, 2014 at 13:51
  • @jippie I'll check. Commented Mar 29, 2014 at 14:59
  • @jippie It doesn't do anything even if heated up. There is a lot of code to read through for me who is new to Arduino and don't know much C++. But it claims to use some processor inside the chip to process the raw data from the gyroscope and accelerometer and temperature sensor.. Commented Mar 29, 2014 at 15:18
  • @jippie: How did you see that link before I edited it into the question?
    – David Cary
    Commented Mar 31, 2014 at 14:42

1 Answer 1


MPU6050 is a chip that has an intenal (closed and unknown) algorith to calculate orientation. Because you ar reading ANGLE, that means you are using that algoritm, and that "time" may be the time needed for the calibration.

what do you have as output on the serial?

  • It happens every time I close and reopen the serial on the computer. So it would be strange if it is actually it heating up. What do you mean by output on the serial? Commented Apr 1, 2014 at 16:03
  • every time you open/close the serial you are resetting the arduino (see autoreset feature) so yes, it reinforce the "warm up" theory. Track on the serial the time used by every step!
    – Lesto
    Commented Apr 1, 2014 at 16:06
  • Do you imply that the Arduino is trying to compensate for the heating up which does not take place because it's already turned on? Commented Apr 1, 2014 at 16:08
  • 1
    no, i think the algoritm used by the chip is doing some reading to calibrate itself. Many chip has internal activable BIAS, for example on Accelerometer activating this bias you add a -+1G, so you can calculate the real value of G, linearity of value, if it is stable, and a lot of thing used to compensate for real world "noise". Fixing "warmup" to "calibration" in the answer, so it will be clear
    – Lesto
    Commented Apr 1, 2014 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.