You are on page 1of 8

PC-based PID Speed Control in DC Motor

Guoshing Huang, Shuocheng Lee


Department of Electronic Engineering, National Chin-Yi University of Technology,
35, Lane 215, Chung-Shan Rd., Sec. 1, Taiping, Taichung, Taiwan, 41111, ROC
E-mail:hgs@ncut.edu.tw

Abstract shorten, but also the designing space is more elastic


extension. This paper presents to guide the motor
This paper presents a LabVIEW-aided PID speed control field with the various advanced computer
designed controller to monitor DC motor speed and technology and the development platform of
uses the software simulation of VisSim to analysis its software/hardware. Let the dynamic state response of
response. First, design the drive circuit of DC motor motor have a better efficiency.
and as the feedback signal through the photo sensor
This paper is to design PID controller to supervise
and 8051 chip modules to produce rotational speed
and control the speed response of the DC motor with
signal, and show from SEG7 displays. To take out the
the virtual instrument graphic monitor software
analog signal through D/A converter at the same time,
LabVIEW. To control the speed of motor and display
acquire the signal via the NI DAQ USB-6008 card. By
the changes of rotational speed of motor, the better
the LabVIEW-aided PID controller, the parameters
response of the system can be obtained. By the NI
are adjusted to control the motor speed. The front
USB-6008 [2] data acquisition (DAQ) card scratches
panel will display the speed of DC motor on the
the data of D/A converter to transmit the signal in real
screen. The simulation results are quite match with the
time to PC to be the speed response of DC motor real-
theoretical prediction for the behavior of the PID
time supervision. Because the DAQ card has the
controller. In this proposed paper, it demonstrates the
capability of the data storage and calculating, analysis
humanized operation interface that not only can
and A/D, D/A conversion …etc., matches with the
replace the traditional instrument, but also facilitate
LabVIEW virtual instrument characteristic applying to
the amateur engineer's operation under the remote
detect the revolution of DC motor. This mode can
control and monitor.
substitute the traditional instruments, for instance,
oscilloscope, signal generator, power supply … etc.
1. Introduction and the test operation is convenient. It is not easy to be
influenced by the component ageing and the maintain
The DC motors have been popular in the industry management…etc., and can be as the supervision basis
control area for a long time, because they have many of the machine normal operation or not.
good characteristics, for example: high start torque
characteristic, high response performance, easier to be However, National Instruments increases the
linear control…etc.[1]. The different control approach productivity of engineers and scientists in developing
depends on the different performance of motors. test, control, and design systems by providing software
Because the peripheral control devices are enough, products for a wide range of functionality. NI
there is the more extensive application in the industry LabVIEW is the graphical development environment
control system. Therefore, the DC motor control is for creating flexible and scalable test, measurement,
riper than other kinds of motors no matter in the and control applications rapidly and at minimal cost.
theoretic study or in the research and development of Using LabVIEW, the interface between engineers and
the application technology and internet, the scientists with real-world signals, analyze data for
measurement and the control system can be achieved meaningful information, and share results and
by PC-based today. However, the technique of applications. The intuitive block diagrams in NI
instrument design also moves forward the times of LabVIEW make it be easy to develop the custom
“virtual instrument”, not only the designing time is design applications while taking advantage of the PC

978-1-4244-1724-7/08/$25.00 ©2008 IEEE 400 ICALIP2008


for processing, display, and device connectivity LabVIEW environment in order to reduce the output
[3][4][5][6]. error, as shown in Figure 2.
The structure of this paper is mainly divided into
the DC motor speed control system, the mathematic
model of DC motor and its control theory, the software
and hardware program, the computer software
simulation results, actual measurement results and
conclusions.

2. DC motor speed control system of the


structure
Fig. 2 PID speed control system of DC motor
functional block diagram.
2.1 System structure

