## Abstract

This work explains the speed control design for a DC motor using fuzzy logic with LabVIEW software. It is also a literature review about the design and the implementation environment and is presented using fuzzy logic to describe the materials and methods used. Various processes on the subject highlight the idea, creation, development, and implementation of intelligent control, and the results considering the application and development for this purpose are presented.

### Keywords

- fuzzy logic
- LabVIEW
- MATLAB
- rules
- industrial applications

## 1. Introduction

In the last decade, the use of various control techniques such as hybrid [1, 2] or artificial intelligence has grown exponentially in the fields of power electronics, control systems, and positioning systems. To carry out these development methods, a large database and understanding of control methods are necessary to describe the analysis system to facilitate decision-making. One of these methods is fuzzy logic [3, 4], which is necessary to realize improvements over classical logic and is basically a statement that can be understood as a logical value of 1 or 0.

In the control field, specifically in the DC motor, control can be applied by intelligent control techniques such as fuzzy logic, which is further applied in parallel with conventional control techniques. In fuzzy logic there are two well-known algorithms: logarithm Mamdani and Takagi Sugeno; these are useful in applications such as microelectronics and power electronics [5, 6].

Since it is a more compact and computationally efficient representation than a Mamdani system, the Sugeno system lends itself to the use of adaptive techniques for constructing fuzzy models [7, 8]. These adaptive techniques can be used to customize the membership functions so that the fuzzy system models the data with a significant improvement [9, 10].

## 2. Materials and methods

### 2.1. Process description

The device on which the fuzzy logic control will be applied is a 12 V DC motor as shown in Figure 1.

The block diagram of Figure 2 shows the control process. In the first stage, the input is the setpoint or reference rate to be applied to the motor. Next is the analog-digital converter, which is distinguished as a data acquisition card. The second stage is the fuzzy logic control developed in LabVIEW. The data acquisition card is used once again since this should act as both analog-digital converter at the input and digital-analog converter at the output. Hereafter, the analog signal passes through the actuator block, which is H-bridge pulse-width modulation (PWM) modified to the motor speed [11]. The next block in the plant is the DC motor. The tachometer, which is built into the DC motor, is a feedback system that checks whether the engine speed has altered and eliminates unwanted phenomena.

LabVIEW [12] (Figure 3) is the software used to develop the controller through its fuzzy logic blocks. To facilitate programming the LabVIEW toolbox contains toolkits. This software is mainly used for data acquisition, mathematical analysis, instrument control, and controller design. In 2008 the software was used to control the Large Hadron Collider [13], a particle accelerator designed by about 2000 scientists from 34 countries around the world. This appliance is the largest of its kind and is located near Geneva.

To interact with LabVIEW, the user needs a data acquisition card, e.g., a National Instruments NI myDAQ (Figure 4). The function of the data acquisition card is to collect physical signals during the process and transform them into electrical voltages that are subsequently scanned on a PC and can be processed. To make the transformation to a digital signal the card is needed at the adaptation stage [14–16]

Within the data acquisition process is the transducer, which is an element that converts the physical quantity to be measured into an output signal, usually a voltage or current that is then processed on a PC or other system.

Signal conditioning is the stage that is responsible for filtering and adapting the outgoing signal transducer, which is then sent to the analog-digital converter, which as we know is the stage responsible for converting an analog signal to the digital output stage to connect the data acquisition system to a PC (Figure 5).

In the initial window for the design of a new fuzzy controller, data such as name, designer name, date, and time are observed for the project. In the window in Figure 6, the fuzzy set editor and its consequences are introduced.

The input and output linguistic variables and their ranges are entered functionally. This takes into account the fuzzy set editor, which starts with a default configuration. The advantage over a conventional proportional-integral-derivative (PID) controller is that a fuzzy PD (proportional and derivative) controller can implement nonlinear control strategies, which uses linguistic rules. The rules evaluate the difference between the measured value and the set value, the error signal, and the tendency of the error signal to determine whether to increment or decrement the control variable (Figure 7).

By deploying the box, it is necessary the input linguistic variables, where each one contains the following linguistic terms: NEx (term negative), ZOx (zero), POx (term positive), default data range is −1 to 1, variable name default: INX with x = 1, …, 4 (Figure 8).

The result is output linguistic variables, which contain the following linguistic terms: NEo (term negative), ZOo (zero) and POo (term positive), default data range is from −1 to 1, variable name default: Output (Figure 9).

