You are on page 1of 14

DC-motor speed control by PIC-based digital PID-controller

Yoshihiko Takase and George Ibrahim


Department of Mechatronics Engineering, Faculty of Mechanical and Electrical Engineering, Tishreen University, Lattakia, Syria
Abstract DC motor speed control was carried out by preparing a PIC based PID controller. The H-bridge motor driver was driven by the sign/magnitude PWM signal at frequency of 240 Hz. The step responses of the motor speed () were systematically measured to obtain optimum PID parameters. Practical steps to determine the parameters were, rst to estimate the values by the Ziegler-Nichols method in medium speed region and second to tune the values in detail step by step. The PID controller exhibited notable improvements of the time constant at rising edge (e.g. 0.5 to 0.2 s) and excellent control performance to minimize the steady-state error (e.g. between 0.5 and 0.2 %) even the vs duty cycle curve was strongly nonlinear in discontinuous conduction mode of PWM at 240 Hz.

1 Introduction
The practice project to understand the base of the process control plainly was planned for the student who studies the mechatronics engineering. The project consists of: 1. Characteristics of PIC PWM controller measured by USB based data acquisition system,[1] 2. Basic simulation of digital standard-PIDcontroller,[2] 3. DC-motor speed control by PIC-based digital PID-controller, 4. DC-motor simulation and verication of the result by experiment, 5. Locked anti-phase PWM PID-control of DC-motor speed, and 6. DC-motor position PID-control by simulation and experiment. This is the third item of the project. DC motor has a simple structure and is easy to control its speed. The simulation of it may also be relatively easy in the next step of the project. A proportional-integral-derivative controller (PID controller) is a common feedback loop component in industrial control systems. In the absence of knowledge of the underlying process, a PID controller is the best controller.[3],[4] Pulse-width modulation (PWM) is a very ecient way of providing intermediate amounts of electrical power between fully on and fully o to the motor. PWM works well with the microprocessor, which, because of its on/o nature, can easily set the needed duty cycle. Practically there are many items to utilize the PWM, for example microprocessor family, driver device (transistor, FET and their H-bridge IC), PWM frequency and operation mode (sign/magnitude PWM or locked anti-phase PWM,[5],[6] continuous or discontinuous conduction[7]). Although there are many articles which describe each principle of the motor control and simulation using commercial software, it is not easy to nd an experimental procedure to perform loop tuning of the microprocessor based PID control to achieve optimum behavior of the motor speed. For example, the web site of University of Michigan is presenting many control tutorials.[8] Especially for education purpose of the present study, popular and not expensive devices are used such as microcontroller (PIC16 series[9]), small DC motor, popular H-bridge driver, I/O terminal for USB and popular PC. The purpose of the present study is to present an essential process to carry out the PID speed control of DC motor. The study process is to prepare hardware of PIC PWM controller, DC motor driver, frequency to voltage (f -v) converter, data acquisition system by using an analog I/O terminal for USB, to prepare software to perform PID control, to measure step response of the motor speed, to adjust the 1

PID parameters to the optimum values for the desired control response, and to evaluate the performance of the PID controller under a popular operating condition using n-p-n transistor H-bridge drive and sign/magnitude PWM signal.

2 PIC based DC motor PID controller hardware


Hardware consists of PIC16F88 controller board, I/O board with H-bridge motor driver, f -v converter, high-precision analog I/O terminal, RS-232C terminal (popular PC) and DC motor. DC motor of a type of DME34SMA with revolution sensor, product of Japan servo Co., Ltd. was used. Standard specication of the motor is that power supply is 12 V, output is 1.3 W and current is 0.2 A. The revolution sensor is a magnetic pulse generator to provide rectangular pulse output (12 pulses/revolution and dutycycle = 50 20 %).[10] The PIC16F88 controller board was connected to both the PC through the USB/Serial converter and the motor driver. The output pulses of the revolution sensor was converted to analog signal by the f -v converter and supplied to the A/D converter (10 bit) of the PIC16F88. Circuits of the PIC16F88 controller board, RS-232 to/from TTL USART, and the I/O board with H-bridge motor driver are essentially the same as ones reported previously.[1] The voltage output of the f -v converter was captured and stored to the PC by using a high-precision analog I/O terminal for USB 2.0, AIO-160802AY-USB, product of CONTEC Co., Ltd. It has analog input (16 bit, 8 ch) and analog output (16 bit, 2 ch). The maximum conversion speed is 10 s.[11] Graphs were plotted by using the Excel. The block diagram of the experimental setup is shown in Figure 1.
PC with USB Interfaces

