APM 2 gyro (scaling?) issue || RESOLVED

UPDATE 2: This thread is now obsolete! If you're having similar issues to what's been described below, please, report it in this thread.

UPDATE 1: It's now confirmed that there's been a bug found and that it affects some or most of the later production batches of APM2 boards. The bug doesn't affect earlier hardware versions -- only some of the APM2 boards. The problem is that some of the earlier MPU6000/6050 chips don't seem to conform to spec and they had different accelerometer readout scale in the 4g sensitivity range than the now-spec-conforming chips. What this bug does is it basically causes your accelerometer reading to be twice as big as it should which on the other hand causes the tilt angles calculated from the accelerometer readings to be erroneous causing the "creeping" of the attitude estimate. This problem if described in detail below.

THE EASY WAY TO CHECK IF YOU'RE AFFECTED: Just connect to your APM2 with Mission planner and in "Flight data" -view click "Status" and check out your ax, ay and az readings. While keeping your board level your az-reading should be about -1000: if so you're not affected! If the reading it is closer to -2000, however, you're affected by the bug..

If you're affected there's a quick and dirty patch below in the comments that you can use until the official update comes around.




I finally got my APM 2 a week ago and even flew my quad a couple of times more or less succesfully. However, last evening I finished installing my roll-tilt camera mount to the copter and noticed that after a short roll it takes 2-3 seconds for the copter to converge to the actual position. I then started looking into this matter more thoroughly and after shaking my copter around for quite a while I came to the conclusion that it appears the scaling factors of raw gyro output are too small: i.e. the attitude change given by the gyros is too small for any given movement and after the movement it takes 2-3 seconds for the APM2 to converge on the accelerometer reading. Here's a screencap demonstrating the issue:


What you see in the screen cap above happens every time and even after very slow movements. The problem exists on both the roll and pitch axis on my APM2 and makes the autopilot absolutely useless for stabilizing my camera mount as the error can easily be 10-20 degrees plus whatever lag the servos themselves induce.

Is this normal behaviour for APM2? If not what can I do about it?

Oh, and I'm on Win7, and ArduCopter quad 2.5.4. Log file demonstrating the issue further is attached.

2012-05-05 13-30-16.tlog

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Hi ...

    my arduino doesn't seems to show proper heading values.On turning the board by 90 degrees,sometimes it shows about only 50 degrees of turn while other times may also show more than 170 degrees of turn ....

    also my accelerometer doesn't seems to provide good results at a faster speed.I have tried both of the values of gravity 4096 and 9192....what should i do now ...also can some suggest me how to convert acceleration values to total distance covered if my sampling period is 1/8 sec so that i can cross check it .. ...plzz pour down ur suggestions...

  • Is the issue here that the _earlier_ boards had an issue and not the later boards, but the code was written with the earlier ones in mind?  IE, newer boards don't actually have something wrong with them?  I'm asking this because my APM2 order is due to be filled in the next batch of orders (whenever that is :D)

  • Developer


         thanks again for your help on this.

         At the risk of appearing to hijack your work on this, I've started a new discussion here.  I set up a new discussion instead of using this one just because I wanted to make the instructions on what we need from the community to fix the bug really clear.

         If people on this thread have found the problem could you go over there and post your logs?  (Sami, we've already picked up yours from above).

  • 100KM

    Congrats on a great find Sami.  Also the improved camera stabilisation looks promising to me.  Been having issues with camera stabilisation being too jerky.  Can't wait to test your mod and see if it improves that.

    Thanks !

  • Wow! Terrific find everyone. Two thumbs up from this guy. The new scaling and PD loop for the camera stabilization made all the difference in the world for me. March APM2.

  • It does seem to be H/W revision dependent. I have one of the first production run APM2 and it needs the 4096 value. Converges very slowly with the 8192 patch. An auto-detect would be great.

  • The file worked well for me. Very quick and no creep
  • Thanks, I have been asking about this for the last 4 weeks and no one has commented on it.  Good research.  I will try this out.

  • T3

    RESOLVED: Found a bug with the accelerometer scaling! The MPU6050 is set to 4g scale which means 8192 LSB/g but in AP_InertialSensor_MPU6000.cpp the scaling factor is 4096 as if the sensor value was being scaled for 8g sensitivity. I changed this scaling value to 8192 and the issue went away. So I'm pretty sure it's a bug in 2.5.4 and seems like the same bug exists in the 2.6 beta in the Git repository too.

This reply was deleted.