You are on page 1of 28

.

EE501 Term Project

Position Control of a DC Servo
System using a PID Controller
Submitted By:
Haider Ali MS-13-24359
Atif Jameel MS-13-23941
Dept of Electrical Engineering
Pakistan Institute of Engineering & Applied Sciences
Course Instructor: Dr. Ghulam Mustafa
Contents
1 Introduction 1
1.1 A Brief Overview of DC Servomotor . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 PID Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Mathematical Modeling 3
3 PID Controllers 6
3.1 Closed Loop System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 PID Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 Proportional Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 Integral Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Derivative Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4 Design, Simulation and Analysis 10
4.1 Parameter Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 MATLAB Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.2.1 Simulink Modeling and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2.2 Root Locus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2.3 PID Controller Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Hardware Implementation 18
5.1 Proportional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 Dierentiator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4 Proportional-Integral-Derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
6 Summary 21
1
List of Figures
1.1 Components of a Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 DC Motor Equivalent Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Open Loop Control of DC Servo Motor . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1 Unity Feedback Closed Loop System . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 Typical 2nd Order Motor Response and Transient Characteristics . . . . . . . . . . . 7
4.1 Parameter Estimation via Response Curve . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 Simulink Model of Closed Loop System . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Response Curve of Closed Loop System . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.4 Root locus of Uncontrolled DC Servo System . . . . . . . . . . . . . . . . . . . . . . 14
4.5 Simulink Model of PID Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.6 PID Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.7 Root Locus of Controlled System using PID . . . . . . . . . . . . . . . . . . . . . . . 16
4.8 Comparison of Transient Behaviors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1 Inverting Gain Op-Amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2 Op-Amp Integrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.3 Op-Amp Dierentiator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.4 PID Circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2
Abstract
In this report, position control of a DC Servo Motor using a Proportional-Integral-Derivative (PID)
controller is presented. The electrical and mathematical modeling of a typical DC Servo Motor is
discussed. After obtaining a generic system model, the system parameters are determined using the
systems closed loop response. The obtained system is then modeled, simulated and analysed using
the root locus technique via the aid of MATLAB and Simulink. The desired system specications
are then dened and MATLAB PID autotuner is used to nd the gain values of the PID controller
corresponding to those specications. Lastly, hardware implementation of a PID using operational
ampliers is discussed along with the method to nd the component values i.e. resistors and
capacitors.
Chapter 1
Introduction
Most of the industrial applications nowadays such as automation, robotics, production lines, CNC
machines and numerically controlled machinery require high dynamics on their position and speed
control and their starting and stopping functions need to be controlled quickly and accurately .
These systems incorporate DC servomotors as one of their vital components. DC servomotors
have a large market share in the Industry Automation and Drive Technologies. Because of their
importance, the design of the controllers for these servo systems has become an interesting area of
researchers all over the world.
The proportional-Integral-Derivative controllers (PID) have been extensively used over the past
few decades due to their eciency, robustness and simplicity. It is estimated that PID controllers
are still employed in 95% of the industrial processes  and are widely used in the elds of ser-
vomotor control, robotics, temperature control and power electronics. These PID controllers are
usually implemented either in hardware using analog components or in software using computer
based systems.
This report provides a systematic approach to designing an ecient PID controller for a DC servo-
motor. The content is organized as follows: Chapter 1 gives a brief overview of the DC servomotor
and the PID controller. Mathematical modeling of the servomotor is described in chapter 2. In
chapter 3, dierent parts of a PID controller are discussed. Simulink modeling and hardware im-
plementation are presented in chapter 4 and chapter 5 respectively. Chapter 6, the last section,
drafts the summary of the whole discussion.
1.1 A Brief Overview of DC Servomotor
A DC servomotor is an electromechanical device which allows for precise control of angular position
and motion using an input voltage. A DC servomotor is actually an assembly of three main
components 1.1: a simple DC motor, a feedback sensing device (potentiometer in case of position
control) and a control circuit. The motor is attached to the wheel using gears. A control signal
representing the desired output position of the servo shaft is applied to the servomotor. As the
motor rotates, the resistance of the potentiometer changes and the control circuit can precisely
regulate both the position of the shaft and the direction of its movement. As the motor shaft is at
the desired position, power supplied to the motor is stopped.
Servomotors are controlled using the technique of Pulse Width Modulation (PWM) in which
electrical pulses of variable widths are sent via control wires. The duration of the positive-going
pulse determines the position of the servo shaft. Generally, a pulse of 1.5ms denes the center
position of the motor. A greater pulse width turns the motor 900 in clockwise direction and a
1
Figure 1.1: Components of a Servo Motor
smaller pulse width turns it 900 in anti-clockwise direction. The servo expects to see a pulse every
20ms and the position pulse must be repeated to instruct the servo to remain in position .
Servo motors are used extensively in robotics industry and radio-controlled airplanes. These motors
are most commonly employed in closed loop control systems where the programmed position of
motion and velocity feedback controllers are required . Dierent studies and researches have
been conducted on the servo motor control. Currently, the conventional method of servo motor
control is based on proportional integral derivative.
1.2 PID Controller
Proportional-Integral-Derivative (PID) control is the most common control algorithm used in in-
dustry and has been universally accepted in industrial control. The popularity of PID controllers
can be attributed partly to their robust performance in a wide range of operating conditions and
partly to their functional simplicity, which allows engineers to operate them in a simple, straight-
forward manner.
As the name suggests, PID algorithm consists of three basic coecients; proportional, integral and
derivative which are varied to get optimal response. The basic idea behind a PID controller is
to read a sensor, then compute the desired actuator output by calculating proportional, integral,
and derivative responses and summing those three components to compute the output. Dierent
variants of a PID controller include PI, PD, P or I controller in the absence of the respective control
action. All the three constituents of PID are explained in detail in 3.
2
Chapter 2
Mathematical Modeling
In this chapter, we discuss the steps involved in driving the mathematical model of an open loop
system of a DC servomotor. The gure 2.1 shows a DC motor attached to an inertial load. The
voltages applied to the armature and eld sides of the motor are represented by V
f
and V
a
respec-
tively. Similarly, R
f
, L
f
, R
a
and L
a
indicate the resistances and inductances of eld and armature
sides of the motor. The motor can either be eld controlled or armature controlled. In a eld
controlled motor, the armature current i
a
is held constant and the eld current i
f
is controlled
through the eld voltage V
f
. On the other hand, the eld current i
f
is constant in an armature
controlled motor and the armature current i
a
is controlled via the armature voltage V
a
.
Figure 2.1: DC Motor Equivalent Circuit
The air gap ux of the motor is proportional to the eld current and can be written as:
= K
f
i
f
where K
f
is a constant. The torque T delivered by the motor, in turn, is proportional to the
3
product of armature current i
a
and air gap ux as:
T = K
a
i
a

