Real-time speed controlling of a DC motor using fuzzy logic controller

Öz The current study analyzed real-time speed control of a DC motor under various loads by using a Fuzzy Logic Controller (FLC). NI USB6218 DAQ was preferred as the data card for the system measuring the speed of the motor by a tachometer. Fuzzy logic control was employed by means of MATLAB®. The speed was controlled to remain constant by operating the DC motor under various loads as no-loaded, half loaded, and full loaded. Simulation results are compared with the results of real-time control. The real-time fuzzy control provided good speed tracking performance in load conditions. Bu çalışmada, DC motorun gerçek zamanda farklı yükler altında hız kontrolü gerçekleştirilmiştir. Burada kontrolör olarak Bulanık Mantık Denetleyici kullanılmıştır. Motor hız bilgisi takometre ile ölçülen sistemde veri toplama kartı olarak NI USB-6218 DAQ kullanılmıştır. Bulanık Mantık Denetim MATLAB® ortamında gerçekleştirilmiştir. DC motor yüksüz, yarım yük ve tam yük olmak üzere farklı yükler altında çalıştırılarak, hızın istenen değerde sabit kaldığı gözlemlenmiştir. Benzetim sonuçları, gerçek zamanda denetim sonuçları ile karşılaştırılmıştır. Gerçek zamanda bulanık denetim yük durumlarında daha iyi performans sağlamıştır.


Introduction
The DC motor is employed under simulation in different fields for its wide speed range, high loading capacity, immediate response, and stable properties.Aiping et al. (2011) also compared proportional-integral-derivative (PID) and fuzzy PID control.A lower overshoot of motor speed signal and quicker response were reported in the fuzzy control PID when compared to the PID control [1].Fuzzy logic control is applied in such various control systems as motor control.It is mostly preferred to control unmodeled dynamics and complex nonlinear systems [2].Speed control of DC motor was measured by means of a micro-controller and using fuzzy logic, which is recommended for small motor applications [3].The DC motor was simulated by using a fuzzy logic controller.The PID controller obtained better results in terms of rising time and settling time; however, the fuzzy controller obtained better results in terms of control of motor parameters [4].The simulation of DC motor was realized by using fuzzy logic controller with LabVIEW software.Although optimal performance was satisfactory, it was observed that the sensitivity of motor torque was low [5].The simulation of the DC motor was carried out by using a neuro-fuzzy controller.The neuro-fuzzy controller produced better results compared to the PID controller in terms of different reference speed and load changes [6].Deadzone compensator design was created for the DC motor by using fuzzy logic.The DC motor system works adaptively and with small errors in this manner [7].A PID controller was used for the speed regulation of DC motors, which are used for automatic doors.The parameter adjustment of the PID controller is very difficult and stability is low.In order to overcome such a problem and to regulate DC motor speed, the fuzzy PID algorithm is formed using the PID and fuzzy controllers together.As a result, the system can provide a quicker response; it has smaller overshoots, and is operated with higher robust [8].Alyaqout et al. realized robust design and control of a DC motor together [9].Shi et al. tried and compared H2 and H∞ control methods for controlling of a DC motor [10].Li et al. implemented Adaptive Robust Control (ARC) method for controlling of a DC motor which has unknown parameters [11].Kim and Ishiyama realized speed control of a DC motor used for driving small power-magnetic blood pumps by hybrid control method [12].Yao et al. implemented robust control of a DC motor by observer [13].Castaneda et al. implemented neural sliding mode control of a excitation current controlled DC motor [14].Rubaai and Kotaru practiced online control of a DC motor by using artificial neural network [15].Li et al. realized EDA-based speed control of a time-delayed and packet-loss DC motor [16].Ramirez and Salazar realized flatness-based control of a DC motor working with converter [17].Liu et al. controlled multiple-inputs and multiple-outputs of an externally excited DC motor by using feedback linearization technique [18].
In these studies, speed control of DC motor was carried out as a simulation and implementation.In the present study, a realtime DC motor control was simulated by means of FLC under different loads.The parameters used in simulation are the real measured values from DC motor and from the motor speed graphs obtained with the parameters; time to first peak, rise time, settling time analyses are made.In the speed control, real-time FLC provided good performances.FLC was carried out by MATLAB ® and a NI USB-6218 DAQ card was used as interface.The simulations and real-time FLC were realized in this study.

Mathematical modelling of the DC motor
DC motor equations may be expressed as below (1-5), [19].
DC motor parameters used for the simulation model of the system are given [20]., , ,

,
The DC motor Simulink simulation setup given in Figure 1 was performed by using these parameters.Here, error signal was achieved by subtracting DC motor model output value from the reference speed value.152 RPM was applied as reference speed.The error signal and its derivative were applied to the input of FLC.DC motor output speed as a result of the simulation given Figure 2. Detailed of the DC motor output response between 151 RPM to 153 RPM according to the Figure 2 show in Figure 3.