The interference method, the method of defuzzification and output default configuration, is determined because of the rule editor (Figure 10).

The block features input and output characteristics that simulate the controller and graphically display the output behavior regarding parameter rules in the rule editor (Figure 11).

At the end of this process, the fuzzy controller with all the information on the rules, which is observed in the graphical environment of LabVIEW as a block, is obtained (Figure 12).

Pulse width modulation (PWM) is a process in which the duty cycle of a periodic signal, possibly to transmit information, is modified through a communications channel or to control the amount of power sent to a load (Figure 13).

The H-bridge implemented for controlling the DC motor is an LMD18200 [5], which is constructed with bipolar circuitry control complementary metal-oxide-semiconductor (CMOS) field-effect devices and a double-diffused metal-oxide-semiconductor (DMOS), and accommodates a peak output up to 6 A (Figure 14).

Feedback should be between 0 and 5 V as it is the voltage that supports the data acquisition card; a tachometer generates voltages from 0 to 12 V. This does not serve as an input to the program, thus it designs and implements an actuator to condition the signal, taking into account that the behavior guarantees a range between 0 and 5 V, which is the optimal voltage for scanning the signal (Figures 15 and 16).

Figure 17 shows the blocks of indicators and controls, such as the while loop; all the blocks work in a continuous cycle. The DAQ Assistant Express VI block communicates with the data acquisition card, the Merge Signals Function is the graphic indicator that shows the sign of the setpoint (red) control signal (green) and engine response (blue), and shift registers and the Feedback Node in loops are used to calculate the change of error. Time Domain Math Express VI is used to perform mathematical operations in time, in this case the change will be integrated with PWM and the output will be obtained from the desired range. The strip path function maintains the file path generated by the designer extension. Simulate Signal Express VI simulates square waves for PWM, the fuzzy logic controller, the controller, and the load fuzzy setpoint [7, 17].

A while loop encloses the set of all blocks, which is responsible for implementing everything inside continuously [18, 19].

Figure 18 is the front panel view, which is where the user runs the program, the results are seen graphically, and the values are obtained after the control action [20, 21].

## 3. Results and discussion

At the time of connecting the entire set of devices such as the engine, transducer, font, procuring card data, and PC, configuration of the H-bridge pins and motor feedback are taken into account. After verifying that the assembly has the correct speed, control is executed in LabVIEW and the system is energized.

Within the controller, a value of 1600 RPM is entered to start the control engine speed, and on the graphic belonging to the GUI LabVIEW variation, PWM is observed in terms of engine speed in RPM. These results can be compared with a classic PID control showing that our fuzzy logic controller meets the design requirements. Achieving error values of 3% is acceptable in a practical manner (Figures 19 and 20).

## 4. Conclusion

The foregoing is accomplished by designing a control system to understand alternative control applications that can used, for example, in an industrial sector. It is noted that fuzzy logic is a fast, solid, and robust control method for a system that is affected by constant instabilities, which in this case could be disturbances affecting a DC motor by applying opposing forces or weights within its axis rotation.

Fuzzy logic is a method of computing based on decision-making and is used for expert systems and process control. Fuzzy logic differs from traditional Boolean logic in that fuzzy logic allows for partial membership in a set. The great advantages and possibilities offered by the LabVIEW software for these applications are also stressed.

To implement real-time decision making or control of a physical system, data acquired by an A/D Converter must be obtained from a fuzzy controller. Which after making the corresponding interpretation of the linguistic rules and the corresponding defusification leaves the diffuse logic controller by means of a D/A Converter with DAQ analog output hardware to implement real-time process control.

## Conflict of interest

The authors declare that there is no conflict of interest regarding the publication of this chapter.

## References