T = K
a
i
a
K
f
i
f
and K
a
is also a constant. The DC servo system under examination is an armature control motor
for which armature current i
a
is variable, as mentioned earlier. The motor torque K is dened as
the product of K
a
, K
f
and i
f
, therefore:
T = (K
a
K
f
i
f
)i
a
T = Ki
a
The speed of an armature controlled DC motor is controlled by the armature voltage v
a
which is
supplied by a power supply. The dierential equation for the armature circuit as obtained from the
gure is:
v
a
= R
a
i
a
+L
a
di
a
dt
+v
b
where v
b
is the back emf voltage which is proportional to the angular velocity
d
dt
. Thus, with a
back emf constant K
b
, we have:
v
b
= K
b
d
dt
So, the armature circuit equation can be re-written as:
v
a
= R
a
i
a
+L
a
di
a
dt
+K
b
d
dt
(2.1)
The armature current produces the torque T which is applied to the inertia and friction following
the equation:
T = J
d
2

dt
2
+B
d
dt
Ki
a
= J
d
2

dt
2
+B
d
dt
(2.2)
To solve the dierential equations (2.1) and (2.2), we use the technique of Laplace Transform.
Assuming that all the initial conditions are zero, we obtain the following equations in Laplace
Transform:
V
a
(s) = (L
a
s +R
a
)I
a
(s) +K
b
s(s)
KI
a
(s) = (Js
2
+Bs)(s)
Now, considering (s) as the output and V
a
(s) as the output, the transfer function, after simplifying
can be written as:
(s)
V
a
(s)
=
K
s[L
a
Js
2
+ (L
a
B +R
a
J)s +R
a
B +KK
b
]
4
The armature inductanceL
a
is usually very small and can be easily neglected. Neglecting L
a
, the
transfer function can be reduced to:
(s)
V
a
(s)
=
K
s[R
a
Js +R
a
B +KK
b
]
(s)
V
a
(s)
=
K
m
s(T
m
s + 1)
(2.3)
where,
K
m
=
K
R
a
B +KK
b
= motor gain constant
T
m
=
R
a
J
R
a
B +KK
b
= motor time constant
We know that, angular velocity can be obtained by taking derivative of angular position, i.e.
w =
d
dt
or (s) = s(s)
The transfer function relating angular velocity and applied voltage can now be written as:
(s)
V
a
(s)
=
K
m
T
m
s + 1
(2.4)
Equations (2.3) and (2.4) represent the angular position and angular velocity related to the applied
armature voltage respectively. We will be concerned withe angular position control in this project,
so the transfer function under observation will be:
G(s) =
K
m
s(T
m
s + 1)
(2.5)
The equation (2.5) gives the open loop response of a DC servo motor as shown in gure 2.2 below:
Figure 2.2: Open Loop Control of DC Servo Motor
5
Chapter 3
PID Controllers
In this chapter, a brief overview of the Proportional-Integral-Derivative (PID) controller is pre-
sented. We will consider a closed loop system with unity feedback and discuss how each of the
three parameters of a PID controller aect the response of a closed loop system individually.
3.1 Closed Loop System
A closed loop control system, commonly referred to as a feedback control system, is the one in which
the output of the system is constantly fed back into the input of the control system. This feedback
conguration allows the system to constantly know the state of its output. This information helps
system to continuously correct the actual input to the system to reach the desired state. Typically,
a DC servomotor closed loop system with unity feedback is shown in gure 3.1.
Figure 3.1: Unity Feedback Closed Loop System
Here, G(s) represents the transfer function of the actual system i.e. DC servomotor, G
c
(s)
shows the Laplace Transform of the controller i.e. PID and e represents the error signal which is
the dierence between the output and the actual input of the system. V
a
and are the input and
output of the system respectively.
Now, some performance parameters of a general 2nd order closed loop system shown (3.1) by
equation are presented:
G(s) =

