Detecting Cleanflight PID tuning issues with Blackbox: excess P gain

Almost all quadcopter PID tuning tutorials can be summarized into one sentence: “Increase P until you see oscillations, then lower it”. Plus some thoughts about I and very vague advices about D and that is all. When I got into the hobby, I’ve read all of those tutorials. And I did know more about PID tuning than before that. I even had more questions than before. How to recognize high frequency oscillations, how to recognize low frequency oscillations. Lower P? OK, but how much? And D? How to tune this bloody D? As a result, every time I tried, I ended up with very snappy but shaky quadcopter that maybe responded very quickly to commands, but was very shaky and was making strange noises.

And then came Cleanflight and Blackbox. Live became simpler. What I’ve learned from Blackbox logs is that I wanted high P so much, I had too much of it in the end. Actual oscillations begins before we see or hear them and excess D introduces jello. Blackbox simplified things, but still, logs analysis is something like an art. You have to know what to look for.

Like I wrote above, the most common mistake in PID tuning is excess P gain that leads to oscillations. Those oscillations might not by visible or audible, but gyro will detect them and they will influence control loop, increase power usage, might introduce jello and worsen flight characteristics. So, what to look for?

First, open a log that has everything: low throttle section, hover, hight throttle section, turns, maybe roll or flip. Analyze each axis separately. I like to begin with roll, then go to pitch and finally to yaw. The most useful graph layout is the one where upper section show axis gyro and RC command, and lower one P, I and D for this axis.

blackox, hover, no roll oscillations

Scroll to low throttle section without RC input. If it looks similar to image above, your P is fine for hover. There is some noise in gyro, P and D but it is not moving very much. No high amplitude changes, looks like quad is in a state of balance. It hovers.

But, if it looks like this

excess P gain and roll osciallation on blackbox log

P gain for this axis is most probably too high. There is constant movement on gyro, but RC input is at 0. P jumps up and down, as well as D. At this point you can stop analysis, lower P, and perhaps D, record new log and check what is happening there. If there are no oscillations, you can move further. If oscillations persists, lower P again and record new log.

When there are no oscillations on no RC input and low throttle, next step would be to check what is happening when RC input is applied.

Roll, no roll osciallations, blackbox PID analysis

Look at image above. Roll input is applied, P (and D) does their work and gyro readout follows input. At one point P and D goes negative to slow down roll speed but this is normal. Also gyro readout has some noise, but this is also normal, nothing to worry about. P gain looks fine. Maybe not perfect, but multirotor would be fully flyable. If gyro would not follow input, follow with a big delay or multirotor would be changing attitude into different direction than input, that would mean that P is too low or there is something else very very wrong. But it this case you would not be able to fly.

PID oscillations on RC Input

On image above is an example of oscillations on RC input. Gyro readout is following input, but roll rate is accelerating and slowing down. At one point, it even starts to roll in opposite direction due to overshoot. Once again, P gain is too high. Situation when you do not have oscillations on hover and oscillations on delicate RC input are rare. Usually they appear only on hard stick movement or stick release. And in this case it is about finding balance between both states.

The last step for P tuning for axis would be to check how it looks like on high throttle. By high I mean like 100%. If oscillations would appear there, you have two choices.

  • lower P some more, but that might be not enough and might induce instability on hover,
  • apply TPA (Throttle PID Attenuation) to suppress this state.

Unfortunately, I do not have any log examples that covers this state. Maybe next time. Either way, that is not very different than low throttle analysis. Find a point when oscillations appears, set this value as TPA start point and try to find good attenuation value that suppresses high throttle oscillations.

Here is an example of all three axises readouts:

Roll axis oscillations

Do you see the difference between roll, pitch and yaw? I surely hope so. Roll goes crazy while pitch and yaw are quite steady even when there is pitch RC input.



This procedure might be time consuming and requires few test flights, but is much better and faster than blind tuning only by feeling. There is hard data you can look at and compare with previous tests. I’m not pretending I’m Blackbox expert. I’m far far away from that. But it’s not magic and everyone can learn it, look for patterns and conclude.

5 thoughts on “Detecting Cleanflight PID tuning issues with Blackbox: excess P gain

    1. Hi,

      I took a look at your log and the way I see it:
      * you have a lot of noise on gyros. Maybe it’s not super huge, but visible. Balance props, check bearings and motors. Specially noise of pitch is visible
      * You fly HORIZON or ANGLE, that makes everything hard to detect.
      * Yes, D term is behaving super ugly in your case. Probably because of noise and vibrations.
      * Try lowering D, I would say by half and lower LPF on gyro and D: set gyro_soft_lpf_hz=50 and set dterm_lpf_hz = 30. You might also try lowering D-gain to 0 for starters and record another log, this time in ACRO mode, not ANGLE or HORIZON.

      But gyro noise problem is something you you should address in first place I’m affraid


      1. Hi, thanks for your help now it’s much better. I cut some D and a bit I… What do you think about that log(if you have time) –

        It is hoovering nicely, but shaking on descend and forward flight.
        Tomorrow I’ll do some more tests.

        I really love the inav, poshold and rth with landing are working so good

        1. Yeap, this looks better, but still a lot noise in gyros, but at least D-term is not inducing extra noise to motors.

          Shaking on descend is hard to fight, specially is you can not have high D-gain and so much gyro noise. Only slower descend makes sense here.

          I’ve also noticed, that you operate stick in very nervous way: fast deflections to maximum positions. This might be also the reason of shaking. Try slower sticks movements, gentle.

Leave a Reply

Your email address will not be published.