The speed control system of the DC motor is shown 3. DC motor mathematics model and the
in Figure1. The main purpose is to link PC via USB control theory
transmission line and data acquisition module (NI
DAQ USB-6008), then control the motor system to 3.1 DC motor mathematic model
achieve the speed control of motor and analyze the
response of the motor by software. This DC motor system is a separately excited DC
motor, which is often used to the velocity tuning and
the position adjustment. This paper focuses on the
study of DC motor linear speed control, therefore, the
separately excited DC motor is adopted. Make use of
the armature voltage control method to control the DC
motor velocity, the armature voltage controls the
distinguishing feature of method as the flux fixed, is
also a field current fixedly. The control equivalent
circuit of the DC motor by the armature voltage control
method is shown in Figure 3.

Fig. 1 The structure of speed control system


of DC motor.

2.2 System functional block diagram system Fig. 3 The control equivalent circuit of the DC
structure motor using the armature voltage control
method
This system is to generate a pulse signal through the
disc of the rotary shaft and the photo interrupt module where
in DC motor. And compute the numbers of pulses
received in unit time with 8051[7], then calculate the R a : the armature resistance
speed of motor. We display the motor currently speed
using four SEG7 display, compare the output feedback L a : the armature inductance
signal with the input signal through D/A converter[8],
then execute the parameter adjustment of the PID i a : the armature current
controller through the designed program under the
if
: the field current

401
ea From equation (7) the armature inductance is very
: the input voltage
small in practices, hence, the transfer function of DC
eb motor speed to the input voltage can be simplified as
: the back electromotive force (EMF) follows,
Tm: the motor torque Ω (s ) K
= m (8)
ω E a (s) τs + 1
: an angular velocity of rotor
Where K = KT is a motor gain,
J : rotating inertial measurement of motor bearing m
R a B + KbKT
B : a damping coefficient R aJ is the motor time constant
τ=
R aB + K bK T
Because the back EMF e b is proportional to speed ω From equation (8), the transfer function can be drawn
directly, then the DC motor system block diagram which is shown in
Figure 5.
dθ(t) (1)
e b (t) = K b = K bω (t)
dt
Making use of the KCL voltage law can get
di a (t) (2)
e a (t) = R a i a (t) + L a + e b (t)
dt
Fig. 5 Simplified block diagram of DC motor
From Newton law, the motor torque can obtain armature voltage control system
2
T m (t) = J
d θ(t)
+ B

= K T ia (t) (3) 3.2 PID control theory
2 dt
dt

Take (1), (2), and (3) into Laplace transform, The development of PID control theories has already
respectively, the equations can be formulated as 60 years so far, PID control has been one of the control
follows: system design method of the longest history. However,
E a (s ) = ( R a + L a s ) I a (s ) + E b (s ) (4) this method is still extensively used now
[9][10][11][12]. The PID controller includes a
proportional term, integral term and derivative term,
E b (s ) = K b Ω (s ) (5)
where the proportional term is to adjust the output of
controller according to all of the magnitude of error,
Tm (s) = BΩ(s) + JsΩ(s) = K T I a (s) (6) the integral term is used to remove the steady state
error of control system and improve the steady state
Fig. 4 describes the DC motor armature control system
response, the derivative term is used to predict a trend
function block diagram from equations (1) to (6).
of error and improve the transient response of the
system. These functions have been enough to the most
control processes. Because the structure of PID
controller is simple, it is the most extensive control
method to be used in industry so far. The PID
controller is mainly to adjust an appropriate
proportional gain (KP), integral gain (KI), and
differential gain (KD) to achieve the optimal control
Fig. 4 DC motor armature voltage control
performance. The PID controller system block diagram
system function block diagram
of this paper is shown in Figure 6.
The transfer function of DC motor speed with
respect to the input voltage can be written as follows,
Ω (s ) KT
G (s) = =
E a (s) ( L a s + R a )( Js + B) + K b K T
(7)

402
transient response of system become slow down. It
cannot improve a steady state error of system, has not a
bigger function for the system. But this phenomenon is
only to limit in the first order control system. The
integral controller can remove a steady state error
while the step inputs, but it will be unstable if the
integral gain is excessive.

4. Hardware and software program