2
n
s
2
+ 2
n
+
2
n
(3.1)
The response of such a system, marked with the transient response specications that are dened
below, is shown in gure 3.2.
Rise time(t
r
): Time required for the response to go from 10% to 90% of the nal value.
6
Figure 3.2: Typical 2nd Order Motor Response and Transient Characteristics
Delay time(t
d
): Time required for the response to reach 50% of the nal value the very rst
time.
Peak time(t
p
): The time required for the response to reach the rst overshoot.
Maximum Overshoot(M
p
): The maximum peak value of the response curve measured from
Settling time (t
s
): The time required for the response curve to settle within a certain per-
centage of the nal value.
ss
): Dierence between the desired nal output and the actual response
when the system reaches a steady state.
These performance measures help quantify the desired system requirements which, typically, are:
faster response
minimal overshoot
lesser settling time and
3.2 PID Theory
The basic idea behind a PID controller is to read a sensor and then compute the error e between the
actual input V
a
and the sensor output. This error e is then fed to the PID controller which calculates
its proportional, integral and derivative responses and the output is produced by summing these
7
three responses. The output of a PID controller, equal to the control input to the system, in time
domain is as follows:
u(t) = K
p
e(t) +K
i

e(t) dt +K
d
de
dt
The transfer function of a PID controller is found by taking Laplace transform of the above equation:
G
c
(s) = K
p
+
K
i
s
+K
d
s
G
c
(s) =
K
d
s
2
+K
p
s +K
i
s
(3.2)
where K
p
, K
i
and K
d
are the controlling parameters of a PID controller dened as:
K
p
= Proportional gain constant
K
i
= Integral gain constant
K
d
= Derivative gain constant
We now discuss the contribution of each of the three parameters in improving the system response.
3.2.1 Proportional Response
The proportional component has the eect of reducing the rise time and steady state error of the
system and depends only on the dierence between the actual input and the sensor output which
is called error e. The proportional gain K
p
determines the ratio of the output response to the
error signal. In general, increasing the proportional gain K
p
increases the speed of the system but
the tendency towards oscillations also increases . However, if K
p
is increased too large, the sensor
output will begin to oscillate. If it is increased further, the oscillations will become larger and the
system may become unstable. The proportional term is given by:
P = K
p
e(t)
3.2.2 Integral Response
The integral component sums the error term e over time and gives the accumulated oset thus
eliminating the steady state error. The integral term accelerates the movement of the process
towards setpoint and eliminates the residual steady-state error that occurs with a pure proportional
controller. It, however, increases the settling time of the system along with the oscillations. The
integral term is given by:
I = K
i

