user14391: Preferably PID functions on an Arduino uno or any other examples. I have been researching but many of the the websites really do not explain it. 
P.S is there an algorithm for a PID? Thanks

user6628: How a PID controller works depends on the particular implementation.
There is a algorithm/library for PID on the Arduino: http://playground.arduino.cc/Code/PIDLibrary and an excellent explanation of the all of functions within it at http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/
Over on stackoverflow and electronics, there are some good questions and explanations that might help:

https://electronics.stackexchange.com/questions/190606/understanding-a-pid-controller
https://stackoverflow.com/questions/14614124/how-do-i-use-a-pid-controller?rq=1
https://stackoverflow.com/questions/21516143/pid-control-value-of-process-parameter-based-on-pid-result?rq=1
https://stackoverflow.com/questions/13542447/i-dont-understand-integral-part-of-pid-controller?rq=1
https://stackoverflow.com/questions/21534996/pid-controller-intuition-for-when-error-0?rq=1


user8033: I, also, didn't get the idea behind PID from just reading Wikipedia. After some videos/tutorials, I believe the best way to explain it is:
What is PID
PID is an algorithm. It involves three factors which can be adjusted to tune a signal.
It is often used in servo's (and things like thermostates, basic signal controllers)
Imagine this
The servo will be used in the practical examples.
A servo has:
- a current position (signal)
- the position you want the servo to be in (goal signal)
- a speed (PID output signal)
The PID output signal/algorithm makes sure that the servo reaches it's goal.
In short:
PID is an algorithm that can adjust a signal towards an setpoint. Or correct it for that matter.
It regulates how much you have to adjust the signal, without getting serious overshoot, or oscillation around the setpoint.
Detail:
P stands for proportional.
Which means that the further the servo is from it's setpoint, the more speed we want to/can give it. So that we're faster towards the set point.
This also means that we slow down as we near the set point.
Of course you can multiply each of these rules with a factor, to achieve a better balance.
I stands for integrating.
It basically comes down to the fact that it constantly keeps adding to the signal, depending on how long there is a difference between the current point and set point. This is so that if P is still a little slow, it adds some speed over time.
D stands for differentiating
It's less commonly used. (Wikipedia)
The D factor reacts on the speed of the change in value. Or speed of change in setpoint (Dutch wikipedia is not 100%, comment if neccesary :) )
These factors / the algorithm provides a smooth regulation of various systems, hence that's why it is so adjustable.
It can be used for balancing quadcopters or making your house comfortably warm (without sudden changes, or too slow changes)
Why?
How would you balance a quadcopter?
If it shifts to one side, you don't want to fully reverse the throttle.
It'll make it wobble, since you get a lot of overshoot.
Controlling things can be hard, PID is an known working algorithm for those cases. But you have to adjust the factors right to adjust it to your specific system. (They all react differently, or have to react differently).

14391: <p>Preferably PID functions on an Arduino uno or any other examples. I have been researching but many of the the websites really do not explain it. </p>

<p><strong>P.S is there an algorithm for a PID? Thanks</strong></p>
 6628: <p>How a PID controller works depends on the particular implementation.</p>

<p>There is a algorithm/library for PID on the Arduino: <a href="http://playground.arduino.cc/Code/PIDLibrary" rel="nofollow noreferrer">http://playground.arduino.cc/Code/PIDLibrary</a> and an excellent explanation of the all of functions within it at <a href="http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/" rel="nofollow noreferrer">http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/</a></p>

<p>Over on stackoverflow and electronics, there are some good questions and explanations that might help:</p>

<ul>
<li><p><a href="https://electronics.stackexchange.com/questions/190606/understanding-a-pid-controller">https://electronics.stackexchange.com/questions/190606/understanding-a-pid-controller</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/14614124/how-do-i-use-a-pid-controller?rq=1">https://stackoverflow.com/questions/14614124/how-do-i-use-a-pid-controller?rq=1</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/21516143/pid-control-value-of-process-parameter-based-on-pid-result?rq=1">https://stackoverflow.com/questions/21516143/pid-control-value-of-process-parameter-based-on-pid-result?rq=1</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/13542447/i-dont-understand-integral-part-of-pid-controller?rq=1">https://stackoverflow.com/questions/13542447/i-dont-understand-integral-part-of-pid-controller?rq=1</a></p></li>
<li><p><a href="https://stackoverflow.com/questions/21534996/pid-controller-intuition-for-when-error-0?rq=1">https://stackoverflow.com/questions/21534996/pid-controller-intuition-for-when-error-0?rq=1</a></p></li>
</ul>
 8033: <p>I, also, didn't get the idea behind PID from just reading Wikipedia. After some videos/tutorials, I believe the best way to explain it is:</p>

<p><strong>What is PID</strong></p>

<p>PID is an algorithm. It involves three factors which can be adjusted to tune a signal.</p>

<p>It is often used in servo's (and things like thermostates, basic signal controllers)</p>

<p><strong>Imagine this</strong></p>

<p>The servo will be used in the practical examples.</p>

<p>A servo has:
- a current position (signal)
- the position you want the servo to be in (goal signal)
- a speed (PID output signal)</p>

<p>The PID output signal/algorithm makes sure that the servo reaches it's goal.</p>

<p><strong>In short:</strong></p>

<p>PID is an algorithm that can adjust a signal towards an setpoint. Or correct it for that matter.
It regulates how much you have to adjust the signal, without getting serious overshoot, or oscillation around the setpoint.</p>

<p><strong>Detail:</strong></p>

<p>P stands for proportional.</p>

<p>Which means that the further the servo is from it's setpoint, the more speed we want to/can give it. So that we're faster towards the set point.
This also means that we slow down as we near the set point.
Of course you can multiply each of these rules with a factor, to achieve a better balance.</p>

<p>I stands for integrating.</p>

<p>It basically comes down to the fact that it constantly keeps adding to the signal, depending on how long there is a difference between the current point and set point. This is so that if P is still a little slow, it adds some speed over time.</p>

<p>D stands for differentiating</p>

<p>It's less commonly used. (Wikipedia)
The D factor reacts on the speed of the change in value. Or speed of change in setpoint (Dutch wikipedia is not 100%, comment if neccesary :) )</p>

<p>These factors / the algorithm provides a smooth regulation of various systems, hence that's why it is so adjustable.</p>

<p>It can be used for balancing quadcopters or making your house comfortably warm (without sudden changes, or too slow changes)</p>

<p><strong>Why?</strong></p>

<p>How would you balance a quadcopter?
If it shifts to one side, you don't want to fully reverse the throttle.
It'll make it wobble, since you get a lot of overshoot.
Controlling things can be hard, PID is an known working algorithm for those cases. But you have to adjust the factors right to adjust it to your specific system. (They all react differently, or have to react differently).</p>
