Professional Documents
Culture Documents
PID Motor Control PDF
PID Motor Control PDF
PID Motor Control PDF
1 2 3 4
74HC14A
D1
DIODE
1
U1C MG1
5 6 1 2
2
74HC14A
D2 R2 MOTOR DC
DIODE POT U1D
9 8
3
C1 74HC14A
CAP NP
U1E
11 10
74HC14A
U1F
13 12
74HC14A
H-Bridge motor driver circuit
CIRCUIT INPUTS
A B C Output
0 0 0 N Channel Brake V+
1 1 0 P Channel Brake
1 0 0 Forward
R1 R2
0 1 0 Reverse 4.7K 4.7K
S S
X X 1 Motor Off Q1 Q2
G IRF9510 IRF9510 G
D D
M1
+5 DC Motor +5
D D
Q3 Q4 U1B
14 G IRF510 IRF510 G 14 74HC08
R3 S S R4
1 4.7K 4.7K 4
Input A Input B
3 Q5 Q6 6
2 2N2222 2N2222 5
U1A
7 74HC08 7
V+
+5
R5 +5
D U1C
U1C Q7 4.7K 74HC08
14
74HC08 IRF510 G 14
9 S R6
8 4.7K 9
PWM Input
10 Q8 8
2N2222 10
7
7
Optical encoder circuit
U27E
74HC14
11 10
U27F
74HC14
13 12
R11 C14
10K
0.001uF
U27A
R6 4.7K 74HC14 U6A 9
1 2 1 8
L. Motor
Tach Input A 3 10
U27B 2
R7 4.7K 74HC14 U6C
3 4 74HC86 74HC86
Tach Input B
R10 C15
D3 D4
5V 5V 10K
0.001uF
U27C
R8 4.7K 74HC14 U6B 13
5 6 4 11
R. Motor
Tach Input A 6 12
U27D 5
R9 4.7K 74HC14 U6D
9 8 74HC86 74HC86
Tach Input B
D5 D6
5V 5V
Motor control diagram
H-BRIDGE DC
PROCESSOR
CIRCUIT MOTOR
ENCODER
Control systems
What is a control system?
What are some examples?
What are the types of control systems?
How are control systems represented?
Open loop control systems
The output of the plant does not affect
the input. (No feedback)
Less common today than closed loop
control systems.
Examples include:
Stereo volume control
Electric drill speed control
Open loop control system
Examples include:
Air conditioning thermostat
Automobile cruise control
Closed loop control system
FEEDBACK
H-BRIDGE DC
PROCESSOR
CIRCUIT MOTOR
ENCODER
PID Closed loop control system
PID controls the gain portion of the
closed loop control system.
PID algorithms adjust the gain to the
plant based on several characteristics of
the feedback, not just the current
value.
PID control system diagram
P GAIN
D GAIN
FEEDBACK
Error term
P – Proportional gain
I – Integral gain
D – Derivative gain
Error term
The error term is derived by subtracting the feedback
(motor speed) from the set point (set speed).
This is the error in terms of a number of encoder
counts per unit time.
P GAIN
D GAIN
FEEDBACK
Proportional term
Simple proportional coefficient Kp is multiplied by
the error term.
Provides linear response to the error term.
P GAIN
D GAIN
FEEDBACK
Integral term
Integral coefficient Ki is multiplied by the error term
and added to the sum of all previous integral terms.
Provides response to accumulated error.
P GAIN
D GAIN
FEEDBACK
Derivative term
Derivative coefficient Kd is multiplied by the difference
between the previous error and the current error.
Responds to change in error from one PID cycle to the next.
P GAIN
D GAIN
FEEDBACK
PID calculation example
Integral windup
PWM term overflow
PID variable overflow
Integral windup prevention
20
18
16
14
D=0
MOTOR SPEED
12 D=1
10 D=2
8 D=3
6 D=4
4 D=5
2
0
-2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
35
30
25 D=0
MOTOR SPEED
D=1
20
D=2
15 D=3
D=4
10 D=5
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
PID Tuning chart 3
PID TESTING - P=2, I=0.001, D= 1 TO 5
40
35
30
D=0
MOTOR SPEED
25 D=1
D=2
20
D=3
15 D=4
D=5
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
PID Tuning chart 4
PID TESTING - P=3, I=0.001, D= 1 TO 5
40
35
30
D=0
MOTOR SPEED
25 D=1
D=2
20
D=3
15 D=4
D=5
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
PID Tuning chart 5
PID TESTING - P=4, I=0.001, D= 1 TO 5
45
40
35
D=0
MOTOR SPEED
30
D=1
25 D=2
20 D=3
D=4
15
D=5
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
PID Tuning chart 6
PID TESTING - P=5, I=0.001, D= 1 TO 5
40
35
30
D=0
MOTOR SPEED
25 D=1
D=2
20
D=3
15 D=4
D=5
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
The optimum PID coefficients!
Optimum PID Coefficients - P=4, I=0.001, D= 4
35
30
25
MOTOR SPEED
20
D=4
I
15
10
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
0.1 SECOND INCREMENTS
The completed control system
P GAIN
=4
D GAIN
=4
FEEDBACK
PID References
Carnegie Mellon University
http://www.engin.umich.edu/group/ctm/PID/PID.html
“PID Without a PHD” by Tim Wescott
http://www.embedded.com/2000/0010/0010feat3.htm
This concludes the presentation