e(t) dt
3.2.3 Derivative Response
The derivative response of the controller is proportional to the rate of change of the sensor out-
put. It is calculated by determining the slope of the error over time and multiplying this rate
by the derivative gain constant K
d
. Derivative action predicts system behavior and has the ef-
fect of increasing the stability of the system, reducing the overshoot, and improving the transient
response.Most practical control systems use very small derivative gain constant K
d
, because the
8
derivative response is highly sensitive to noise in the sensor output signal. The derivative term is
given by:
D = K
d
de
dt
9
Chapter 4
Design, Simulation and Analysis
In this chapter, we will rst nd the parameters of our actual DC servo system to nd its open
loop and closed loop unity feedback transfer functions. Then the system is modeled and analysed
using Simulink. Lastly, PID controller implementation using MATLAB is discussed.
4.1 Parameter Estimation
The transfer function of the system can be obtained if we know the values of all the system
parameters i.e. R
a
, B, J, K
b
and the like, which, in this case, are not known. So we use the
alternate method of estimating the parameters from the output plot. This plot is given in gure
4.1 which shows the response of the unity feedback DC servo system. The open loop transfer
function of our system as obtained in equation (2.5) is:
G(s) =
K
m
s(T
m
s + 1)
The unity feedback closed loop transfer function can thus obtained as:
T(s) =
G(s)
1 +G(s)
Putting the value of G(s) and simplifying:
T(s) =
K
m
T
m
s
2
+s +K
m
(4.1)
Rearranging the above equation, we can write that:
T(s) =
Km
Tm
s
2
+
s
Tm
+
Km
Tm
(4.2)
The equation (4.1) can easily be compared with the transfer function of a typical second order
system involving its parameters and
n
as given in equation (3.1). Comparing, we get:
K
m
=

n
2
(4.3)
T
m
=
1
2
n
(4.4)
10
Figure 4.1: Parameter Estimation via Response Curve
11
Now, looking at the response curve shown in gure 4.1, we can nd the peak overshoot by the
following relation:
M
p
=
(t) ()
()
M
p
=
4 3.2
3.2
= 0.25
Equating this value of peak overshoot M
p
with e
(/

1
2
)
:
0.25 = e
(/

1
2
)
Solving for :
= 0.4037 (4.5)
Now, to nd natural frequency
n
, we use peak time t
p
which is given by:
t
p
=

n
(1
2
)
From the response plot 4.1, t
p
= 0.58sec, therefore:
0.58 =

n
(1
2
)
Solving for
n
:

n
Putting the values of
n
and obtained in equations (4.6) and (4.7) in equations (4.3) and (4.4),
we get the following values of K
m
and T
m
:
K
m
= 7.332
T
m
= 0.2092
The open loop and closed loop transfer functions of the DC servo motor can be obtained by putting
the values of K
m
and T
m
in equation (2.5) and (4.2) respectively:
G(s) =
7.332
0.2092s
2
+s
(4.7)
T(s) =
35.04
s
2
+ 4.78s + 35.04
(4.8)
4.2 MATLAB Implementation
In this section, the DC servo system model as obtained previously is modeled, simulated and
analysed using MATLAB.
12
The closed loop system as modeled in Simulink is shown in gure 4.2 below:
Figure 4.2: Simulink Model of Closed Loop System
A step input of magnitude 3.2 is applied to the system and the response curve obtained is shown
in gure 4.3:
Figure 4.3: Response Curve of Closed Loop System
We can see that the response obtained from Simulink as shown in gure 4.3 is exactly the
response of the original system as shown in gure 4.1 with both having an overshoot of 0.25, peak
time of 0.58 sec and settling time of 1.67 sec.
Design Objectives
We have assumed our design objectives as:
Peak Overshoot less than 10%
Settling time less than 1 sec
13
4.2.2 Root Locus
In this section, the system model is analysed using the technique of root locus via the aid of
MATLAB sisostool. As mentioned earlier, we have assumed our objectives to reduce the percentage
overshoot less than 10% and settling time less than 1 sec. The and
n
corresponding to these
parameter objectives are obtained as 0.5912 and 6.7664 sec respectively. The root locus of the
original system and the desired values of and
n
are plotted in the gure 4.4 below:
5 4 3 2 1 0 1
6
4
2
0
2
4
6
0.591
0.591
6.77
6.77
Root Locus of Uncontrolled DC Servo System
Real Axis (seconds
1
)
I
m
a
g
i
n
a
r
y

