Você está na página 1de 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
This paper presents a LabVIEW-aided PID designed controller to monitor DC motor speed and uses the software simulation of VisSim to analysis its response. First, design the drive circuit of DC motor and as the feedback signal through the photo sensor and 8051 chip modules to produce rotational speed signal, and show from SEG7 displays. To take out the analog signal through D/A converter at the same time, acquire the signal via the NI DAQ USB-6008 card. By the LabVIEW-aided PID controller, the parameters are adjusted to control the motor speed. The front panel will display the speed of DC motor on the screen. The simulation results are quite match with the theoretical prediction for the behavior of the PID controller. In this proposed paper, it demonstrates the humanized operation interface that not only can replace the traditional instrument, but also facilitate the amateur engineer's operation under the remote control and monitor. shorten, but also the designing space is more elastic extension. This paper presents to guide the motor speed control field with the various advanced computer technology and the development platform of software/hardware. Let the dynamic state response of motor have a better efficiency. This paper is to design PID controller to supervise and control the speed response of the DC motor with the virtual instrument graphic monitor software LabVIEW. To control the speed of motor and display the changes of rotational speed of motor, the better response of the system can be obtained. By the NI USB-6008 [2] data acquisition (DAQ) card scratches the data of D/A converter to transmit the signal in real time to PC to be the speed response of DC motor realtime supervision. Because the DAQ card has the capability of the data storage and calculating, analysis and A/D, D/A conversion etc., matches with the LabVIEW virtual instrument characteristic applying to detect the revolution of DC motor. This mode can substitute the traditional instruments, for instance, oscilloscope, signal generator, power supply etc. and the test operation is convenient. It is not easy to be influenced by the component ageing and the maintain managementetc., and can be as the supervision basis of the machine normal operation or not. However, National Instruments increases the productivity of engineers and scientists in developing test, control, and design systems by providing software products for a wide range of functionality. NI LabVIEW is the graphical development environment for creating flexible and scalable test, measurement, and control applications rapidly and at minimal cost. Using LabVIEW, the interface between engineers and scientists with real-world signals, analyze data for meaningful information, and share results and applications. The intuitive block diagrams in NI LabVIEW make it be easy to develop the custom design applications while taking advantage of the PC

1. Introduction
The DC motors have been popular in the industry control area for a long time, because they have many good characteristics, for example: high start torque characteristic, high response performance, easier to be linear controletc.[1]. The different control approach depends on the different performance of motors. Because the peripheral control devices are enough, there is the more extensive application in the industry control system. Therefore, the DC motor control is riper than other kinds of motors no matter in the theoretic study or in the research and development of the application technology and internet, the measurement and the control system can be achieved by PC-based today. However, the technique of instrument design also moves forward the times of virtual instrument, not only the designing time is

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

400

ICALIP2008

for processing, display, and device connectivity [3][4][5][6]. 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.

LabVIEW environment in order to reduce the output error, as shown in Figure 2.

2. DC motor speed control system of the structure


2.1 System structure
The speed control system of the DC motor is shown in Figure1. The main purpose is to link PC via USB transmission line and data acquisition module (NI DAQ USB-6008), then control the motor system to achieve the speed control of motor and analyze the response of the motor by software.

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

3. DC motor mathematics model and the control theory


3.1 DC motor mathematic model
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 structure


This system is to generate a pulse signal through the disc of the rotary shaft and the photo interrupt module in DC motor. And compute the numbers of pulses received in unit time with 8051[7], then calculate the speed of motor. We display the motor currently speed using four SEG7 display, compare the output feedback signal with the input signal through D/A converter[8], then execute the parameter adjustment of the PID controller through the designed program under the

Fig. 3 The control equivalent circuit of the DC motor using the armature voltage control method where

R a : the armature resistance L a : the armature inductance i a : the armature current if : the field current

401

ea

: the input voltage : the back electromotive force (EMF)

eb

From equation (7) the armature inductance is very small in practices, hence, the transfer function of DC motor speed to the input voltage can be simplified as follows,

Tm: the motor torque

: an angular velocity of rotor


Where K = m

K (s ) = m E a (s) s + 1
KT is a motor gain, R a B + KbKT

(8)

J : rotating inertial measurement of motor bearing

B : a damping coefficient
Because the back EMF e b is proportional to speed directly, then
e b (t) = K
b

d(t) = K b (t) dt

(1)

R aJ is the motor time constant R aB + K bK T From equation (8), the transfer function can be drawn the DC motor system block diagram which is shown in Figure 5. =

Making use of the KCL voltage law can get


e a (t) = R a i a (t) + L a di a (t) + e b (t) dt

(2)
Fig. 5 Simplified block diagram of DC motor armature voltage control system

From Newton law, the motor torque can obtain


T
m

(t) = J

(t)
2

dt

+ B

d = K dt

ia (t)

(3)

3.2 PID control theory


