Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application...

50
Feedback Control

Transcript of Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application...

Page 1: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Feedback Control

Page 2: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Outline

Background & Motivation

Theory

Applications

Takeaways & Questions

Page 3: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

What is Feedback Control?

Page 4: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Definition

Optimizing a system’s performance by feeding its output back into its input

Page 5: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Motivation

Wider bandwidth

Less interference

More stability

So much more!!

https://www.allaboutcircuits.com/worksheets/passive-filter-circuits/

Page 6: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

What are applications for YOU?

Page 7: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Applications for YOU

Better treasure detection

Improved line/wall sensors

Faster robots

So much more!!

https://giphy.com/gifs/dancing-happy-mIZ9rPeMKefm0

Page 8: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

THEORY

Page 9: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Theory

𝑯𝑯 𝒔𝒔 =π’šπ’šπ’–π’– =

𝑨𝑨(𝒔𝒔)𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔)

π’šπ’š = 𝑨𝑨 𝒔𝒔 𝒆𝒆

𝒇𝒇 = 𝑩𝑩 𝒔𝒔 π’šπ’š

𝒆𝒆 = 𝒖𝒖 βˆ’ 𝒇𝒇

π’šπ’š = 𝑨𝑨 𝒔𝒔 𝒆𝒆= 𝑨𝑨 𝒔𝒔 𝒖𝒖 βˆ’ 𝒇𝒇= 𝑨𝑨 𝒔𝒔 𝒖𝒖 βˆ’ 𝑩𝑩 𝒔𝒔 π’šπ’š= 𝑨𝑨 𝒔𝒔 𝒖𝒖 βˆ’ 𝑨𝑨 𝒔𝒔 𝑩𝑩 𝒔𝒔 π’šπ’š

Page 10: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Non-inverting Op-amp

What’s the equation for Vout?

Page 11: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Application of Theory

𝑯𝑯 𝒔𝒔 =π‘Ήπ‘ΉπŸπŸ + π‘Ήπ‘Ήπ’‡π’‡π‘Ήπ‘ΉπŸπŸ

= 𝟏𝟏 +π‘Ήπ‘Ήπ’‡π’‡π‘Ήπ‘ΉπŸπŸ

𝒖𝒖 = π‘½π‘½π’Šπ’Šπ’Šπ’Šπ’šπ’š = 𝑽𝑽𝒐𝒐𝒖𝒖𝒐𝒐𝑨𝑨(𝒔𝒔) = 𝑨𝑨𝒗𝒗

𝑩𝑩(𝒔𝒔) =π‘Ήπ‘ΉπŸπŸ

π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇

π‘½π‘½π’π’π’–π’–π’π’π‘½π‘½π’Šπ’Šπ’Šπ’Š

= 𝑨𝑨(𝒔𝒔)𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔)

=𝑨𝑨𝒗𝒗 (π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇)

(π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇 + π‘¨π‘¨π’—π’—π‘Ήπ‘ΉπŸπŸ )

For large Av

Page 12: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Low-pass Filter

𝑨𝑨(𝒔𝒔) =π‘¨π‘¨πŸŽπŸŽ

𝟏𝟏+ π’”π’”πœΆπœΆ

𝑯𝑯(𝒔𝒔) =𝑨𝑨(𝒔𝒔)

𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔) =π‘¨π‘¨πŸŽπŸŽ

𝟏𝟏 + π’”π’”πœΆπœΆ

DC Gain : π‘¨π‘¨πŸŽπŸŽ Pole: πŽπŽπ’‘π’‘ = 𝜢𝜢

𝑩𝑩 𝒔𝒔 = 𝟎𝟎

Page 13: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Filter with Feedback

𝑨𝑨(𝒔𝒔) =π‘¨π‘¨πŸŽπŸŽ

𝟏𝟏+ π’”π’”πœΆπœΆ

𝑩𝑩 𝒔𝒔 = 𝟏𝟏

𝑯𝑯(𝒔𝒔) =𝑨𝑨(𝒔𝒔)

𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔) =

π‘¨π‘¨πŸŽπŸŽπŸπŸ + 𝒔𝒔

𝜢𝜢

𝟏𝟏 + π‘¨π‘¨πŸŽπŸŽπ‘©π‘©πŸπŸ+ 𝒔𝒔

𝜢𝜢

=π‘¨π‘¨πŸŽπŸŽ

π‘¨π‘¨πŸŽπŸŽπ‘©π‘© + 𝟏𝟏 + π’”π’”πœΆπœΆ

DC Gain : π‘¨π‘¨πŸŽπŸŽπ‘¨π‘¨πŸŽπŸŽπ‘©π‘©+𝟏𝟏

Pole: πŽπŽπ’‘π’‘ = 𝜢𝜢(𝟏𝟏+ π‘¨π‘¨πŸŽπŸŽπ‘©π‘©)

Page 14: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Feedback Consequences

Feedback trades lower gain for higher bandwidth!

DC Gain : π‘¨π‘¨πŸŽπŸŽπ‘¨π‘¨πŸŽπŸŽπ‘©π‘©+𝟏𝟏

Pole: πŽπŽπ’‘π’‘ = 𝜢𝜢(𝟏𝟏+ π‘¨π‘¨πŸŽπŸŽπ‘©π‘©)

DC Gain : π‘¨π‘¨πŸŽπŸŽ Pole: πŽπŽπ’‘π’‘ = 𝜢𝜢

Page 15: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Theory Review

Error Correction by feeding output back to input

Applications for bandwidth, interference, and stability

Can be used as a circuit analysis tool

Trades lower gain for higher frequency range

𝑯𝑯 𝒔𝒔 =π’šπ’šπ’–π’– =

𝑨𝑨(𝒔𝒔)𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔)

Page 16: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Line Following

https://giphy.com/gifs/arduino-RhdxqQ81tfURi

Page 17: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

How Do Line Sensors Work?

Page 18: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Line Sensor Hardware

http://www.instructables.com/id/Line-Follower-Robot-PID-Control-Android-Setup/

Page 19: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Digital Output

http://www.instructables.com/id/Line-Follower-Robot-PID-Control-Android-Setup/

Page 20: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Servo Correction

Left Servo Speed : 50Right Servo Speed : 50

Left Servo Speed : ?Right Servo Speed : ?

http://www.instructables.com/id/Line-Follower-Robot-PID-Control-Android-Setup/

Page 21: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Digital Output

Left Servo Speed : 50Right Servo Speed : 50

Left Servo Speed : 50 - errorRight Servo Speed : 50 + error

http://www.instructables.com/id/Line-Follower-Robot-PID-Control-Android-Setup/

Page 22: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

PID Algorithm

Page 23: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Definition

A robust closed-loop control algorithm particularly well-suited

for rapid prototyping robotics

Page 24: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Block Diagram

Set-point: Distance from line we wantController Output: Motor speed we wantProcess Variable: Distance from line we get

Page 25: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Transfer Function

A - Rise Time

B - Percent Overshoot

C - Settling Time

D - Steady State Error

https://en.wikipedia.org/wiki/PID_controller

Page 26: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

PID Algorithm

Proportional: Difference between set-point and measured process variable (error)

Integral: Sum of errors over time

Derivative: Rate of change of error over time

Page 27: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Fundamental Block Diagram

https://qph.ec.quoracdn.net/main-qimg-f80e2346eca7905cdc90e38450483be6

Page 28: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Proportional Pseudocode

Page 29: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Why isn’t Proportional Enough?

Page 30: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Why isn’t Proportional enough?

High Steady State Error

Long Settling Time

https://en.wikipedia.org/wiki/PID_controller

Page 31: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

PI Pseudocode

Page 32: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Why isn’t PI Enough?

Page 33: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Why isn’t PI enough?

High Percentage Overshoot

https://en.wikipedia.org/wiki/PID_controller

Page 34: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

PID Pseudocode

Page 35: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Effects on Transfer Function

https://en.wikipedia.org/wiki/PID_controller

