Betaflight Auto Pid Tuning

novuh @ propwashed
Thread OP
I put together a video this weekend covering my favorite method to initially tune or re-tune my racing quads after a build/rebuild. I thought some on this forum may find it useful:
Initial PIDs the Easy Way [PropWashed Testbench] (8 min 53 sec)

I've copied over the associated write-up below, for those who can't/won't watch videos:
The operating concept I use for this tune is that the ‘P’ term is the most important value to tweak to get a “flyable” quad. The Betaflight & Cleanflight ‘I’ term defaults are generally acceptable for a first-time tune, and the ‘D’ term is more about stick feel than practicality.
The thing I like about this tuning method is that it is super simple once you get used to it. You can get a very good initial tune in 10-20 minutes using a very pragmatic procedure. I will never tell you to “keep adjusting this number until the quad ‘feels’ right” in this article. The adjustments made will only be in response to observable changes in your quads behavior as you go through the procedure. This article assumes you are good enough at flying your quad in 3rd person that you can fly it with the rear facing you for long periods of time with no crashes. It also assumes you are flying in 'rate' mode (or 'acro') - but the method will work, albeit less well, in 'level' mode. It will work fine on any flight controller software that can interface with Cleanflight Configurator, but as always I suggest you move to Betaflight as it is the premier flight controller software out there right now if you care at all about performance.
Transmitter Initial Set-up
The first thing you’ll need to do is set up a 3-position switch on your RC transmitter to control RC channel 6 or 7.
Set-up in Cleanflight
This tuning method uses Cleanflight’s in-flight adjustments feature. This feature, which is officially documented here, allows you to configure a switch on your transmitter which will allow you to increase or decrease many of your flight controller settings while in flight. In this case, we will be using it to adjust our P gain while flying. The in flight adjustment tab has a lot of really cool features, and I highly recommend you take the time to read the documentation if you are interested.
Hook up your quad to your computer. If your RC RX can be powered by USB power (which most should), you can leave the flight battery unplugged. Now, open up Cleanflight Configurator and connect to your quad. Go to the receiver tab and verify that your RX is working and that the switch you configured earlier on channel 6 is working correctly. It should show up as “AUX2”.
Now, go to the “Adjustments” tab. We will start by tuning the pitch P value. Set-up your top two adjustment areas so that they look like this:
Note that you will need to configure “AUX 2” (this is channel 7 – if you did not use this channel, pick the correct AUX for what you did use) in all four drop-downs, and select “Pitch P Adjustment”.
Now, flip the 3-position switch on your RC TX. When it is in the lowest position, the little green nub (circled in blue) on both of the sliders should be in the left area of the slider and should end up between the two sliders in the lower adjustment area:
If the green nub goes to the right side of the line, you will need to reverse your channel 6 on your transmitter.
Next, flip your switch to the middle position. The green nub should appear near the center of the sliders and should not be in between either of the sliders in any of the adjustment areas. This is your “dead position”, where nothing is happening:
Finally, flip your switch to the top position. The green nub should now appear near the right side of the slider bar and should appear between the sliders in the upper adjustment area:
Now, click “save” to save your changes. What you’ve done is set up your 3-position switch so that when it is in the uppermost position, the pitch P value will steadily increase. When it is in the lowest position, the pitch P value will steadily decrease. Finally, when it is neutral, nothing will happen.
Let’s check that this is working. Go to the PID Tuning tab and note your pitch P value on a piece of paper. Now, flip your switch to the lowest position and repeatedly click “Refresh” at the bottom of the Configurator window. You should see that your Pitch P value steadily decreasing. Nice! Flip the switch back to neutral and notice how the P value stays where it was at. Go ahead and reset the P value back to where it was before now.
Initial PID Configuration
I’m going to assume you are using Betaflight or Cleanflight, so that the default PID values are “reasonable” (e.g. – your quad at least flies with them). Write them all down for reference. Now, half all of your pitch and roll P, I and D values. You are halving your I and D values so that they don’t interfere with the P gain as much. Some people set these to zero but I find a low value seems to do just as good. You are halving the P value just in case it is too high to start with. Do not touch your yaw values. Click “Save” and lets go fly!
Flight Testing
The flight test is actually very simple. Simply hover your quad in front of you, and flip your 3-position adjustment switch up. Now slowly rock your quad forwards and aft with the pitch stick and wait. The quad will slowly get more and more “jittery” as the P value is increased by the in-flight adjustment bound to your stick. You are waiting for the moment when the quad starts to wobble noticeably without stopping. This can take up to a minute, depending on how low your initial settings are and how aggressive your set-up is. As soon as this happens, flip your adjustment switch back to the middle and land and disarm immediately. Flying for an extended amount of time like this can overheat your motors and ESCs. Do not unplug the battery.
What you have just determined is your quads maximum pitch P value. It is now stored in your quad, but it will be lost if you unplug the battery because in flight adjustments do not save through power cycles. You must attach your quad to your computer without powering it off to see what the maximum pitch P value is. To protect yourself from the props, through a blanket or pillow over the quad or lay it upside down so that if the props do decide to spin, at least it won’t take off into your face. Alternatively, you can plug your quad into your computer then immediately unplug the flight battery since the computer’s USB power will keep the flight controller alive.
Connect to the quad via Cleanflight Configurator and go to the PID tab. Note the P value, which should be much, much higher than it started, and reset it back to half the default you recorded earlier.
Now it’s time to do the roll axis. Reset the P value to half of it’s default. Next, go back into the adjustments tab and change them so that you are now adjusting the roll P values:
Hit save, and test that it is working, per the instructions above. The switch should now control the value of the roll P gain. Unplug the quad from your computer and go back outside. Repeat the above procedure to get the maximum roll P value.
Done!
Believe it or not, you now have the two most important numbers for your initial tune for your quadcopter. Plug the quadcopter into the computer if it is not already plugged in. Go to the PID tab and enter half of the maximum pitch P value into the pitch P text field. Now enter half of the maximum roll P value into the roll P text field. Go ahead and double your pitch and roll I and D values so that they are back to defaults. That’s it! Your quad should fly pretty damned well with these settings.
One thing you want to make sure to do is to disable the adjustments. If you don’t do this, you risk accidentally going to the field and leaving your TX adjustment switch up or down, causing the P values to rise or plummet until you crash. You can turn off adjustments by going to the adjustments tab and turning off the enabler switches:

Pid Tuning Methods

Tpa
  1. Contribute to betaflight/betaflight development by creating an account on GitHub. In 4.0x, with rcsmoothing in auto mode. The biggest change is the provision of sliders to simplify tuning the PID values. Quads with low authority (heavy 4S GoPro machines or 7' with slightly over-propped motors) will usually do better with the master PID.
  2. Betaflight 4.2 Timeline Announced. The timeline for the release of Betaflight 4.2 has been announced. The release is planned for 1 May 2020. If you are planning to contribute code to Betaflight 4.2, or would like to participate in pre-release testing, please read the article for the details.

Betaflight Pid Settings

Betaflight Auto Pid Tuning Kit

Detecting Cleanflight PID tuning issues with Blackbox: excess P gain December 11, 2015 January 19, 2020 Almost all quadcopter PID tuning tutorials can be summarized into one sentence: “Increase P until you see oscillations, then lower it”.