1

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

  • 3
    Wikipedia explains it perfectly. Maybe the problem is that you don't understand the explanation? – Majenko Jan 3 '16 at 13:19
  • @Majenko, Hmm, I'd say if people aren't understanding it perhaps the Wikipedia explanation isn't "perfect." Also, quite a few sites don't really explain the terms and what each one does (e.g., how you'd think about or tune a PID controller). – dlu Jan 3 '16 at 21:33
  • When you're asking questions about subjects you're not understanding it really helps if you can say what you've learned in your research and focus the question on the next part you'd like to understand. – dlu Jan 3 '16 at 21:34
  • brettbeauregard.com/blog/2011/04/… is an excellent explanation of the playground.arduino.cc/Code/PIDLibrary – Dave X Jan 5 '16 at 21:12
3

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).

  • +1, but stabilizing a quadcopter can't really be done with a single PID loop; it usually takes 2 cascading PID loops, one for rotational position and one for rotational velocity /Pedantry – BrettAM Jan 7 '16 at 23:16
  • @BrettAM Good point, I thought each axis could be controlled individually by a PID loop, but it might indeed make sense to couple them in some way. – Paul Jan 8 '16 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.