Fuzzy logic controller
The structure of the fuzzy controller, which was chosen as the controller of the system is given in Figure 4 as a block.There are two inputs of the fuzzy logic controller: , speed error and    6) and ( 7): kT ce (7) The output variable of the controller is calculated as given in the equation ( 8).
refers to the actual speed value [3].Membership functions that make use of real-time FLC are given in Figure 5, Figure 6, and Figure 7.Each variable is divided into seven fuzzy sets: Negative Large (NL), Negative Medium (NM), Negative Small (NS), Zero (Z), Positive Small (PS), Positive Medium (PM) and Positive Large (PL).There are many types of membership functions, such as triangular, gaussian, sigmoidal, trapezoidal and bell.In literature, triangular membership function is used for simplicity and also to reduce the calculations [22].Gaussian membership function is not given good response.For this reason triangular and trapezoidal membership functions are used for input e , input ce and output f i  in this study.Ampere shown in Figure 7. Example of rule: If e is Negative Large (NL) and ce is Positive Small (PS) then f i  is Negative Medium (NM).The defuzzification method is used in calculated as the center of gravity of the membership function of as in equation ( 9) [23]: The surface plot of 49 rules used in FLC is given in Figure 8.It was observed that surface passes were smooth.

Real-Time experimental setup
The model of the system used in the simulation was established in real-time as a block diagram as presented in Figure 9.A PC that includes MATLAB ® was employed in order to carry out FLC in the block diagram of the real-time experimental setup.The data exchange with the PC was provided by a NI USB-6812 DAQ card, which sent the signals that it received from feedback tachogenerator and control signal to the MS15 DC motor control module.Fuzzy control was applied by means of MATLAB ® .The signal of the tachogenerator, which turns the DAQ motor rotation information ( r  ), into voltage, was read on the analog input port of the DAQ.The control signal, which is applied for the motor speed to remain constant at the desired reference value, was sent to the analog output of the DAQ.The control signal applied to the DAQ output port was also applied to the DC motor.The load of the DC motor was set to be operated as no-loaded, half loaded, and full loaded.The eddy current break was used as the load in the system.

Experimental results
The relationship between the input voltage and DC motor output speed (RPM) is given in Figure 10.Here, when FLC output generates 0-5 Volt control signal, motor speed varies between 0-350 RPM.The present study aimed to make the system operate at a constant speed of 152 RPM.Different loads were applied to the motor in order to test whether the system could remain at a constant speed or not.
The change in the DC motor output angular speed ( r  ) is given in Figure 11 and it is observed that oscillations in the speed are low.The behaviour of FLC against the applied load is given in Figure 12.Here, it can be seen that the reference value of the system in the no-loaded case was achieved at 0.25 second within a 0-1.75 second interval.The system was half loaded between 1.75-2.50second.Despite this, the system responded immediately and kept its reference value.The system was full loaded between 2.50-3.80second.The system once again responded immediately and the reference speed remained constant.Then the system was no-loaded and was full loaded between 5.2-6.60 second.In this case, although FLC reacted, the system response was delayed.A similar situation can also be seen between 9.00 and 9.80 second.The reason for this is that the motor feeding voltage has a 5 Volt maximum although the error is larger, as can be seen in the error and error change curve given in Figure 13.It can also be seen on Figure 13 that changes in ) (kT e and ) (kT ce are rather low, which indicates that control of the system by FLC is stable.Table 1 is obtained according to the data in Figure 2, Figure 3 and Figure 11.Speed values are used in simulation and real-time controls shown in Table 1.

Conclusions
The simulations of a DC motor and real-time fuzzy logic control were realized successfully in this study.When the findings are examined, it is seen that simulation and real-time applications are highly robust.The real-time FLC provided good speed tracking performance under no-loaded, half loaded, and full loaded conditions.It is determined that the system is highly stable, it gives immediate responses to load changes, and speed oscillations do not change.As is seen from the findings of the present study, it can be applied to the DC motor types being used in real-time in the industry.

Conclusions
The simulations of a DC motor and real-time fuzzy logic control were realized successfully in this study.When the findings are examined, it is seen that simulation and real-time applications are highly robust.The real-time FLC provided good speed tracking performance under no-loaded, half loaded, and full loaded conditions.It is determined that the system is highly stable, it gives immediate responses to load changes, and speed oscillations do not change.As is seen from the findings of the present study, it can be applied to the DC motor types being used in real-time in the industry.

References
, change in speed error.
are calculated for each sampling time as given in equations (

Figure 1 :
Figure 1: Simulation model of the system.

Figure 2 :
Figure 2: DC motor output speed as a result of the simulation.

Figure 3 :
Figure 3: Detailed of the DC motor output response between 151 RPM to 153 RPM according to the Figure 2.

Figure 8 :
Figure 8: Surface plot of change in output f i  versus inputs

Figure 9 :
Figure 9: Surface plot of change in output.

,
difference speed values from no-load to half load;f h n  , difference speed values from half load to full load and f n   0 is difference speed values from no-load to full load in Table1.

Figure 12 :
Figure 12: FLC signal output against dc motor load change (no-loaded, half, and full loaded).

Table 1 :
Speed values using simulation and real-time controls.
p t (sec) r t (sec) h n   0 (RPM) p t , time to first peak; r t , rise time; s t , settling time;