The development of PID control theories has already 60 years so far, PID control has been one of the control system design method of the longest history. However, this method is still extensively used now [9][10][11][12]. The PID controller includes a proportional term, integral term and derivative term, where the proportional term is to adjust the output of controller according to all of the magnitude of error, the integral term is used to remove the steady state error of control system and improve the steady state response, the derivative term is used to predict a trend 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 performance. The PID controller system block diagram of this paper is shown in Figure 6.

Take (1), (2), and (3) into Laplace transform, respectively, the equations can be formulated as follows: (4) E a (s ) = ( R a + L a s ) I a (s ) + E b (s )

E b (s ) = K b (s )
Tm (s) = B(s) + Js(s) = K T I a (s)

(5) (6)

Fig. 4 describes the DC motor armature control system function block diagram from equations (1) to (6).

Fig. 4 DC motor armature voltage control system function block diagram

The transfer function of DC motor speed with respect to the input voltage can be written as follows, KT (s ) 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 hardware structure program in this paper is shown in Figure 8. Using the analog output port and the analog input port (AO/AI) of the DAQ Card, send out signal to the error detector in order to control the speed of motor. At the same time, scratch Vo of D/A converter of the hardware circuit indicator on front panel, can control the DC motor rotational speed, and analyze the systems response, as shown in Fig. 9.

The relationship between the input e(t) and output u(t) can be formulated in the following,

u ( t ) = K P e ( t ) + K I e ( t ) dt + K D
0

de ( t ) dt

(9)

The transfer function is expressed as follows,


C (s ) = U (s ) = K E (s ) + KI + K s s

(10)

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,

(s ) G (s) = = R (s)
2

KI K + K D S) m 1 + s S KI K 1 + (K P + + K D S) m S 1 + s (K P +
(11)

(KDS + KPS+ KI )Km (KDKm + )S2 + (1+ KP Km )S+ KI Km

Fig. 8 The structure of DC motor speed control hardware system

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 response. The simulation results of the response of PID speed control in DC motor are shown in Figure 13(a)-(e).

Fig. 10 The structure diagram of DC motor speed control monitor system

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 control in DC motor for R=1, KP =3, KI=2, KD=0.01

From above simulation response results shown as 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 parameters. By adjusting the gains of the KP, KI, KD, 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 these experimental results, the input command R is 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 (b) The simulation response PID speed control


in DC motor for R=1, KP =3, KI=3, KD=0.1

Fig.13 (c) The simulation response PID speed control


in DC motor for R=1, KP =5, KI=2, KD=0.01

Fig.13 (d) The simulation response PID speed control


in DC motor for R=1, KP =5, KI=4, KD=0.01

Fig.14 (a) The response of the DC motor speed


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 instrument but also can be as the monitor basis of the 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 factory from the indoor office. We can supervise and 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.

Fig.14 (c) The response of the DC motor speed control


for R=1, KP =5, KI=2, KD=0.01

Fig.14 (d) The response of the DC motor speed


control for R=1, KP =5, KI=4, KD=0.01

8. References
[1]

Fig.14 (e) The response of the DC motor speed


control for R=1, KP =5, KI=5, KD=0.01 [2] [3]

Wang, J. B., Control of Electric Machinery. Gau Lih Book co., Ltd, Taipei Taiwan, 2001. DAQ USB-6008 User Manual., National Instruments, 1999 Shiau, T. J., J. L. Wang and S. W. Chu., Program Design of Virtual Instrument Control LabVIEW 7X. Gau Lih Book co., Ltd, Taipei Taiwan, 2004

To compare with Figure 14 (a) to (e), can be relatively obtain, if raise KP then can get a quicker transient response, and can reduce a steady state error of the system in PID controller. To raise KD, will make

406

[4]

Liau, J. C., A Study of LabVIEW Aided in DC Motor Speed Monitoring System. National Taiwan Ocean University Department of Mechanical & Mechatronic Engineering, 2000. LabVIEW Basics Instruments, 1999. I Course Manual., National

Microcomputer. Knowledge and Execution Co., Ltd. Taichung, Taiwan, 2002. [9] Yang, K. C., Remote Fuzzy Control in DC Motor Speed Monitoring System. National Taiwan Ocean University Department of Mechanical & Mechatronic Engineering, 2001.

[5] [6]

Srinivasan, M. B., A. Shirkhodaie, and M. Malkani, LabVIEW program design for on-linedataacquision and dpredictive maintenance. Proceedings of the Thirtieth IEEE Souteastern Symposinm on System Theory, 1998, pp.520-524. Li, K. Y., S. S. Huang and R. C. Chen, 8051/52 Application of Microcontroller. Skinfo Book co., Ltd, Taipei Taiwan, 1998. Deng, M. F., Application of ISP Single Chip

[10] Huang, J. M., University Automatic Control, University City Books Enterprise Inc, Kaohsiung Taiwan, 2004. [11] Baek, S. M. and T. Y. Kuc., An adaptive PID learning control of DC motor, IEEE International, Volume.3, 1997, pp.2877-2882. [12] Ker, D. S., Automatic Control Simulation Analysis. Gau Lih Book co., Ltd, Taipei, Taiwan, 2004.

[7]

[8]

407