Page 36: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Finding Coefficients

Set all coefficients to zero

Increase Kp until system oscillates

Increase Ki until steady state error corrected

Increase Kd until overshoot decreased

https://en.wikipedia.org/wiki/PID_controller

Page 37: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Recap

Page 38: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Feedback Control

𝑯𝑯 𝒔𝒔 =π’šπ’šπ’–π’– =

𝑨𝑨(𝒔𝒔)𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔)

Page 39: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Analog Application

𝑯𝑯 𝒔𝒔 =π‘Ήπ‘ΉπŸπŸ + π‘Ήπ‘Ήπ’‡π’‡π‘Ήπ‘ΉπŸπŸ

𝒖𝒖 = π‘½π‘½π’Šπ’Šπ’Šπ’Šπ’šπ’š = 𝑽𝑽𝒐𝒐𝒖𝒖𝒐𝒐𝑨𝑨(𝒔𝒔) = 𝑨𝑨𝒗𝒗

𝑩𝑩(𝒔𝒔) =π‘Ήπ‘ΉπŸπŸ

π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇

π‘½π‘½π’π’π’–π’–π’π’π‘½π‘½π’Šπ’Šπ’Šπ’Š

= 𝑨𝑨(𝒔𝒔)𝟏𝟏 + 𝑨𝑨 𝒔𝒔 𝑩𝑩(𝒔𝒔)

=𝑨𝑨𝒗𝒗 (π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇)

(π‘Ήπ‘ΉπŸπŸ + 𝑹𝑹𝒇𝒇 + π‘¨π‘¨π’—π’—π‘Ήπ‘ΉπŸπŸ )

Page 40: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Software Application

Page 41: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Implementation of PID

Kp term adds large settling time and steady-state error

Ki term adds large percentage overshoot

Kd term adds dampening term, can cause oscillation

Page 42: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Finding Coefficients

Set all coefficients to zero

Increase Kp until system oscillates

Increase Ki until steady state error corrected

Increase Kd until overshoot decreased

https://en.wikipedia.org/wiki/PID_controller

Page 43: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=
Page 44: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Extra Slides

Page 45: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Problem Statement

Page 46: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Jitter

Page 47: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Schmitt Trigger

Vupper = Voltage that needs to be crossed to register a digital lowVlower = Voltage that needs to be crossed to register a digital high

Page 48: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Operation π‘‰π‘‰π‘œπ‘œπ‘œπ‘œπ‘œπ‘œ = 5 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

π‘‰π‘‰π‘Žπ‘Ž =𝑅𝑅2

𝑅𝑅2 + (𝑅𝑅1||𝑅𝑅3)

π‘‰π‘‰π‘Žπ‘Ž = 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

π‘‰π‘‰π‘œπ‘œπ‘œπ‘œπ‘œπ‘œ = 0 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

π‘‰π‘‰π‘Žπ‘Ž =𝑅𝑅3||𝑅𝑅2

𝑅𝑅1 + (𝑅𝑅3||𝑅𝑅2)

π‘‰π‘‰π‘Žπ‘Ž = 𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉𝑉

Page 49: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Example of Operation

If resistors all set to 10 KilaOhms

π‘‰π‘‰π‘œπ‘œπ‘’π‘’π‘’π‘’π‘’π‘’π‘’π‘’ = 𝑅𝑅2𝑅𝑅2+(𝑅𝑅1||𝑅𝑅3)

= 3.3 V π‘‰π‘‰π‘™π‘™π‘œπ‘œπ‘™π‘™π‘’π‘’π‘’π‘’ = 𝑅𝑅3||𝑅𝑅2𝑅𝑅1+(𝑅𝑅3||𝑅𝑅2)

= 1.66 V

Page 50: Feedback Control - GitHub Pages...Non-inverting Op-amp. What’s the equation for Vout? Application of Theory . 𝑯𝑯𝒔𝒔=

Copyright Slide

Written and Presented by Adarsh Jayakumar

Acknowledgements to Professors Kirstin Petersen and Alyosha Molnar for their guidance