'PID Tuning: A Simple Guide for Beginners'

Was This Guide Helpful?

  • Yes

    Votes: 13 100.0%
  • No

    Votes: 0 0.0%

  • Total voters
    13

anglovirtual

New member
I thought I’d post a simple guide for PID Tuning from what I’ve learnt from trying to tune multirotors. It’s by no means exhaustive, but I’ve tried not to make it too complicated in the hopes that it’s easy for complete beginners to understand and apply quickly in the real world.

Hopefully it can help those who may be struggling with getting to grips with tuning their quads? Or at least give them a starting point.

If this has already been covered elsewhere feel free to take the post down. If not, perhaps it might help someone…
Thanks & happy flying!
Ed


FIRST, AN EASY-TO-UNDERSTAND PID ‘ANALOGY’:

P= 'Power' - how much power is optimum to keep the quad stable. If you want the quad to make corrections at a faster pace: raise the P!

I= 'Intervention'
- how much the quad will intervene to remain stable when some outside force (e.g. wind, gravity!) is acting on it.

D= 'Damping' - Keeps P & I in check!
Fine control and fine tuning of end-range of fast movements in all axis.
(Stops the quad acting like it's drunk!)

Tune either P or I-Gain FIRST, (depending on preference & what works for you- I find it easier to start with P), then lastly D* - SO: 'P - I - D' !

*Your Quad should fly pretty well if P & I are tuned correctly BEFORE you even touch the D values.


PRE-PID TUNING TIPS:

Save yourself a massive headache and ALLWAYS tune your quad with the payload, battery type and weight distribution that you prefer for day-to-day flight! If you tune your PIDs without your camera on the quad, or a different battery type, the PID tune will be likely wrong when you strap-on your camera again! The same goes for props. Changing prop type/size after tuning will affect the PID tune.

Tuning should be done in Acro/Rate mode generally.
Set your RC Rates & Expo to your preferred values.


Raise/Lower values by SMALL AMMOUNTS each time - (Ideally by no more than 10, as it can get confusing!)

BEFORE TUNING TIPS: Its always easier/safer to start tune from the default values of your chosen PID controller, rather than a pre-existing tune or with I & D values set at '0' (as this can cause erratic/uncontrollable flight!)
Starting out with your D values set fairly low will give you a clearer idea of how P and I are behaving.

PITCH and ROLL axis should be main focus of tuning. YAW axis rarely needs much adjustment from stock. (It's good practice to leave P & D gains for Yaw at default until you're happy with the Roll & Pitch tune.)

A NOTE ON ‘D’:
Ideally D should be set fairly low on a good tune. D is mostly there to correct any SMALL amounts of error on P, not massive ones! If D has to be set high to get the quad to fly right this will potentially be putting more load through the FC, ESCs & motors, as the quad is having to correct a lot more in flight. This may result in a slower quad, hotter motors, reduced flight times and reduced component life due to more component load than would be optimum if I, and especially P, was tuned right in the first place!


QUICK PID TROUBLESHOOTING GUIDE:

P too HIGH: Quad wobbles/oscillates in flight (sometimes quite rapidly)

P too LOW: Quad rolls, pitches & yaws by itself during flight.
(Sometimes on one axis or all axes at the same time)


I too HIGH: Quad will over-correct for stick inputs/forces acting on it.
(Continues moving on an axis beyond the point where it was supposed to stop.)

I too LOW: Quad is unable to correct for any forces acting on it & keeps going in same direction.

NOTE: Keep I-gains lower than P-gains
(If I-Gains are HIGHER than P-gains the quad may over-correct/over rotate on its control axis.)


D too HIGH: Quad will be slow/lethargic in response to any stick inputs.

D too LOW: Quad wobbles/bounces slightly when stopping a sudden movement or direction change.


‘FLIGHT TESTING THE TUNE’ – A METHOD:

(It’s best to check the behavior of the tune via video playback from your chosen camera at 60fps, as a high frame rate will show the quads movements in more detail. Writing down each new value tested and its effect on flight behavior each time can really help in understanding what works and what doesn't!)

TUNING P:
P is the most important value to tune FIRST on roll & pitch axis, as this has the most impact on stick feel & responsiveness of the quad. It's a good idea to get this as well tuned as possible (but not necessarily perfect!) BEFORE tuning I and D gains.

P-gain on the roll axis can easily be tested & tuned simply by flying forward and tipping the quad left and right rapidly in the roll axis to see how it responds. Snap and full rolls can also be checked.
(Check for responsiveness & how 'locked in' the quad feels, as well as any bounce-back on rapid stick inputs.)

As P becomes more ‘locked-in’ stick feel should improve- (this sharpens up the response of the quad when raised).

P-gain on the pitch axis can also be tuned the same way: So forward flight and applying rapid alternating pitch up & down stick inputs, and flips if necessary.

If quad flies like a boat, sloppily & loose, or wobbling all over the place, first start by raising P-Gains on Roll & Pitch by maximum of 5 each time and re-test - until the quad flies smoothly.

For the Yaw axis same also applies; just yaw the quad left and right rapidly in forward flight and see how it feels.

If P is too high the quad will shake during flight - (sometimes v.fast shakes)

If P is too low the quad will roll,pitch & yaw by itself during flight.

If Yaw P is too high you can get excess vibrations.
(You rarely get oscillations with higher P-gain on yaw as the axis has much less authority on the quad.)

It is possible to fly with no I values set at all, but the quad will be unable to correct against any forces acting on it (e.g. wind or frame balance/COG) and will keep going in the same direction when a force acts upon it.

If I-Gains are HIGHER than P-gains the quad may over-correct/over rotate on its control axis.
(NOTE: Usually I-gains should be a little lower than P-Gains)


FINE TUNING:
Bounce-back on pitch and roll axis can be corrected by raising P-gains a little.

No oscillation/bounce-back? You can slowly raise P until oscillations start to find the max optimal P value.

If it sounds twitchy even with no control input you should probably lower the P gain until the motors sound more normal again in a static hover and/or on puchouts.

TUNING I:

Check how well the quad holds angles during flight, or does it wobble out of them?
If so, start to turn up the I-gains a little at a time for pitch & roll and re-test.

Now fine tune quad stability by testing on PUNCHOUTS:
Yaw on punchouts? = More yaw I gain.

Nose comes up or drops on punch out? = Pitch I gain up.

Sudden drop of throttle causing roll? = Roll I gain up.

No pitch, roll or yaw on punch out or angled forward flight? =
I-gain tune is likely good!

Now do some FAST TURNS:
If the quad gets sloppy on fast turns, e.g. around a post, try raising Yaw I-gain to give it a more locked-in feel on the yaw axis.

(NOTE: Usually I-gains should be a little lower than P-Gains)

TUNING D:
This mostly helps give quad a 'rock solid'/ 'locked-in' feeling to stick inputs/direction changes when tuned correctly in conjunction with P set right.

Fine-tune the end stability & smoothness of aggressive manoeuvres like sharp turns, flips and rolls by slowly raising D-Gains.
If you still have a little bounce-back on aggressive manoeuvres after tuning P you can correct this now by raising D.

Use the exact same process for fine-tuning D-gains as was done to tune P at the start of this process:
Start with roll axis first. Get that feeling right then move on to pitch, and finally yaw.
(If the quad starts to get sluggish & unresponsive lower D until it sharpens up again. This means D was too high.)


WEIGHT DISTRIBUTION FINE TUNING:
Increase P-Gains slightly for PITCH axis if the quad Centre Of Gravity (COG) is nose or tail heavy. (This can also aid stability for fast forward flight e.g. for a race tune, rather than a pure acro tune.)


Good Luck!
:)
 
Last edited:

Habakkukk

Fly Eagles, Fly!
Man this is great! You could probably find this stuff if you search for a couple hours on the forum, as many times as it's been asked lol. Good stuff! Should save a lot of people time and energy.
 

Snowblind

Propeller Balancer
I vote sticky this; It's got most of what took me 4 months to get down-pat all in one place, and that's after watching YouTube A LOT.

However, D too high doesn't cause higher temperatures on it's own, D compensating for P too high and "slamming the stick" does. Also keeps the FC doing more math, yes, so that gets a little hotter too. Battery is obvious like you said, more power used over-correcting means shorter flight times, higher amp draws ETC. Frame is less obvious, but all the over-zealous movements flex the airframe more than it would with a good tune, unless of course it's made of unobtanium.

I have also found that the default values for KK2 Mini boards apears to me to be waaay too high for quads, with reports(YT vids) saying it's close to good while at default for hex/octo. My builds may be pickier though, as they have the maximum blade size the frames can take, and serious torque to spare on the motors, likely needing less RPM differential to get the effect, and less stick to get the RPM to change.
(death wobble at 50% stock P and zero I, with no D function)
(larger quad has P-I settings of 16-5 to fly and started at 70-50)
 
Last edited:

rockyboy

Skill Collector
Mentor
This is a good guide to make sticky - very helpful to bring this all together for those of us still buying cheap older controllers where the stock PIDs aren't already performing great.

Thanks!
 

makattack

Winter is coming
Moderator
Mentor
Good job! It's a nice write-up/how-to! Don't fret about the number of comments, etc. I tend to think that if your audience is a beginner, they may not have had a chance to comment on this yet, as flying season in the Northern hemisphere is quickly turning into building season. You might find more comments/questions when people head outside again!

I was just out this past weekend in mid 30's/low 40's (F) / 0-4C (in your part of the Northern Hemi!) temps tuning a quad I had finished a while back, but just haven't flown yet due to lack of time. It was cold, and I found it a little difficult, since it was also gusting with 10-15mph winds (leaves kept blowing ontop of my mini quad before I could even spool up!)

My fingers were frozen by the time I was through two batteries, which was enough to get a rough PID tune on roll/pitch/yaw for LOS flight. I haven't even touched FPV tuning yet, and probably won't until Spring!

I used the cleanflight AUX channel in-flight tuning controls to select which component to adjust, and a three position switch to go up/down. When I'm happy, I save the config from my mobile phone running EZGUI connected over bluetooth. Since this quad also has a MWOSD/minimOSD installed, I could have used FPV with stick commands to adjust, but that would have actually taken more time.

On a side note, it's been a while since I've mucked about with quads, and having gone from CF 1.8ish to CF1.13/1.14 was an eye opener as to all the differences.

I think the single biggest "surprise" was the change to the luxfloat PIDC to use the same scale values as the other mwii/rewrite controllers, and how high my P values ended up vs the low I and D values. On one mini, I maxed out P at 200 and still can't get it to oscillate on roll/pitch. On the newer one, I have it at a fairly high 177. Roll/Pitch rates were low at .5, but they fly well for LOS purposes.
 
Last edited:
I really like this tutorial. I have the most experience tuning ArduPilot boards, which can be quite confusing because there PID's for basic Stabilize, rate controller PID's, More PID's for GPS-assisted flight, throttle PID's - never actually counted all the PID loops in Ardu. But if you run into an aircraft like my latest Tri build where Auto Tune is a total disaster and results in a crash, it can take a LOT of experimenting to get it to fly right. And then you switch flight modes and start over.

Thanks for all this great info on how to tune the PID's! It should go into an article or something where good information is archived. It is much more extensive than the docs for Ardu, explaining mainly how to use Auto Tune, which sometimes doesn't work with some frames.

Some additional info:
PID stands for Proportional, Integral, and Derivative gain - it is a standardized mathematical feedback loop used in many industrial and robotic controllers.
 
Great write up! I was just trying to tune out an medium-fast oscillation today, only happening during "punchouts" or if give it a good burst of throttle. TPA was set to 0 @ 1500 IIRC, I tried .5, 1.0 TPA, and then lowing the breakover a couple times, ending at 1350. Seemed to help but it's still there.

One thing I don't see often though - when you guys tune your pitch & roll PID's..do you do them separately (each with its own values ) or do you tune both with the same values? I ask because I know that both options are available
 
One thing I don't see often though - when you guys tune your pitch & roll PID's..do you do them separately (each with its own values ) or do you tune both with the same values? I ask because I know that both options are available

On most multi-rotor aircraft I think they're going to be the same if the aircraft is balanced good. I use different pitch and roll PID's on my TriPlane because it has asymmetric rotor spacing, but that's not what I'd call "normal".

Happy Holidays to everyone on the FliteTest forum!