A
x
i
s

(
s
e
c
o
n
d
s

1
)
Figure 4.4: Root locus of Uncontrolled DC Servo System
It is evident from the above gure that the points corresponding to the desired parameter values
do not fall on the root locus of the system. Therefore, the required specications cannot be achieved
4.2.3 PID Controller Design
After analysing the root locus of our DC servo system, we have deduced that there is a need to add
some poles and/or zeros to change the root locus thus allowing it to pass through our desired points.
Consequently, a PID controller is designed for this purpose. Specically, we need to determine the
parameters K
p
, K
i
and K
d
of our PID controller which are obtained using PID tuner block available
in MATLAB Simulink as shown in gure 4.5 below:
14
Figure 4.5: Simulink Model of PID Controller
The PID tuner allows you to set your desired system specications i.e. whether to make the
systems response time or transient behavior slower or faster thus changing the values of rise time,
settling time, peak time and peak overshoot which, in turn, change the values of K
p
, K
i
and K
d
.
The following gure shows the tuning window. Note that the gain values for 10% and t
s
1sec
are shown on the right side window:
Figure 4.6: PID Tuning
Therefore, our required gain values are:
K
p
= 1.2153 (4.9)
K
i
= 0.22636 (4.10)
K
d
= 0.15033 (4.11)
These gain values are now inserted in the transfer function of the PID controller as obtained in
equation (4.12) to obtain G
c
(s). The controller transfer function can thus be written as:
G
c
(s) =
0.15033s
2
+ 1.2153s + 0.22636
s
(4.12)
The updated system now has the conguration of gure 3.1 in which the controller transfer function
is multiplied by the system transfer function. This updated system is now implemented in MATLAB
and the root locus now looks like:
15
25 20 15 10 5 0 5
6
4
2
0
2
4
6
Root locus of Controlled System using PID
Real Axis (seconds
1
)
I
m
a
g
i
n
a
r
y

A
x
i
s

(
s
e
c
o
n
d
s

1
)
Figure 4.7: Root Locus of Controlled System using PID
The comparison between the transient responses of controlled and uncontrolled systems is shown
in the gure 4.8 below:
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
0
0.2
0.4
0.6
0.8
1
1.2
1.4