A/D Converter USB/RS-232 Converter with USB Interface Motor with PIC16F88 Controller Board with A/D General Purpose I/O Board with Motor Driver Rev. Sensor

M PG

Power Supply (SW type 5 V)

Power Supply (SW type 12 V)

Freq. to Volt. Converter

Fig. 1 Block diagram of the experimental setup.

3 Standard PID controller program


For a digital implementation of a PID controller, the standard form of the PID controller has to be discretised. The discretised PID controller is expressed, as well as the previous study,[2] as follows: ( M Vn = KP en en1 + M Vn = M Vn1 + M Vn , ) t TD en + (en 2en1 + en2 ) , TI t

(1) (2)

where M Vn is the present manipulated variable, M Vn1 the previous value of M Vn , en the present error, en1 the previous value of en , en2 the previous value of en1 , KP the proportional gain, TI the integral time, and TD the derivative time, t the sampling time and n the sampling number corresponding the present time. The standard PID velocity-algorithm was implemented by the C while loop as follows. The CCS C compiler was used to develop the program. MVn_1 = en_1 = en_2 = 0.0; dt = 0.0041; // Processing loop of the standard PID controller of velocity algorithm while (TRUE) { // Error signal = setpoint - process variable e = SP - PV; // Equation (1) dMV = Kp*(e-en_1) + Kp*DT/Ti*e + Kp*Td/DT*(e-2*en_1+en_2); // Equation (2) MV = MVn_1 + dMV; // Process variable from measurement PV = inport(); // Update previous value to current value MVn_1 = MV; en_2 = en_1; en_1 = e; } The above essential part of the program is the same as the previous one written for Windows operating system.[2] The executable program, however, has some dierence between for Windows and for PIC, which is practically important. PIC16 series does not have hardware for number multiplication and oating point number processing, which are always included in CPUs used for Windows operating system. Program memory size of the PIC16F88 is 7168 bytes (internal ash memory) which is much smaller than external memory size of Windows system. In conclusion, oating point number was used only for parameters KP , TI and TD . Other variables such as setpoint, process variable and error signal were dened as singed long integer. The executable program occupied about 95 % of the program memory size. In the present experiment the sampling time t was set to inverse value of the PWM frequency (e.g. 4.1 ms for 240 Hz).

4 Experimental
4.1 Speed vs PWM duty cycle characteristics
First, it is necessary to know the relation between DC-motor angular-speed () and PWM duty cycle. The vs duty cycle characteristics were measured for two kinds of DC motors and two kinds of motor drivers. PWM frequency dependence was also measured. Figure 2 shows the vs duty cycle characteristic. The PWM frequency was 61 Hz. Power supply of the motor was 12 V. The characteristic showed strong nonlinearity, then additional measurement was carried out for DC motor of a dierent product (TG-47C, Tsukasa Denko Co., Ltd.) to make sure of the characteristic. Figure 3 shows the vs duty cycle characteristic for two kinds of motor drivers, n-channel MOS FET driver (IRF830) and n-p-n transistor H-bridge driver IC (L298). PWM frequency was 61 Hz. Power supply of the motor was 12 V. Figure 4 shows the vs duty cycle characteristics for fP W M = 0.061, 0.240, 0.980, 3.91, 7.81 and

DC-Motor Speed vs Duty Cycle Characteristic


DME34S 5000 4000 Speed [rpm] 3000 2000 1000 0 0 20 40 60 Duty cycle [%] 80 100 TG-47C

Fig. 2 The vs duty cycle characteristic for two kinds of DC motors, DME34S and TG-47C. fP W M = 61 Hz. Power supply of the motor was 12 V.

DC-Motor Speed vs Duty Cycle Characteristic


IRF830 6000 5000 Speed [rpm] 4000 3000 2000 1000 0 0 20 40 60 Duty cycle [%] 80 100 L298

Fig. 3 The vs duty cycle characteristic for two kinds of motor drivers, MOS FET (IRF830) and n-p-n transistor H-bridge IC (L298). The PWM frequency was 61 Hz. Power supply of the motor was 12 V.