- 1.
Azhmyakov V, Rodriguez Serrezuela R, Ríos Gallardo AM, Gerardo Vargas W. An approximation based approach to optimal control of switched dynamic systems. Mathematical Problems in Engineering. 2014; 2014 - 2.
Rojas JHC, Serrezuela RR, López JAQ, Perdomo KLR. LQR hybrid approach control of a robotic arm two degrees of freedom. International Journal of Applied Engineering Research. 2016; 11 (17):9221-9228 - 3.
Serrezuela RR, Chavarro AFC. Multivariable control alternatives for the prototype tower distillation and evaporation plant. International Journal of Applied Engineering Research. 2016; 11 (8):6039-6043 - 4.
Thepsatorn P, Numsomran A, Tipsuwanporn V, Teanthong T. DC motor speed control using fuzzy logic based on LabVIEW. In: SICE-ICASE 2006 International Joint Conference. IEEE; 2006. pp. 3617-3620 - 5.
Horng JH. SCADA system of DC motor with implementation of fuzzy logic controller on neural network. Advances in Engineering Software. 2002; 33 (6):361-364 - 6.
Deka N, Hazarika PJ. Liquid level control using fuzzy logic in LabVIEW with Arduino. International Journal of Advance Research, Ideas and Innovations in Technology. 2017; 3 (1) - 7.
Ammar HH, Azar AT, Tembi TD, Tony K, Sosa A. Design and implementation of fuzzy PID controller into multi agent smart library system prototype. In: International Conference on Advanced Machine Learning Technologies and Applications. Cham: Springer; 2018. pp. 127-137 - 8.
Martinez DA, Poveda JD, Montenegro D. Li-ion battery management system based in fuzzy logic for improving electric vehicle autonomy. In: 2017 IEEE Workshop on Power Electronics and Power Quality Applications (PEPQA). IEEE; 2017. pp. 1-6 - 9.
Dhimish M, Holmes V, Mehrdadi B, Dales M. Comparing Mamdani Sugeno fuzzy logic and RBF ANN network for PV fault detection. Renewable Energy. 2018; 117 :257-274 - 10.
Yilmaz U, Kircay A, Borekci S. PV system fuzzy logic MPPT method and PI control as a charge controller. Renewable and Sustainable Energy Reviews. 2018; 81 :994-1001 - 11.
Safwat IM, Wu X, Zhao X, Li W. Adaptive fuzzy logic control of boost converter fed by stand-alone PEM fuel cell stack. In: 2017 IEEE Transportation Electrification Conference and Expo, Asia-Pacific (ITEC Asia-Pacific). IEEE; 2017. pp. 1-6 - 12.
Buele J, Espinoza J, Pilatásig M, Silva F, Chuquitarco A, Tigse J, Guerrero L. Interactive system for monitoring and control of a flow station using LabVIEW. In: International Conference on Information Theoretic Security. Cham: Springer; 2018. pp. 583-592 - 13.
Noor IMM, Kamal M. Control of wastewater treatment by using the integration MATLAB and LabVIEW. Pertanika Journal of Science & Technology. 2017; 25 - 14.
Nolasco JJM, Medina JAP. LabVIEW-based classic, fuzzy and neural controllers algorithm design applied to a level control prototype. IEEE Latin America Transactions. 2017; 15 (6):1154-1162 - 15.
Dhimish M, Holmes V, Mehrdadi B, Dales M, Mather P. Photovoltaic fault detection algorithm based on theoretical curves modelling and fuzzy classification system. Energy. 2017; 140 :276-290 - 16.
Oswald R. Fuzzy control of inverted pendulum swing-up and balancing [Doctoral dissertation]. Northridge: California State University; 2017 - 17.
Aroca Trujillo JL, Pérez-Ruiz A, Serrezuela RR, Garavito ECDIJ. Generation and control of basic geometric trajectories for a manipulator robot using CompactRIO. Journal of Robotics. 2017; 3 :1-11 - 18.
Aroca Trujillo JL, Rodríguez Serrezuela R, Ramírez Zarta JB, Navarrete Ramos AM. Direct and inverse kinematics of a manipulator robot of five degrees of freedom implemented in embedded system—CompactRIO. In: Ajaykumar BS, Sarkar D, editors. Advanced Engineering Research and Applications. Nueva Deli, India: Research India Publication; 2018. pp. 405-419 - 19.
Rodríguez Serrezuela R, Aroca Trujillo JL, Navarrete Ramos AM, Ramírez Zarta JB. Applications alternatives of multivariable control in the tower distillation and evaporation plant. In: Ajaykumar BS, Sarkar D, editors. Advanced Engineering Research and Applications. Nueva Deli, India: Research India Publication; 2018. pp. 452-465 - 20.
Serrezuela RR, Cardozo MAT, Chavarro AFC. Design and implementation of a PID fuzzy control for the speed of a DC motor. Journal of Engineering and Applied Sciences. 2017; 12 (8):2655-2660 - 21.
Serrezuela RR, Chavarro AFC, Cardozo MAT, Toquica AL, Martinez LFO. Kinematic modelling of a robotic arm manipulator using Matlab. Journal of Engineering and Applied Sciences. 2017; 12 (7):2037-2045