Transient behavior Comparison
Time (seconds)
A
m
p
l
i
t
u
d
e
Uncontrolled System
Controlled System
Figure 4.8: Comparison of Transient Behaviors
16
It is evident from the above gure that the transient response of the system has been improved
in terms of rise time, peak overshoot and settling time.
Now that we have obtained the values of gains corresponding to the desired specications, we
can now translate these gain values into an electronic circuit using operational ampliers, the
implementation of which is described in the next chapter.
17
Chapter 5
Hardware Implementation
In this chapter, the practical implementation of a PID circuit using analog electronic components
i.e. operational ampliers is discussed. Firstly, each of the three components with their transfer
functions are presented and then they are combined to form the PID controller.
5.1 Proportional
The proportional part of a PID controller is implemented using an inverting amplier as shown in
gure 5.1 below.
Figure 5.1: Inverting Gain Op-Amp
The transfer function is given by:
G(s) =
R
f
R
in
The proportional gain is given by the following relation of resistors:
K
p
=
R
f
R
in
Let R
in
= 10 k and K
p
is 1.2153 as obtained in equation (4.9), then:
R
f
= 1.2153 10 k
R
f
= 12.153 k
18
5.2 Integrator
The circuit to implement the integrator part is shown in gure 5.2 below:
Figure 5.2: Op-Amp Integrator
The transfer function in this case is given by:
G(s) =
1
sRC
In this case, the relation among K
i
, R and C is given by:
K
i
=
1
RC
Assuming, C = 100 F and K
i
= 0.22636 (4.11), then:
R =
1
100 10
6
0.22636
R = 44.177 k
5.3 Dierentiator
The gure 5.3 shows the circuit to implement the derivative part of the PID:
Figure 5.3: Op-Amp Dierentiator
The transfer function of a dierentiator is given by:
G(s) = sRC
19
In the case of a dierentiator:
K
d
= RC
Again, assume that C = 100 F and K
i
= 0.15033 (4.10), then:
R =
0.15033
100 10
6
R = 1.503 k
5.4 Proportional-Integral-Derivative
The complete circuit of a PID controller can now be implemented by combining the above three
parts using an Op-Amp summer. The output of the summer is inverted, therefore, an inverter is
used at the summer output to change the controller output phase. The complete circuit is shown
in gure 5.4 below:
Figure 5.4: PID Circuit
20
Chapter 6
Summary
This report presents a formal approach to designing a PID controller of a DC Servo System. A
complete design process of the DC Servo System, following all steps, is discussed. The problem
addressed is: Given a model of a DC Servo System, design a PID controller to meet the desired
performance specications. First of all, the given system is identied by determining its variables
and specications. Then, the systems electrical and mathematical modeling is carried out to nd
its transfer function and establish its conguration. After system denition and modeling, the gain
values of the PID controller are obtained using MATLAB Simulink. Lastly, these parameters are
then tuned to get the desired response.
The dierence between the results of hardware implementation and the MATLAB simulation can
be attributed to the approximations made in the modeling of the system. This is because we have
estimated our original 3rd order system with a 2nd order system by ignoring motors armature
inductance L
a
. Another consideration in this regard is the change in the values of the electronic
components i.e. resistors and capacitors with the environmental changes.
The eciency of the designed controller can be improved by taking the original 3rd order system
other improvement can be obtained by implementing the PID controller using a microcontroller
instead of analog electronic components because microcontrollers, unlike analog components, are
less susceptible to environmental changes.
21
Appendix
MATLAB Code
%************************************************************************%
%FILE NAME: PROJECT_CSD.m
%Objective : Design and Modeling of PID controller for DC Servo System
%
%**************************************************************************
clc
clear all
%**************************************************************************
% DC Servo System in unity feedback without any Controller
% tp=0.58sec, PO=25% for step input
%**************************************************************************
Mp=0.25;
tp=0.58;
a=(-(log(Mp))/pi)^2; % Mp=exp(-zeta*pi/sqrt(1-zeta^2))
system_zeta=sqrt(a/(1+a));
system_wn=pi/(tp*sqrt(1-(system_zeta)^2)); % tp=pi/wd;
required_zeta=0.5912;
required_wn=6.7664;
%**************************************************************************
% our open loop transfer function is G(s)=km/(Tms^2+s)
% by parameter estimation Tm=0.2092; and Km=7.331;
%**************************************************************************
num=[7.332];
denum=[0.2092 1 0];
G_s=tf(num,denum);
figure(1)
rlocus(G_s)
sgrid(required_zeta,required_wn)
axis([-5 1 -7 7])
title(Root Locus of Uncontrolled DC Servo System)
% Step response of G(s) in unity feedback
figure(2)
step(G_s/(1+G_s))
title(step response of Uncontrolled Dc servo System)
% Desired PO=5% , Tseetling=1sec;
Mp=0.05;
22
ts=0.5;
b=(-(log(Mp))/pi)^2; % Mp=exp(-zeta*pi/sqrt(1-zeta^2))
desired_zeta=sqrt(b/(1+b));
desired_wn=4/((desired_zeta)*ts); % ts=4/sigma;
%**************************************************************************
% thsi can be achievd using PID controller==========================
% by using Nichols Ziegler criteria we found the values of Kp, Ki, and Kd
%**************************************************************************
kp=1.2153;
ki=0.22636;
kd=0.15033;
% transfer function of Controller=========================
num1=[kd kp ki];
denum1=[1 0];
Gc_s=tf(num1,denum1);
cmbind_tf=(G_s)*(Gc_s); % Combined transfer function of plant and PID controller
figure(3)
rlocus(cmbind_tf);
title(Root locus of Controlled System using PID)
closd_tf=cmbind_tf/(1+cmbind_tf);
figure(4)
step(closd_tf);
title(Step response of Controlled System using PID)
23
Bibliography
 K.J. Astrom and T. H. Hagglund. New tuning methods for pid controllers. In Proc. of 3rd
European Conference, pages pp. 24562462, 1995.
 B. Kocherov M. Baron. Vision guided motor control for semi-autonomous military vehicle.
Technical report, Institute Technology of Steven, 2007.
 K. Seki, H. Yokoi, and M. Iwasaki. Experimental evaluations of friction behavior in micro-
displacement region positioning for servo motor with air bearings. In Advanced Intelligent
Mechatronics (AIM), 2012 IEEE/ASME International Conference on, pages 731736, July
2012.
 Rong-Jong Wai and R. Muthusamy. Fuzzy-neural-network inherited sliding-mode control for
robot manipulator including actuator dynamics. Neural Networks and Learning Systems, IEEE
Transactions on, 24(2):274287, 2013.
24