15.6 kHz. The driver device was L298. The vs duty cycle characteristics shown in Figures 2 - 4 showed strong nonlinear relations, then the measurement was carried out twice. The characteristic was not unstable but reproducible. In addition, DC power supply vs characteristic of the same motor was also measured using DC power supply instead of the PWM signal. The characteristic showed linear relation as shown in Figure 5. Both characteristics in Figures 4 and 5 show that there is a dead region where stays zero. The threshold value of the dead region strongly depends on the PWM frequency. Figure 6 shows the output voltage vs characteristic of the f -v converter. The linearity is excellent. The straight line is expressed by the equation VOU T = 0.934 + 5.0, (3)

where VOU T is the output voltage in mV unit of the f -v converter and is the angular speed in rpm unit. Figure 7 shows the output voltage vs power voltage characteristic of the f -v converter. The linearity is excellent when the power voltage is equal to or larger than 5 V. In the present experiment, power voltage of 5 V was used for compatibility with the A/D converter of the PIC.

DC-Motor Speed vs Duty Cycle Characteristic


4500 4000 3500 Speed [rpm] 3000 2500 2000 1500 1000 500 0 0 20 40 60 Duty cycle [%] 80 100
61 Hz 240 Hz 980 Hz 3.91 kHz 7.81 kHz 15.6 kHz

Fig. 4 The vs duty cycle characteristic for fP W M = 0.061, 0.240, 0.980, 3.91, 7.81 and 15.6 kHz. Motor driver was n-p-n transistor H-bridge IC (L298). Power supply of the motor was 12 V.

DC-Motor Speed vs Power Voltage Characteristic


4500 4000 3500 Speed [rpm] 3000 2500 2000 1500 1000 500 0 0 5 10 Power voltage [V] 15 y = 385.13x - 717.81

Fig. 5 The vs DC power voltage characteristic of the motor.

Output Voltage vs Speed of F-V Converter


4000 3500 Output voltage [mV] 3000 2500 2000 1500 1000 500 0 0 1000 2000 Speed [rpm] 3000 4000 y = 0.9341x + 5.0212

Fig. 6 Output voltage vs characteristic of the f -v converter.

Output Voltage vs Power Voltage of F-VConverter


9 8 Output voltage [V] 7 6 5 4 3 2 1 0 0 2 4 6 8 10 12 14 16 Power voltage [V] y = 0.5435x - 0.1199

Fig. 7 Output voltage vs power voltage characteristic of the f -v converter.

4.2 Open-loop step-response of speed


Figure 8 shows the open loop step responses of . The duty cycle was changed from 0 % to 12, 17, 25, 50, 75 and 100 %. The envelope of the step PWM-excitation is referred to as Vstep in the gure. The PWM frequency was 240 Hz on which the dead region was comparatively small as seen in Figure 4.
Open-Loop Step Response of DC-Motor Speed
4500 4000 3500 Speed [rpm] 3000 2500 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10 Vstep Duty= 12% Duty= 17% Duty= 25% Duty= 50% Duty= 75% Duty=100%

Fig. 8 Open-loop step response of with dutycycle =12, 17, 25, 50, 75 and 100 %. fP W M = 240 Hz.

4.3 Closed-loop step-response of speed under the P control


Closed loop step response of under the proportional (P) control was examined by changing KP and setting integral and derivative contributions zero. Step responses of are shown in Figure 9 for KP =1, 2, 4, 6, 10 and 50, and fP W M =240 Hz. The setpoint started from 659 rpm (SP =12) and rose to 2666 rpm (SP =511). The high level value continued for 5 sec then fell back to 659 rpm. The middle two thin lines indicate these setpoints.

P-Controller Step Response of DC-Motor Speed

3500 3000 2500 Speed [rpm] 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10
Vstep Kp=1.0 Kp=2.0 Kp=4.0 Kp=6.0 Kp=10 Kp=50 659 rpm 2666 rpm

Fig. 9 P-controller step response of with KP = 1, 2, 4, 6, 10 and 50. fP W M = 240 Hz.

4.4 Closed loop step response of speed under the PI control


Eect of KP on the step response of under the PI control was examined by changing KP and setting TI constant and TD zero. Step responses of are shown in Figure 10 for KP = 0.6, 0.8, 1.4, 1.8 and 2.6. fP W M = 240 Hz. No control curve (No ctrl) is also shown. The value of TI was set to 0.3.
PI-Controller Step Response of DC-Motor Speed

