Zero-PIDs Tuner for Multirotors

This topic is about PID auto tuning algorithm that can tune your Quadcopter from PIDs ZERO as a start value.


       Adjusting PIDs is a problem for many of Quadcopter’ pilots, it would be nice to get your quadcopter to adjust PIDs for itself. I made some investigation in this area, and found many complex algorithms that are related to Adaptive PIDs, and Fuzzy Logic. Although my background is engineering but I don’t like complex math when you can make simple solutions :)

        I started with multiwii version 2.3, I chose it because its code is not that complex, while it has many GUI tools and debug facilities to trace, and it has one of the largest community that can test and verify the results. Anyway I have developed a new mode that I called G_TUNE, which enables quadcopter to calculate flyable PIDs values for ACRO mode. i.e. PIDs for GYRO.

How to Use

       G_Tune mode starts by resetting all Gyro' PIDs for Roll, Pitch & Yaw to Zero’s.  Then pilot needs to takeoff !!  yes it will take off as the algorithm will start instantly to correct errors and update PIDs parameters accordingly. Pilot should try not to make aggressive maneuvers. That is because the error in multiwii is calculated as (RC_Stick - Gyroreading) as stick position acts as rotation speed target i.e. the target rpm, so moving stick suddenly generates false errors.

        The algorithm mainly works as our human eye. what you do is that if you find your quad tilt you give thrust to motor to adjust this tilt. 


      Below is the state machine for the new mode.

    1- As we can see from above state diagram, You need to disarm your quadcopter, then you switch to G_Tune mode. once you do that all PIDs will be Zero and you can test that by switch back to ACRO mode again and try to fly "be careful as you have no control because all PIDs are ZERO"

  2- You can then switch back to G_TUNE the arm your quadcopter. Try to fly carefully, do not make aggressive moves, your quadcopter should fly reasonably stable.

  3- Now switch to GYRO mode in AIR to stop updating the values. dont try to land first. 

  4- Now fly again in ACRO mode and this time it will fly. 

The algorithm was able to generate the following PIDs values for ACRO mode:

Both values in the two screen shots flythe quadcopter


 1- This is a test mode that I tested only on my quadcopter with Simonk ESC, 10x4.5 props and Turnigy 1100 KV. It should work on other configuration, but I have not try it myself.

 2- Moving ELE & ALE sticks just before changing from G_TUNE to ACRO mode could corrupt the values, so please try to fly as stable as possible and switch to ACRO while sticks are almost released for best results.

 3- Switching back from GYRO to G_Tune mode in AIR could be dangerous -however the correction is very fast and it normally works- because PIDs are reset to ZEROs in AIR.




Views: 8386

Comment by John Hestness on June 1, 2014 at 8:10pm

Hmm. Huh. Um, it sounds a little crazy to set your PID's to zero on the ground, much less in the air.  But that is what makes it interesting, isn't it?  I will not be able to try it myself, but I would definitely watch a video, should you happen to post one.  Thanks for the clearly written and enlightening post.

Comment by MHefny on June 1, 2014 at 8:58pm

I am uploading a video now

Sorry but seems this post has been posted by mistake as it was suppose to be draft untill the video is uploaded.

still around 4-5 hours before the video is out there because of the slow internet I have here in home.

Comment by UAS_Pilot on June 2, 2014 at 5:32am

Pretty amazing! Great work.

Comment by MHefny on June 2, 2014 at 11:43am

Thanks :)

Comment by Yuriy Cherniavsky on June 2, 2014 at 3:56pm

Very interesting!

Is it possible to try you G_TUNE mode on AIO Flight Controller with multiwii version 2.3? If yes how? :)

Comment by MHefny on June 2, 2014 at 7:15pm

sure it works on v2.3 and can be compiled on any multiwii board.

I am still working on the algorithm before publishing it.

Comment by Yuriy Cherniavsky on June 3, 2014 at 12:50am

Great! I look forward to publishing of your algorithm. And for sure going to be one of the first tester :).

Comment by leonardthall on June 3, 2014 at 3:08am

Hi MHefny,

Nice job! Can you put up a diagram of the PID loops you are tuning in the Multi Wii. I suspect they are using a different system to the Arducopter code. I would also be interested in hearing more about exactly how you adjust the pid parameters based the gyro measurements.

Thanks for posting!!

Comment by MHefny on June 4, 2014 at 2:14pm

I am tuning Multiwii v2.3 PID of GYRo. Actually the P & I only.

Comment by M Chehadeh on July 22, 2016 at 6:07pm

Salam Mohammad,

Brilliant! Any updates?

I have some thoughts about how you could guess the D-term.

You are a skilled pilot which means you can tune in Acro mode ;) . I can only fly in Angle mode.



You need to be a member of DIY Drones to add comments!

Join DIY Drones


Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service