Fig. 6 PID controller system block diagram 4.1 Structure of the hardware circuit
The relationship between the input e(t) and output The hardware structure program in this paper is
u(t) can be formulated in the following, shown in Figure 8. Using the analog output port and
t de ( t ) the analog input port (AO/AI) of the DAQ Card, send
u ( t ) = K P ⋅ e ( t ) + K I ⋅ ∫ e ( t ) dt + K D (9) out signal to the error detector in order to control the
0 dt speed of motor. At the same time, scratch Vo of D/A
converter of the hardware circuit indicator on front
The transfer function is expressed as follows, panel, can control the DC motor rotational speed, and
analyze the systems response, as shown in Fig. 9.
U (s ) KI (10)
C (s ) = = K P + + K D s
E (s ) s

The controlled plant in this paper is a DC motor. The


PID DC motor speed control system block diagram is
shown in Figure 7.

Fig. 7 PID DC motor speed control system


block diagram

The closed loop transfer function of DC motor


speed control system expresses as follows,
KI K
(K P + + K D S) m
Ω (s ) S 1 + τs
G (s) = =
R (s) KI K
1 + (K P + + K D S) m
S 1 + τs
Fig. 8 The structure of DC motor speed control
2
(KDS + KPS+ KI )Km hardware system
= (11)
(KDKm + τ)S2 + (1+ KP Km )S+ KI Km
The system pattern is type1 in this case, the steady
state error ess= 0 which is with respect to the step
signal input. The differential controller raises a KD
value while the step signal inputs, then will let the

403
Fig. 9 PC-based speed monitor system Fig. 11 Front panel of PC-based PID DC motor
speed control system.
4.2 Monitor system design

The Design of this monitor system is used of PC and


DAQ card as the speed measurement and control unit
of the motor. Utilizing the LabVIEW software to
design the PID controller, applies on the DC motor
speed control. All the monitor point status and the
setting of monitor condition all can be executed and
displayed on the screen menu in real time. Figure 10
shows the structure diagram of DC motor speed control
monitor system. The interface between man and
machine of PC-Based PID DC motor speed control
system of this paper is shown in Figure 11, and the
program block diagram is shown in Figure 12.

Fig. 12 Program block diagram of PC-based


PID DC motor speed control system

5. Simulation result of the software


In the following, apply the real gain of PID control
parameters KP, KI, KD to VisSim build-in vision
software (Ker, D. S., 2004), simulate the PID control
of DC motor speed control system according to the
hardware connected wire and the system function
block diagram to draw the PID DC motor speed
control system and verify with the actual system
Fig. 10 The structure diagram of DC motor response. The simulation results of the response of
speed control monitor system PID speed control in DC motor are shown in Figure
13(a)-(e).

404
Fig.13 (e) The simulation response PID speed control
in DC motor for R=1, KP =5, KI=5, KD=0.01

Fig.13 (a) The simulation response PID speed From above simulation response results shown as
control in DC motor for R=1, KP =3, KI=2, KD=0.01 Figure 13.(a)-(e), we know when the system is joined
the integral control, it can be accelerated the steady
state response time. To make use of simulation results,
can be verified as a result of basis with the actual
measurement.

6. Actual measurement results


This paper makes use of the PC-Based to be a
control the interface with the LabVIEW software
design program. With the PID controller, modulate the
Fig.13 (b) The simulation response PID speed control parameters. By adjusting the gains of the KP, KI, KD,
in DC motor for R=1, KP =3, KI=3, KD=0.1 acquire the best response of the satisfied system.
Through the actual adjusting KP, KI, KD gains, the
responses of this system can be obtain under the
different condition. After we take the actual control
parameters into VisSim to simulate, the results with
actual response and theories are rather near.
The following is the experimental comparison
explanation which is with respect to PID to physically
adjust gains KP, KI and KD...etc. to voltage feedback
response diagram. The unit of the transversal axis is
the time (second) and unit of the ordinate axis is a
voltage feedback response (V) as shown in Fig. 14. In
Fig.13 (c) The simulation response PID speed control these experimental results, the input command R is
in DC motor for R=1, KP =5, KI=2, KD=0.01 default to 1, in other words, the system response is
steady in 1V. Figure 14(a)-(e) show the system
responses of DC motor speed control by PID control
approach.

Fig.13 (d) The simulation response PID speed control Fig.14 (a) The response of the DC motor speed
in DC motor for R=1, KP =5, KI=4, KD=0.01 control for R=1, KP =3, KI=2, KD=0.01