3500 3000 2500 Speed [rpm] 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10
Vstep No ctrl Kp=0.6 Kp=0.8 Kp=1.4 Kp=1.8 Kp=2.6 659 rpm 2666 rpm

Fig. 10 PI-controller step response of with KP = 0.6, 0.8, 1.4, 1.8 and 2.6. TI = 0.3. fP W M = 240 Hz.

Eect of TI on the step response of under the PI control was examined by changing TI and setting KP constant and TD zero. Step responses of are shown in Figure 11 for TI = 0.8, 0.5, 0.3, 0.2 and 0.1. fP W M = 240 Hz. No control curve (No ctrl) is also shown. The value of KP was set to 1.4.

4.5 Closed loop step response of speed under the PID control
Eect of TD on the step response of under the PID control was examined by changing TD and setting KP and TI constant. Step responses of are shown in Figure 12 for TD = 0.00, 0.02, 0.06, 0.10 and 0.14. fP W M = 240 Hz. No control curve (No ctrl) is also shown. The values of KP and TI were set to 1.4 and 0.3, respectively.

PI-Controller Step Response of DC-Motor Speed

3500 3000 2500 Speed [rpm] 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10
Vstep No ctrl Ti=0.8 Ti=0.5 Ti=0.3 Ti=0.2 Ti=0.1 659 rpm 2666 rpm

Fig. 11 PI-controller step response of with TI = 0.8, 0.5, 0.3, 0.2 and 0.1. KP = 1.4. fP W M = 240 Hz.

PID-Controller Step Response of DC-Motor Speed

3500 3000 2500 Speed [rpm] 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10
Vstep No ctrl Td=0.00 Td=0.02 Td=0.06 Td=0.10 Td=0.14 659 rpm 2666 rpm

Fig. 12 PID-controller step response of with TI = 0.8, 0.5, 0.3, 0.2 and 0.1. KP = 1.4. fP W M = 240 Hz.

5 Discussion
Ziegler-Nichols ultimate sensitivity method is hard to execute, then the second method, Ziegler-Nichols step response method, is tried to determine the PID parameters. Figure 8 indicates that the time constant of the step response of changes as the duty cycle changes. The PID parameters for six curves in Figure 8 are to be determined. Table 1 shows equations to determine PID parameters KP , TI and TD proposed by Ziegler-Nichols.[3] KP T /(KL) 0.9T /(KL) 1.2T /(KL) TI 3.3L 2.0L TD

P controller PI controller PID controller

0.5L

Table. 1 Ziegler-Nichols step response method to determine PID parameters KP , TI and TD . T is the time constant, K is the equivalent gain and L is the dead time.

The steps to determine the PID parameters are as follows.[12] 8

A) Measurement of step response of motor speed B) Determination of time constant and dead time C) Determination of equivalent gain D) Determination of PID parameters A) Measurement of step response of motor speed Fine time resolution (10 ms interval) characteristics of the data in Figure 8 are shown in Figure 13. Lines of tangent at the rising edge are determined as shown in the gure by thin lines. The equations of the lines of tangent are = 1.55t 632 for dutycycle = 12 %, = 2.19t 742 for dutycycle = 17 %, = 3.80t 1113 for dutycycle = 25 %, = 9.49t 2612 for dutycycle = 50 %, = 13.2t 3612 for dutycycle = 75 %, = 18.2t 4829 for dutycycle = 100 %, where is the angular speed in rpm unit and t is the time in ms unit.

Open-Loop Step Response of DC-Motor Speed 4500 4000 3500 3000 Speed [rpm] 2500 2000 1500 1000 500 0 -500 0 500 1000 Time [ms] 1500 2000
Duty=100% Vstep Duty= 12% Duty= 17% Duty= 25% Duty= 50% Duty= 75%

Fig. 13 Open-loop step response of with dutycycle =12, 17, 25, 50, 75 and 100 %. fP W M = 240 Hz.

B) Determination of time constant and dead time The dead time L is determined by the intercept t1 of the line of tangent at = 0. The dead time L = t1 t0 = 157, 89.0, 42.8, 25.2, 22.8 and 15.7 ms for the duty cycle of 12, 17, 25, 50, 75 and 100 %, respectively, where t0 is the rising edge time of the setpoint. The dead time reduces as the duty cycle increases and becomes about 10 % of the maximum value. The time constant T is determined by the intercept t2 of the line of tangent at the high steady state value of . The steady state values of are 368, 1117, 2105, 3311, 3661 and 3877 rpm (10 points average), then the time constant T = t2 t0 L = 237, 511, 554, 349, 276 and 213 ms for the duty cycle of 12, 17, 25, 50, 75 and 100 %, respectively. The time constant reduces to about half of the maximum value. C) Determination of equivalent gain The equivalent gain K is determined by the following equation.[12]

