# PID's Explained In Simple Terms

by jamiedco | February 13, 2014 | (18) Posted in Tips

After a lengthly discussion with my local flying group about how PID's work and what they stand for, I thought I would share it with the larger community. I found that when tuning a multirotor it helps a great deal if you know some basic theory behind the settings that you are adjusting.

To start PID stands for Proportional Integral Derivative. I will cover each of these in this article. For this explanation I will keep things simple and use the example of one car following another car on the road.

Lets assume you are driving down the road and trying to keep a set distance behind the car in front of you, lets refer to that distance as X from here on.

### P is for Proportional

If you are following the car at X distance and you start to get further away from it, you proportionally accelerate to close the gap back to X. If you accelerate too much you will over shoot X, making the distance now smaller than X so you need to slow down in order to get back to X. If you slow down too much you will pass X again and will need to accelerate to get back to X. This will continue if your proportional acceleration is not correct, this is the oscillation you see while tuning a multirotor.

The original kk boards only had a P value to tune with and if tuned correctly they flew well .

#### In multirotor terms:

The Proportional value controls how much effort is applied to correct for a outside force acting upon your multirotor.

### I is for Integral

The integral helps you regain the X distance again and maintain it a lot more accurately. The integral in our example would be you returning to exactly X distance and maintaining it a lot smoother than just proportionally accelerating and decelerating.

#### In multirotor terms:

If your multirotor is at X degrees and the wind blows the integral will try return the craft to X degrees where as if you only had proportional it would only compensate with a proportional response and never actually hit the X degrees perfectly. The integral is not perfect and it will slowly drift off of the X degree mark .

### D is for Derivative

The derivative is used to eliminate an accumulated error on the integral. In our example this would be you noticing X distance growing ever so slightly and preventing the gap from getting any bigger.

#### In multirotor terms:

The derivative further prevents drift of the X degrees mark. The derivative is only found on a few controllers like CC3D and APM, and is not entirely necessary because multirotors are always moving around. It does help keep the craft stable on long straight flights .

I hope this helps with future tuning of your multi's.

Written by Jamiedco
Animations by James Bihl

ashtodust2000 on March 3, 2014
Thanks for a quick, easy to get reference.
PDK on March 20, 2014
Unfortunately this is not a correct explanation for what PID stands for, nor how it works.
The names are correct (Proportional, integral, derivative) but the functions are not.

Proportional. Using the original example of two cars traveling together; the example animation shows a controller with too much proportional gain to the point where it is unstable and cycling. Proportional only cannot control to a set value for X. For a better example we need to look at both cars traveling at the same speed separated by a value X. If the car in front accelerates then the distance X will increase. A proportional controller will then increase the throttle of the second car by a proportion of the change in X (change in X * proportional gain) until the throttle of the second car is enough to make the speeds of both cars equal again. At higher speeds the gap will be larger and slower speeds the gap will be smaller. Proportional control will not close the gap up to a specific value of X again....... thats for the next bit...

Aircraft terms: if the aircraft is blown from the desired attitude proportional control is applied as the angle increases until rotation stops. It does not bring it back.

Integral is reasonably correct. It removes offset. If the value of X is greater than you specify then it will accelerate the car slowly until it is at the correct value of X and then slow again until it remains at this value (both vehicles are now at the same speed again).

Aircraft terms: When an aircraft has rotated from a desired attitude, control is applied incrementally until the aircraft has rotated back to the desired attitude. Integral will not just slowly drift off; however, it will cycle slightly above and below.

Derivative is the rate of change of X. If the car in front accelerates rapidly then X will increase rapidly as well. D will apply a greater amount of control sooner than simply waiting for the proportional to catch up, so can more rapidly dampen a large external change. 'Long straight flights' do not expose the vehicle to rapid changes so the rate of change is small; therefore, the derivative component is also very small.

I must say that I don't fly multi rotors (fixed wings and regular helis) but have tuned a PID controller or two in my time :-). In my experience derivative is rarely used. Just because you can doesn't mean you 'need' to or that it is 'better'. The nature of derivative means that a sudden change in the measured value will mean a large change in the control response. This will occur weather it is a real change or just a noisy signal. If derivative is used it should be with care and only after the P and I are tuned properly.

Hope these examples help.