What is a PID Controller? | DigiKey

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ค. 2024
  • PID controllers are popular control mechanisms found in many systems used to help drive the main process’s output to achieve some desired set point. PID stands for “proportional, integral, derivative.” The controller compares the output of the process to some set point to create an error term. That error term is used in three separate calculations to produce a control signal for the process or plant.
    The written description for PID controllers can be found here: www.digikey.com/en/maker/proj...
    In the video, we use an example of a cruise control system in a car. We want to design a mechanism that can maintain a constant speed by controlling the position of the accelerator (gas pedal). PID controllers are a perfect fit for such a system. In fact, most modern cars use PID controllers for cruise control.
    A simple, naive approach to designing such a controller is to adjust the process’s input signal based on the set point alone with no feedback. This is known as an “open-loop control system.” This may work in some cases, but most of the time, the output is dependent on other factors (such as road conditions and hill climbs for our cruise control system). As a result, we need to incorporate feedback into our controller.
    A “closed-loop control system” measures the actual output of the process and compares it to the set point. The error is the difference between these two values, and it’s used as the input to the controller. The controller looks at that error and makes adjustments as needed to the process’s input.
    The proportional (P) part of the PID controller simply multiplies the error term by a constant, Kp. The further away the process’s output is from the set point, the higher the magnitude of the input value. This works in some cases, but it can result in “steady-state error” where the desired output can never be achieved. In our cruise control example, if we are at our cruising speed, the error is 0, which means that we should completely release the gas pedal. Obviously, this is not a desired behavior, so we add additional terms to our controller.
    The integral (I) term sums the error term over time and multiplies this sum by a constant, Ki. This process solves the issue of steady-state error found in the P controller. As the steady-state error accumulates, the I term causes the process input signal to increase, thus closing the gap found in that steady-state error. It essentially looks at the past performance of the system and adjusts as needed.
    Sometimes, a PI controller is sufficient. However, you often face a tradeoff when tuning such a system. You can either have an “overdamped response” where the error slowly (but surely) approaches 0, or you can have an “underdamped response” in which the output quickly approaches the set point but oscillates for some time. If you want a “critically damped” system that quickly approaches the set point and settles with little or no oscillation, you need to add a third term.
    The derivative (D) term counteracts the effects of the proportional and integral terms. It attempts to predict where the response is headed by solving for the slope of the error curve and multiplying that value by the constant Kd. If the magnitude of the slope is too high, such that the system is approaching 0 error too quickly, it will add a negative value to the sum of the P and I terms, thus “pulling back” on the input.
    With properly tuned Kp, Ki, and Kd values, systems should ideally become critically damped where the output quickly approaches the set point without any overshoot. Tuning a PID controller can be quite involved, and we will cover it in a future video.
    Note that most modern PID controllers are implemented in software to run on computers or microcontrollers. We provide a snippet of pseudocode to help you get started implementing your own PID controllers in, say, Arduino.
    Product Links:
    STMicroelectronics Inverted Pendulum Kit - www.digikey.com/en/products/d...
    Related Articles:
    STMicroelectronics Inverted Pendulum Kit Curriculum - www.st.com/content/st_com/en/...
    Learn more:
    Maker.io - www.digikey.com/en/maker
    DigiKey’s Blog - TheCircuit www.digikey.com/en/blog
    Connect with DigiKey on Facebook / digikey.electronics
    And follow us on Twitter / digikey
    00:00 - Intro
    00:57 - Control Theory Overview
    02:53 - Open-loop System
    03:59 - Closed-loop System
    05:06 - Proportional Controller - Distance
    07:37 - Proportional Controller - Cruise Control
    10:04 - Proportional and Integral Controller
    14:05 - Over, Under, and Critically Damped Responses
    15:04 - Proportional, Integral, and Derivative Controller
    18:12 - PID Controller Tuning
    19:43 - Code Example
    21:09 - Use Cases
    21:44 - Conclusion
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 69

  • @pekhotinyets
    @pekhotinyets 8 หลายเดือนก่อน +13

    I have watched many videos on PID control, but this is the one where it finally clicked.

  • @micah2936
    @micah2936 8 หลายเดือนก่อน +29

    This is honestly the BEST explanation of PID. I’ve watched many videos on it and read articles. I’ve just hear that it’s an “art” or that it’s something debated about, but nothing like this. This just straight into the facts and math.

    • @ShawnHymel
      @ShawnHymel 8 หลายเดือนก่อน +4

      Glad you liked it! Tuning them can be a bit of an art, which I only briefly covered here :)

    • @JL-to9vg
      @JL-to9vg 8 หลายเดือนก่อน +3

      Same here, even some of the "better" articles would neglect or leave out one element or another. He covered each mode and key aspects so well- it was like I could "see" each mode in action just from his explanations. TYVM, Shawn! I plan to share this with my class and possibly an instructor from a previous class.

    • @ShawnHymel
      @ShawnHymel 8 หลายเดือนก่อน +1

      @@JL-to9vg Thank you! I hope that your students find the explanation useful!

  • @ScientificThamizhan
    @ScientificThamizhan 8 หลายเดือนก่อน +4

    One of the best video that actually help you to understand how a PID controller works.

  • @tehmudjinkhan2207
    @tehmudjinkhan2207 8 หลายเดือนก่อน +6

    Been looking to get deeper into PID controllers. Perfect timing on the video.

  • @jimomertz
    @jimomertz 8 หลายเดือนก่อน +18

    Shawn, you are such an excellent presenter! Looking forward to more. I really loved your KiCad tutorial series also.

    • @pekhotinyets
      @pekhotinyets 8 หลายเดือนก่อน +1

      I still refer back to that series when I work on my boards

  • @pabcet
    @pabcet 8 หลายเดือนก่อน +4

    Shawn, this is one of the best explanation on PID, thanks a lot.

  • @grottyboots
    @grottyboots 8 หลายเดือนก่อน +8

    Brilliant! I love that the PID controller applies to so many widely varying systems... massive boilers operating on hour time scales, or as fast as modern motor controllers in the millisecond range.

  • @rickh6963
    @rickh6963 8 หลายเดือนก่อน +6

    Shawn, another fantastic video. Thank you DigiKey!!

  • @dwagner6
    @dwagner6 8 หลายเดือนก่อน +6

    Would have been amazing if my Control Systems professor had just played this video for us

    • @dwang085
      @dwang085 8 หลายเดือนก่อน

      Same!!

  • @mruthyunjayamr7147
    @mruthyunjayamr7147 8 หลายเดือนก่อน +2

    There was such clarity and continuity in the explanations...
    Really liked and understood the concept clearly ....
    This was really helpful ....

  • @chinmayyande5024
    @chinmayyande5024 8 หลายเดือนก่อน +1

    Thank you Shawn for diving into PID controllers. This is extremely helpful.

  • @spreaderikthierheimer9271
    @spreaderikthierheimer9271 8 หลายเดือนก่อน +2

    This is an amazing explanation of PID THANK YOU!

  • @alejandromoreira9896
    @alejandromoreira9896 3 หลายเดือนก่อน +1

    Honestly, this is the BEST explanation of PID, although the SUM column is summed wrong.

  • @4473021
    @4473021 7 หลายเดือนก่อน +1

    Shawn this was so good I wish my controls profs were this clear 😭😭😭😭

  • @erdum
    @erdum 8 หลายเดือนก่อน +1

    I was trying to understand this as an programmer for almost a year now finally I get it.

  • @ismenc
    @ismenc 8 หลายเดือนก่อน +3

    i wish PID in universities were as simple as this :)

    • @ShawnHymel
      @ShawnHymel 8 หลายเดือนก่อน +1

      I'm guessing that they give you the transfer function of the plant and have you solve the differential equation analytically. If so, yeah...that sounds rough 😅

    • @ismenc
      @ismenc 8 หลายเดือนก่อน +1

      @@ShawnHymel Exactly. Just to know in the next subject that everything of that has no real application because real world 'behaviour formulas' are complex and computers don't process feedback in real time.

  • @TradieTrev
    @TradieTrev 8 หลายเดือนก่อน +2

    Great video Shawn, out of all the courses I've taken about PID loops you've really explained the principles and terms spot on!

  • @kedarpuranik750
    @kedarpuranik750 7 หลายเดือนก่อน +1

    This is the best video on PID!

  • @amritpalsingh314
    @amritpalsingh314 2 หลายเดือนก่อน

    Probably the BEST video on PID controllers.

  • @aliusef2912
    @aliusef2912 2 หลายเดือนก่อน

    the best explanation on the PID controller I've ever seen on TH-cam. thanks

  • @Factory400
    @Factory400 8 หลายเดือนก่อน +5

    Excellent presentation as always!

  • @willowdesk
    @willowdesk หลายเดือนก่อน

    The beginning 60 seconds demystify the block diagram so much

  • @benarcher372
    @benarcher372 8 หลายเดือนก่อน +4

    Excellent description!

  • @Dr.Bigglesworth
    @Dr.Bigglesworth 6 หลายเดือนก่อน +1

    That is an excellent presentation. Best one I've seen that describes in detail actually what the P, I & D do.

  • @Akeshma
    @Akeshma 8 หลายเดือนก่อน +1

    Thanks for the explanation.. we need another video illustrate PID using Arduino

  • @rinokentie8653
    @rinokentie8653 8 หลายเดือนก่อน +4

    Very useful video, thanks.

  • @MrOnlineCoder
    @MrOnlineCoder 4 หลายเดือนก่อน

    Amazing video - clear, visually understandble, with a nice host.

  • @salahh89
    @salahh89 หลายเดือนก่อน

    What a great demonstration! Thanks a lot

  • @dzorzstops5136
    @dzorzstops5136 หลายเดือนก่อน

    Best explanation of PID EVER!

  • @a_boy_can_dream
    @a_boy_can_dream 27 วันที่ผ่านมา +1

    You're awesome! Wonderfully well-explained!

  • @andrewlohbihler6731
    @andrewlohbihler6731 8 หลายเดือนก่อน +1

    Thanks Shawn, good example to follow with coding. Will try a desktop example with Arduino code.

  • @fl4tcircl3
    @fl4tcircl3 7 หลายเดือนก่อน +1

    This is so good!

  • @JeremySpidle
    @JeremySpidle 8 หลายเดือนก่อน +1

    Props! College level stuff here AND its accessible, even to beginners.

  • @saeedamini8098
    @saeedamini8098 3 หลายเดือนก่อน

    absolutely brilliant. Thank you shawn.

  • @nikitam6164
    @nikitam6164 3 หลายเดือนก่อน

    Awesome video. I have never come across such cleanly explained example.

  • @joymakerRC
    @joymakerRC 8 หลายเดือนก่อน +4

    I love you bro. thanks for filling in the gaps of my knowledge. I have been using the STM32 nucleo family to build a UAV controller. definately perfect timing for me too.

  • @divya2225
    @divya2225 2 หลายเดือนก่อน

    loved it . simple and easy to understand .

  • @hojvaelde
    @hojvaelde หลายเดือนก่อน

    Hello
    Just my own comment to your fine explanation.
    I have a hydraulic project where I have to control the force from a cylinder through a load cell.
    What makes hydraulics special is the response time.
    The used servo valves have a 0-50% opening time of 6 msec (common in servovalves). That's why I must use a PID regulator with a cycle time of 1 - 2 ms.
    There is only an expensive servo controller that can do that, or an analog PID controller, that I used.
    Another part you easily skip over is the partial feedforward. It is frequently used in hydraulics.

  • @ugetridofit
    @ugetridofit 8 หลายเดือนก่อน +1

    Now we need a new method AIPID, or PIDAI. Where we slap AI to the PID for it to figure out the prefect values for us.

    • @ShawnHymel
      @ShawnHymel 8 หลายเดือนก่อน

      You read my mind 😁 There are automated methods of finding PID constants, which have been in use for a while. I’m currently experimenting with using RL to figure out a generic controller (including swing-up). My hope is that this will be the next video.

  • @alfcnz
    @alfcnz 5 หลายเดือนก่อน +1

    This was great! Thanks for the informative lecture!

  • @tanjiro3285
    @tanjiro3285 8 หลายเดือนก่อน +1

    my fav man on ytb🤩

  • @rolfw2336
    @rolfw2336 5 หลายเดือนก่อน +1

    Nice explanation, Shawn! I liked that there was a bit of math and a bit of code. PS: nice meeting you last week :)

  • @solomon337
    @solomon337 3 หลายเดือนก่อน

    Great explanation

  • @ashinthaCARBON
    @ashinthaCARBON 3 หลายเดือนก่อน

    thank you ❤

  • @SimpleAnalogy
    @SimpleAnalogy 4 หลายเดือนก่อน

    NICE one..Thanks!

  • @jan-willemrensman
    @jan-willemrensman 6 หลายเดือนก่อน

    Excellent ❤

  • @mschwage
    @mschwage 4 หลายเดือนก่อน

    Awesome video

  • @MrApinder
    @MrApinder หลายเดือนก่อน

    I’d like to hit the like button a thousand times

  • @phantomaticscience6846
    @phantomaticscience6846 6 หลายเดือนก่อน +1

    teaching genius :)

  • @boldattempt390
    @boldattempt390 2 หลายเดือนก่อน

    Great video, very informative thank you. However can someone please say why the integral term Ki value was set to 0,01 in the example?

  • @Jkauppa
    @Jkauppa 8 หลายเดือนก่อน +1

    do you mean s=s0 + vt + ½at^2 balancer (position, speed, acceleration controller)

  • @micah2936
    @micah2936 8 หลายเดือนก่อน +1

    20:18 setpoint was not defined, what is setpoint? Is that the set value we need?
    Also error_prev should be set equal to error at the end of the loop right
    Nvm I just wasn’t there yet lol

  • @josephchamness9915
    @josephchamness9915 8 หลายเดือนก่อน +1

    A car wouldn't have any overshoot if you just kept it floored until your set speed, would it? So wouldn't you only use the PID after you got up to speed? Maybe that will be part of the next episode.
    Anyway, thanks for the video, it helped explain PIDs nicely, looking forward to the next one.

    • @dwang085
      @dwang085 8 หลายเดือนก่อน

      You’d have to precisely let off the pedal at the right moment. The car has inertia and there is a time constant associated with the moment the pedal position changes to the moment the engine changes the torque applied to the wheels. All of that results in you having to letting off the pedal BEFORE the speed set point is achieved. Otherwise there would definitely be overshoot.

    • @josephchamness9915
      @josephchamness9915 8 หลายเดือนก่อน

      ​@@dwang085 My question was meant to be more about initial values, starting/stopping point for the PID and maybe when to use/swap out the PID. Sorry if I come across as nitpicking the model.
      But using it as an example:
      As soon as you stop adding power, it would stop going faster (well unless you are going downhill etc. but that sort of thing should be outside the model) And the amount of inertia needed to be overcome to move the pedal position would be small enough I don't think it would matter, probably even happen before the next piston power stroke. Especially with fuel injection etc. And even if it would take a very small amount of time for the accelerator to move, you could still hand over at 99.9km/h. (Although I guess whatever you are using to automatically move the pedal could be quite slow (erm, do they even move the pedal nowadays?))
      As for the car, engine, flywheel etc. inertia would help keep the current speed. It can't add speed, or you would have a perpetual motion machine.
      So you shouldn't need the PID until you are up to speed?
      Anyway, my point being that in similar cases wouldn't it be better to hand over to the PID after a certain point, maybe with initial values taken from a table etc?

  • @prabuddhajadhav2933
    @prabuddhajadhav2933 หลายเดือนก่อน

    How do you define interval? Like if I'm reading sensor value at every 1msec then interval =1msec????

  • @BackyardFusion
    @BackyardFusion 3 หลายเดือนก่อน

    How is e(t) a wave curvy functions it should be linear

  • @MePeterNicholls
    @MePeterNicholls 2 หลายเดือนก่อน +1

    Now…. How do you make the tuning automatic/dynamic/inteligent 😜

  • @lumek88
    @lumek88 7 หลายเดือนก่อน +1

    Don't guess or use ancient tuning method.