K=

P V [%] , M V [%]

(4)

where P V is the change of the process variable and M V the change of the manipulated variable. In the present case, the value of K for each curve becomes K = ((368 0)/3877)/(127/1024) = 0.77 for dutycycle = 12 %, K = ((1117 0)/3877)/(175/1024) = 1.7 for dutycycle = 17 %, K = ((2105 0)/3877)/(255/1024) = 2.2 for dutycycle = 25 %, K = ((3311 0)/3877)/(511/1024) = 1.7 for dutycycle = 50 %, K = ((13661 0)/3877)/(767/1024) = 1.3 for dutycycle = 75 %, K = ((3877 0)/3877)/(1023/1024) = 1.0 for dutycycle = 100 %, D) Determination of PID parameters Table 2 shows the values of KP , TI and TD calculated by using equations in Table 1 and the time constant and dead time determined above. These obtained values are not constant but change depending on the duty cycle, then it is necessary to test if these values are suitable or not. Controller P controller PI controller PID controller P controller PI controller PID controller P controller PI controller PID controller P controller PI controller PID controller P controller PI controller PID controller P controller PI controller PID controller KP 1.97 1.78 2.37 3.40 3.06 4.08 5.93 5.34 7.12 8.09 7.28 9.70 9.63 8.67 11.6 13.6 12.2 16.3 TI 0.52 0.31 0.29 0.18 0.14 0.09 0.08 0.05 0.08 0.05 0.05 0.03 TD

Duty cycle = 12 %

0.08

Duty cycle = 17 %

0.04

Duty cycle = 25 %

0.02

Duty cycle = 50 %

0.01

Duty cycle = 75 %

0.01

Duty cycle = 100 %

0.01

Table. 2 PID parameters KP , TI and TD calculated by the Ziegler-Nichols method using the present experimental data.

Figure 14 shows the step response of for P controller with KP in Table 2. The setpoints were 71, 215, 404, 634, 701 and 743. These values were obtained from the steady state in Figure 8. Certain good step responses are seen for all setpoints though overshoot may by a little too big. The steady state values do not reach the setpoint which are shown by the thin lines. This is the well known steady-state error problem of the P controller.[8] Figure 15 shows the step response of for PI controller with KP and TI in Table 2. The setpoints were 71, 215, 404, 634, 701 and 743. In a medium region the step response may be better than P controller because the steady-state error of is much smaller. Less steady-state error is a direct result of the integral contribution of the PI controller. In a high region the response exhibits continuous 10

P-Controller Step Response of DC-Motor Speed


4500 4000 3500 Speed [rpm] 3000 2500 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10

Vstep SP= 71 SP=215 SP=404 SP=634 SP=701 SP=743 368 rpm 1117 rpm 2105 rpm 3311 rpm 3661 rpm 3877 rpm

Fig. 14 P-controller step response of with SP = 71, 215, 404, 634, 701 and 743. fP W M = 240 Hz.

oscillation. This indicates the PI parameters should be readjusted so as to a tendency to decrease KP and to increase TI .
PI-Controller Step Response of DC-Motor Speed
4500 4000 3500 Speed [rpm] 3000 2500 2000 1500 1000 500 0 0 2 4 Time [s] 6 8 10
Vstep SP= 71 SP=215 SP=404 SP=634 SP=701 SP=743 368 rpm 1117 rpm 2105 rpm 3311 rpm 3661 rpm 3877 rpm

Fig. 15 PI-controller step response of with SP = 71, 215, 404, 634, 701 and 743. fP W M = 240 Hz.

