Rotational Speed Control Based on Microcontrollers Valter COSTA Natural and Exact Science Department, Federal University of Semi-Arid Camila BARROS Natural and Exact Science Department, Federal University of Semi-Arid Jaidilson SILVA Electrical Engineering Department, Federal University of Campina Grande Campina Grande, PB, Brazil Luciano BARROS Environmental and Technological Science Department, Federal University of Semi-Arid 1. ABSTRACT Currently, some kinds of control systems, although be simple, have much electronic components which are responsible for arithmetic and logical operations. These components set the microcontrollers, which are used for several control actions and their performance bases itself on processed signals for discrete systems or digitalized signals for continuous systems. In this work, are implemented the ON-OFF, P, PI, and PID controllers and their performance are evaluated at the rotational speed control of a mini wind turbine (cooler). Keywords: Control Systems, Microcontrollers, PID Controllers, Rotational Speed and On-Off Controller. 2. INTRODUCTION The classical or analogical control theory is relative to analysis techniques and design of systems which can be represented by continuous mathematical models in the time [1]. To compose an analogical control system, just analogical components as resistors, capacitors, operational amplifiers, etc., should be used. Besides, the components used as actuators should be also analogical as mechanical, pneumatical and electrical devices. Currently, much of the control systems, although be simple, have their performance propitiated by a large quantity of electronic components, which set the circuits responsible for arithmetic operations as sum, subtraction, multiplication, division, derivation, integration, among others; and for logical operations like AND, OR, NAND, NOR, XOR, among others. To make possible, logistically and commercially, the use of designed control systems, in the recent decades great efforts were undertaken in order to build structures to contain a great amount of circuits, with several functionalities in only one component. These structures are named microcontrollers. The microcontrollers are used for a large variety of control actions and their performance bases itself on the premise in which the processed signals should be digital, if the system or process controlled is discrete; or digitalized signals if the system or process controlled is continuous [2]. Consequently, although for certain systems the analysis and design of the control base themselves on the analogical control theory, the control system is digitalized. The control system based on analogical control theory more largely used is the Proportional- Integral-Derivative action (PID), once its performance is considered satisfactory for most of systems and processes controlled. In this work, is investigated the PID controller performance and its variations, P and PI, besides ON-OFF controller, for the speed control of a mini wind turbine (cooler). The controllers are implemented using microcontrollers, specifically the Mclab2 development platform. 3. CONTROL THEORY A control system has the function of comparing the real value off the output plant to the reference input (set poin, determining the deviation among them. With this deviation, the system produces a control signal to reduce to zero or a small value the deviation. In Figure 1 is shown a control system block diagram. The way which the controller produces the control signal is denominated control action [1]. Figure 1. Block diagram of a control system.
The controllers can be classified in accordance to their control actions: On-off Controller; Proportional Controller; Proportional-Integral Controller; Proportional-Integral-Derivative Controller. On-Off Controller For systems of two positions, the active element has only two fixed positions, or simply on-off. This control type is relatively simple and cheap; hence it is often used for domestic and industrial control systems [3]. The output controller signal is u( and the active error signal is e(. In the control of two positions, the signal u( stays in a maximum value or in a minimum value, if the signal of active error is negative or positive. Thus: u( = U 1, for e( > 0 (1) u( = U 2, for e( < 0 (2) Where U 1 and U 2 are constants and the minimum value U 2 is usually zero or U 1. In Figure 2 are presented the block diagrams of two positions controller. The interval in which signal of active error should vary before the commutation is denominated differential interval. The differential interval, shown in Figure 2, allows the output u( of the controller maintaining its current value until the signal of active error has changed lightly besides the value zero. et () U1 ut () U2 et () U1 U1 ut () U2 U2 Figure 2. Block diagram of on-off controller ; block diagram of on-off controller with differential interval. The disadvantages of this controller are the oscillation of the output around the set point (control poin of the controller; hysteresis; not guaranteeing precision, but an approximation of the controlled variable. Proportional Controller (P) For a proportional controller the relationship between the controller output u( and the active error signal e( is: u( = K pe( (3) Using the Laplace Transform: U ( = K p Where K p is named proportional gain. This controller is relatively simple and of low cost, however, in some cases, depending on the system to be controlled, it cannot reach the wanted stability, besides generating permanent oscillation, in according to the tuning of its gain. When the current value is equaled to the set point, this controller presents a steady-state error, with the tendency to stay a little below of the control point, harming the precision of this strategy. Proportional-Integral Controller (PI) This action is defined by: u = K K e( + T p t ( p e( dt (5) 0 i The controller transfer function is: U ( 1 = K p 1 + Ti s Where T i is named integrative time. This control uses the combination of P and I controllers. The integrative part eliminates the steady-state error presented by the proportional part, however it presents long response times. Proportional-Integral-Derivative Controller (PID) The combination of the proportional, integral and derivative control actions sets these controllers, which are denominated proportional-integral-derivative. The controller equation is: K p t de( u( = K pe( + e( dt + K ptd T (7) 0 dt And the transfer function is: U ( 1 K p 1+ + T Ti s = d Where T d is the derivative time. i The block diagram of the PID controller is shown in Figure 3. U( Figure 3. Block diagram of the proportional-integral-derivative controller. Each one of the variables can be tuned independently in according to the characteristics of the system to be controlled. Therefore, the characteristics of the PID controller are: (4) (6) (8)
The proportional controller presents steady-state error; The integral controller has the effect of eliminating the steady-state error, but can make the transient period more long; The derivative controller has the effect of reducing the rise time, making the response time shorter. 4. EXPERIMENTAL PLATFORM For driving of the cooler, is used a signal modulated by the pulse width (PWM Pulse Width Modulation), result of the action of the circuit shown in the Figure 6. This signal is produced by the microcontroller and applied in the cooler. The signal produced by the microcontroller possesses levels of 5 V and it is amplified for 12 V, before being applied to the motor which drives the cooler. The application of the speed control was developed using the Mclab2 development board (Mosaic), shown in Figure 4. This arrangement allows the use of several functionalities of the PIC16F877A microcontroller of Microchip [4, 5]. Figure 4. Photography of the Mclab2 development board. In the development of this work were used the circuits of the tachometer and cooler driver. The tachometer consists of a sensor of barrier, set up using a LED infrared and a phototransistor. The sensor is responsible for monitoring the passage of each propeller blade. The voltage signal generated by the tachometer, shown in the Figure 5, is inserted in the microcontroller using one of their digital inputs. Monitoring the time between the descent borders of this signal, the cooler rotational speed is calculated. The signal in high and low logical levels represents the presence and absence of blade front to the sensor, respectively. Figure 6. Cooler driving circuit and PWM signals with 25% and 100% of duty cycle. For P, PI and PID controllers are used duty cycle variable values between zero and 100%. For the ON-OFF controller the duty cycle used is zero or 100%. The results presented in the graphs are acquired by the serial interface of the microcontroller. To each 38,4 ms are sent set point values and the measured speed to PC. With these data it is possible to evaluate the performance of the control along the time. The firmware, programs that accompanies the microcontroller, was developed in C language [6, 7]. The used compiler was PCW Compiler (CCS - Custom Computer Service). 5. EXPERIMENTAL RESULTS Figure 5. Tachometer circuit and output signal. Set point is adjusted using a potentiometer which will apply a voltage signal to the analogical input of the microcontroller. The reference signal is adopted, for whole the experiment, as being 1400 rpm. Controllers ON-OFF, P, PI and PID were implemented. The last three were syntonized using the Ziegler-Nichols first technique. In Table 1 are presented the values of d (dead time) and the time constant T, which are represented in Figure 7. Using these values is possible to obtain the parameters T i, T d e K p, useful in the parametrization of respective controllers [8]. These values are presented in Table 2. Table 1. Parameters by Ziegler-Nichols first technique Parameter Z-N Time (m T 840.0 d 195.0
Figure 7. Response to step input. Table 2. Parameters for the P, PI, PID controllers from Ziegler-Nichols Controller K p T i T d P 4.308 0 PI 3.877 0.650 0 PID 5.169 0.390 0.098 For the analysis of results were acquired the speed values, for an input step, illustrated in Figure 8. To give support to the controllers analysis, the relevant variables were synthesized in Table 3. The analyzed factors are: set point time, accommodation, overshoot and quadratic medium error. The first measures the time for the controller to reach the set point, the second represents the time for the control to stabilize the quadratic medium error, the third measures the difference between the set point and the maximum value reached by the controller and the fourth indicates the quadratic medium error observed after accommodation time. In according to qualitative analysis of the Table 3, the ON-OFF controller arrives the reference and it stabilizes more quickly than all the other controllers, however presents a quadratic medium error of 4.098%, the largest among the tested controllers. (c) The P controller possesses values of set point time and stabilization very close to the ON-OFF controller. The quadratic medium error in the steady-state is sensibly smaller. However there is occurrence of a larger overshoot when compared to the previous. The PI controller, differently of the other controllers, needs a larger time to reach the reference and to stabilize. However it demonstrates no overshoot and a quadratic medium error smaller than ON-OFF and P controllers. The PID controller, although presenting a considerable overshoot (20.50%), possesses the smaller quadratic medium error in stationary regime and it gets to arrive to the reference in an intermediate time between the extreme of the ON-OFF and of the PI controllers. The system with the parameters presented in Table 2 was submitted to a braking of the cooler. The results are presented in Figure 9 and in Table 4. (d) Figure 8. Response to step input with Set point in 1400 rpm for the ON-OFF, P, PI (c) and PID (d). Controller Table 3. Obtained results for step input Set Accommodatioshoot Over- point time( time ( (%) Quadratic medium error (%) ON-OFF 0.307 0.346 6.93 4.098 P 0.307 0.384 10.02 1.334 PI 2.342 3.418 0.00 0.725 PID 0.768 1.920 20.50 0.716
Table 4. Obtained results with disturbance with set point in 1400 rpm Set Accommodatioshoot Over- point time ( time ( (%) Controller Quadratic medium error (%) ON-OFF 0.230 0.422 8.74 4.373 P 0.230 0.461 3.01 1.087 PI 2.957 3.072 0.00 0.956 PID 0.576 2.266 7.00 0.721 6. CONCLUSIONS In this work, the results provided by classic controllers implementations were presented, in this case, ON-OFF, P, PI and PID, using a microcontroller to control the speed of a mini wind turbine (cooler). The monitored variable is the cooler speed, while the controlled parameter is the voltage applied in cooler. It was verified that the smallest error in relation to the reference signal was obtained with PID controller, which is more robust than the others implemented controllers, but that presents the largest overshoot. For applications where the overshoot should be considered, PI controller can be used, since the time to reach the reference is not a crucial parameter for the design. For this last case, controller P would be the most suitable. For future works, it intends to control the speed of the cooler in order to maintain constant the relationship between this speed and the wind speed, and thus to use the control techniques implemented in real wind turbines. 7. REFERENCES (c) (d) Figure 9. Braking response with Set point in 1400 rpm for the ON-OFF, P, PI (c) and PID (d) controllers, respectively. It is verified, that the quadratic medium error stays approximately the same ones. The overshoot increases for the ON-OFF controller, while it presented decreasing for the others controllers. The accommodation decreases for the PI controller and increases for the others controllers. The set point time increases PI controller and decreases for the others controllers. [1] K. Ogata, Modern Control Engineering, New Jersey: Prentice-Hall, 2001. [2] J. J. Silva; J. S. Rocha Neto, Monitoring of Temperature Using Smart Sensors Based on CAN Architecture, Puebla: 15th International Conference on Electronics, Communications and Computers CONIELECOMP, 2005. [3] A. F. C. Pinto, M. P. Almeida, W. N. Macêdo and J. T. Pinho, Desenvolvimento de um Controlador de Carga do Tipo On-Off, Florianópolis: II Congresso Brasileiro de Energia Solar e III Conferência Regional Latino- Americana da ISES, 2008. [In Portuguese]. [4] M. Bates, PIC Microcontrollers, Burlington: Newness- Elsevier, 2007. [5] D. Lincoln, Programming and Customizing the PICAXE Microcontroller, New York: McGraw-Hill, 2006. [6] L. D. Jasio, Programming Microcontrollers in C., Burlington: Newness-Elsevier, 2005. [7] B. W. Kernighan and D. M. Ritchie, C Programming Language, New Jersey: Prentice-Hall, 2003. [8] C. P. Souza, and J. T. Costa Filho, Controle por Computador: Desenvolvendo Sistema de Aquisição de Dados para PC, São Luís: EDUFMA, 2001. [In Portuguese].