405
the transient response become slower, but cannot
improve a steady state error. Raising the KI can remove
a margin of the steady state error. Through the
experimental results, we can know that the system will
produce an unstable phenomenon when KP is greater
than 7, KI is greater than 8. Therefore, the best control
parameters of this system are chosen as R=1, KP =5,
KI=5, KD=0.01.
Fig.14 (b) The response of the DC motor speed
control for R=1, KP =3, KI=3, KD=0.1
7. Conclusions
This paper proposes to design PID controller to
control the speed of DC motor using the LabVIEW
software program, and display the speed of motor in
real-time in order to obtain the system response of PID
controller. Then assist this system to simulate with the
software of VisSim. Because the DAQ card has the
capabilities of data scratch and transmission, matches
with the LabVIEW virtual instrument characteristic
and analysis. The real-time monitor of application on
the motor not only can substitute the traditional
Fig.14 (c) The response of the DC motor speed control instrument but also can be as the monitor basis of the
for R=1, KP =5, KI=2, KD=0.01 machine operating normally or not. This programming
system is based on a structure of the PC, and combines
the DC motor supervision needed instrument, and then
replaces other hardware equipments with the cheaper
and more efficient method to provide operators with
the graphical interface of an easy and kind operation.
Through the actual tuning KP, KI, KD gains, the
responses of this system can be obtained under the
different condition. After the actual control parameters
transfer into VisSim for simulation, to compare the
results of actual response with its theory is rather near.
The development system can be set up a
fundamental to supervise and control the outdoor
Fig.14 (d) The response of the DC motor speed factory from the indoor office. We can supervise and
control for R=1, KP =5, KI=4, KD=0.01 control all motors in the factory or instrument
equipment indoors, and also monitor the factory
operational condition from the outside. In other words,
this system can monitor the motor currently, and also
can join all equipments which are desired to supervise
and control to perform a whole supervision system in
early future.

8. References
[1] Wang, J. B., Control of Electric Machinery. Gau Lih
Book co., Ltd, Taipei Taiwan, 2001.
Fig.14 (e) The response of the DC motor speed
control for R=1, KP =5, KI=5, KD=0.01
[2] DAQ USB-6008 User Manual., National Instruments,
1999
To compare with Figure 14 (a) to (e), can be
relatively obtain, if raise KP then can get a quicker [3] Shiau, T. J., J. L. Wang and S. W. Chu., Program
transient response, and can reduce a steady state error Design of Virtual Instrument Control LabVIEW 7X.
of the system in PID controller. To raise KD, will make Gau Lih Book co., Ltd, Taipei Taiwan, 2004

406
Microcomputer. Knowledge and Execution Co., Ltd.
[4] Liau, J. C., A Study of LabVIEW Aided in DC Motor Taichung, Taiwan, 2002.
Speed Monitoring System. National Taiwan Ocean
University Department of Mechanical & Mechatronic [9] Yang, K. C., Remote Fuzzy Control in DC Motor
Engineering, 2000. Speed Monitoring System. National Taiwan Ocean
University Department of Mechanical & Mechatronic
[5] LabVIEW Basics I Course Manual., National Engineering, 2001.
Instruments, 1999.
[10] Huang, J. M., University Automatic Control,
[6] Srinivasan, M. B., A. Shirkhodaie, and M. Malkani, University City Books Enterprise Inc, Kaohsiung
LabVIEW program design for on-linedataacquision Taiwan, 2004.
and dpredictive maintenance. Proceedings of the
Thirtieth IEEE Souteastern Symposinm on System [11] Baek, S. M. and T. Y. Kuc., “An adaptive PID learning
Theory, 1998, pp.520-524. control of DC motor”, IEEE International, Volume.3,
1997, pp.2877-2882.
[7] Li, K. Y., S. S. Huang and R. C. Chen, 8051/52
Application of Microcontroller. Skinfo Book co., Ltd, [12] Ker, D. S., Automatic Control Simulation Analysis.
Taipei Taiwan, 1998. Gau Lih Book co., Ltd, Taipei, Taiwan, 2004.

[8] Deng, M. F., Application of ISP Single Chip

407

You might also like