Figure 16 shows the step response of for PID controller with KP , TI and TD in Table 2. The setpoints were 71, 215, 404, 634, 701 and 743. In a medium region the step response may be better than both of P and PI controller because both of the steady-state error of and overshoot are smaller. The small steady-state error comes from the integral contribution. The suppression of the overshoot comes from the derivative contribution. The derivative term slows the rate of change of the manipulated variable and this eect is most noticeable close to the controller set point. Hence, derivative control is used to reduce the magnitude of the overshoot produced by the integral contribution and improve the combined controller-process stability.[4] In a high region the response exhibits continuous oscillation. This indicates the PID parameters should be readjusted so as to a tendency to decrease KP , to increase TI and to decrease TD . The PID parameters can be estimated by Ziegler-Nichols method from the step response of measured in a middle region. It is, however, necessary to readjust experimentally especially in a high region. The readjustment of the PID parameters is the main purpose of the present experiment. The step responses of measured under P, PI or PID control are already shown in Figures 9 - 12. In these measurements setpoint started from SP = 127 not zero to see both characteristics in low and high 11

Revolution [rpm] Speed [rpm]

5000 4500 4500 4000 4000 3500 3500 3000 3000 2500 2500 2000 2000 1500 1000 500 500 0 0 (500) 0 0

Dynamical Response of Revolution with PID Controller PID-Controller Step Response of DC-Motor Speed

Vstep SP= 71 SP=215 SP=404 SP=634 SP=634 SP=701 SP=701 SP=743 SP=743 368 rpm 368 rpm 1117 rpm 1117 rpm 2105 rpm 2105 rpm 3311 rpm 3311 rpm 3661 rpm 3661 rpm

2 2

4 4 Time [s] Time [s]

6 6

8 8

10 10

3877 rpm

Fig. 16 PID-controller step response of with SP = 71, 215, 404, 634, 701 and 743. fP W M = 240 Hz.

regions. The step response of in Figure 9 shows the steady-state error problem of the P controller. As the KP increases the steady-state error decreases. However, the KP cannot be too high because the characteristic becomes unstable and oscillatory as indicated by the curve for KP = 50. From the data in Figures 9 and 14, the P controller is a good choice for applications in which the steady-state error is not a big problem. In this case, the parameter KP determined by the Ziegler-Nichols method may be directly applicable. The KP dependence on the step response of in Figure 10 shows high control performance of the PI controller when KP is in between 0.6 and 2.6 at TI = 0.3. As the value of KP increases rising edge becomes steeper and exhibits a little overshoot. All curves tend to focus to a steady value close to the setpoint. There is a little steady-state error especially when the is low. The curve for KP = 0.8 (no overshoot) or for KP = 1.4 (slight overshoot) may be the best tuning when TI = 0.3. The TI dependence on the step response of in Figure 11 shows high control performance of the PI controller when TI is in between 0.5 and 0.2 at KP = 1.4. As the value of TI decreases rising edge becomes steeper and exhibits a little overshoot. When TI is less than 0.1 the curve becomes oscillatory. All curves except TI = 0.8 tend to focus to a steady value close to the setpoint. When TI = 0.2 the steady-state error from the setpoint 2666 rpm (SP = 511) is almost zero showing excellent control performance. The curve for TI is in between 0.3 and 0.2 may be the best tuning when KP = 1.4. It is worth while noticing that experimentally determined best tuning values of KP in between 0.8 and 1.4, and TI in between 0.3 and 0.2 are close to those obtained by the Ziegler-Nichols method using data of low and medium regions. The PI controller reduced the time constant at the rising edge from 535 ms (no control curve) to 226 ms (KP = 1.4 and TI = 0.3 curve). The curves around the falling edge, however, show certain amount of undershoot. As a result, the time to reach steady state for the PI controller is almost the same as that of the no control curve. The larger undershoot than overshoot is consistent with the strong nonlinear concave curve shown in Figures 2, 3 and 4. As the duty cycle decreases the decreases almost exponentially. As shown in Figure 4, the - duty cycle characteristics show strong nonlinearity and frequency dependence when fP W M = 61, 240 and 980 Hz. In this frequency range the PWM is considered to be in discontinuous conduction mode. The motor goes into free or unlocked state during o-duty cycle in a PWM period. A relatively poor - t characteristic found in high to low transition of for fP W M = 240 Hz can be attributed to this unlocked state. The discontinuous conduction mode, on the other hand, has some advantage for such purposes: cheep switch can be utilized since fP W M is low and relatively high torque is utilized during low to high transition of . In the present experiment, the L setpoint was 659 rpm. The present DC motor is not recommended 12

to use in such a low region. As a matter of fact the step response becomes much better on small transition in high region. Figure 17 shows an example of the transition from SP = 634 (3311 rpm) to SP = 701 (3661 rpm) with KP = 5.0, TI = 0.12 and TD = 0.0.
PI-Controller Step Response of DC-Motor Speed
3800 3700 3600 Speed [rpm] 3500 3400 3300 3200 3100 3000 0 1 2 3 4 5 Time [s] 6 7 8 9 10 Kp=5.0 Ti=0.12 3311 rpm 3661 rpm

Fig. 17 PI-controller step response of with SP =634 (3311 rpm) and 701 (3661 rpm). fP W M = 240 Hz.

Table 3 shows error evaluation of the step response in Figure 17. In L region the error ( SP )/SP is in between 0.51 to 0.19 %. In H region the error is in between 0.45 to 0.20 %. Overshoot is 1.2 % and undershoot is 4.6 %. These data indicate excellent control performance of the PI controller considering that the present DC motor is a product not for industrial use. Time region [s] 0.0 t 1.5 2.5 t 6.6 t = 2.0 t = 7.0 Item Average Maximum Minimum Average Maximum Minimum Overshoot Undershoot Data [rpm] 3305 3317 3294 3658 3668 3644 3706 3159 Set point [rpm] 3311 3311 3311 3661 3661 3661 3661 3311 Error [%] -0.17 0.19 -0.51 -0.08 0.20 -0.45 1.2 -4.6

Table. 3 Error evaluation of the step response of with PI controller. The PID parameters were KP = 5.0, TI = 0.12 and TD = 0.0.

The - t characteristic with PID controller shown in Figure 12 shows a little complicated result. As the value of TD increases the overshoot on the rising edge is suppressed as same as that in Figure 16. All curves, however, do not tend to focus to a certain steady value close to the setpoint. The steady-state error from the setpoint looks random and not small especially in a low region. Further experiments indicated that the instability was mainly attributed to the motor which was running under the discontinuous conduction mode of PWM signal. Detailed results will be presented in the next part of the study.

6 Conclusion
DC motor speed control was carried out by preparing a PIC based PID controller. The H-bridge motor driver was driven by the sign/magnitude PWM signal at frequency of 240 Hz. The step responses of the motor speed () were systematically measured to obtain optimum PID parameters. Practical steps to determine the parameters were, rst to estimate the values by the Ziegler-Nichols method in medium 13

speed region and second to tune the values in detail step by step. The PID controller exhibited notable improvements of the time constant at rising edge (e.g. 0.5 to 0.2 s) and excellent control performance to minimize the steady-state error (e.g. between 0.5 and 0.2 %) even the vs duty cycle curve was strongly nonlinear in discontinuous conduction mode of PWM at 240 Hz.

References
[1] Y. Takase and G. Ibrahim: Characteristics of PIC PWM controller measured by USB based Data acquisition system, The Forth Report of Senior Volunteer of JICA (April 16, 2008). [2] Y. Takase and G. Ibrahim: Basic simulation of digital ideal-PID-controller, The Forth Report of Senior Volunteer of JICA (April 16, 2008). [3] M. Araki: CONTROL SYSTEMS, ROBOTICS, AND AUTOMATION - Vol. II - PID Control, Encyclopedia of Life Support Systems (Copyright 2002-2010). [4] Wikipedia: PID controller (last modied on 6 November 2010), http://en.wikipedia.org/wiki/ PID controller. [5] National Semiconductor: LMD18200 data sheet (September 1996), http://www.national.com/ jpn/. [6] D. Clark and M. Owings: Building robot drive trains, The McGraw-Hill Companies, Inc. (2003). [7] W. Shepherd, L. N. Hulley and D. T. W. Liang: Power electronics and motor control, Cambridge University Press (1987). [8] University of Michigan: Control Tutorials for Matlab, PID Tutorial, (August 1997), http://www. engin.umich.edu/group/ctm/PID/PID.html. [9] Microchip Technology Incorporated: PICmicro Mid-Range MCU Family Reference Manual DS31014A-page 14-8 (1997). [10] JAPAN SERVO Co., Ltd.: Standard specication of DME34SA (November 2007), http://www. japanservo.co.jp/digital/english/general/pdf/DME34 2.pdf. [11] CONTEC Co., Ltd.: AIO-160802AY-USB Manual (Copyright 2006), http://www2.contec.co.jp/ prod data/aio160802ayusb/c01e.pdf. [12] K. Hiroi and A. Miyata: Introduction to Control Engineering using Simulation System (in Japanese), CQ Publishing Co., Ltd. (October 2004).

14

You might also like