Disadvantages:


The BLDC motor uses a DC power supply applied by power devices, and the position of the rotor determines its switching sequence. The BLDC motor phase current, which has a rectangular waveform, must be synchronized with the rear counter electromotive force (EMF) to produce a constant torque at a constant speed. Electronic power switches replace the conventional mechanical switch, and the current of the motor windings is supplied depending on the position of the rotor. This type of AC motor is called a brushless DC motor, and its operation is similar to that of conventional DC motors with a switch.

BLDC motors are generally controlled employing three-phase inverters, so it requires a rotor position sensor to control the inverter in order to determine the switching instants and provide an appropriate sequence for switching. The position of the motor in these engines is generally determined by position sensors such as Hall effect sensors, resolvers, and absolute position sensors; otherwise, it must be prepared by estimating the parameters that specify the rotor position using sensorless techniques [44,45].

The driving range for each phase is usually 120 electrical degrees, which is divided into two 60-degree steps. For example, S5-S6, S1-S6, S1-S2, S3-S2, S3-S4, and S5-S4 are six steps of a 360-degree electric cycle. Therefore, only two phases are carried out at a time. The above can be seen graphically in Figure 1.

From the operation of the engine and their elements, the BLDC engine is modeled to simulate its behavior. The brushless motor model implemented in the PSIM simulation environment is shown in Figure 2. This figure shows the three-phase inverter, which has a sensor to monitor the current supplied to the BLDC. It is also possible to see that the BLDC motor is coupled with a sensor for speed reading. This sensor generates the control signal that determines the pulse width of the PWM (Pulse Width Modulation) that activates each of the inverter's drivers, in addition to the necessary switching stage that depends on the state of the Hall effect sensors. This switching allows the three-phase inverter to function normally in addition to preventing a short circuit in any of the three branches.

**Figure 1.** Waveforms of the counter-electric force in 120 electrical degrees.

**Figure 2.** Inverter-BLDC system implemented in PSIM.

#### *2.2. Neuronal Networks*

For artificial intelligence, neural networks are a significant field of application. These are inspired by the interconnections of the cells of the human brain. In addition, they try to simulate the behavior of a biological neural network. Thus, neural networks are usually used to model systems that solve difficult problems through other techniques.

Some examples where artificial neural networks have been used to solve various tasks such as pattern recognition [46], parameter estimation [47], prediction of values [48] and of course in the control of different types of systems [49–51].

In general, a neural network is formed by the next elements:


Usually, the neural networks have several layers composed of a different number of neurons each of them. In general, neural networks are composed of three different layers: input, hidden, and output. The information goes from one layer to another through the transfer functions. The transfer function determines how the information is transmitted between layers. Weights are directly associated with the connection between layers. That is, if a connection has weight with a high value, then it will make more contributions to the network output.

One of the most used neural networks is called multi-layer perceptron, and the best-known training method for this type of network is backpropagation. This algorithm is used more for learning this kind of multi-layer perceptron network. The backpropagation algorithm trains the neural network from sample vectors of the system that are of interest for their modeling, such as the texture of an object or, in our case, the speed of a motor.

Summarizing, the backpropagation training system consists of the following steps:


One of the advantages that backpropagation presents is a speed of convergence and robustness compared to other types of training. For this reason, in this work, a multi-layer perceptron neuronal network has been implemented using backpropagation as a training algorithm. This network was used for speed control of a brushless motor. The architecture of the neural network used for the development of this work has a topology 2:8:1 and uses only two layers. The relation 2:8:1 means that the neural network has an input vector of a size of two elements. This means that every example presented to the neural network only has two elements. The second number 8 belongs to the number of neurons that have the first hidden layer. Finally, number 1 tells us that there is only one neuron in the output layer.

As it is possible to see, the neural network needs only two layers of neurons in order to obtain an excellent performance of the control system proposed. However, just with this configuration, the neural network is capable of learning the vectors related to brushless motor control.

Part of the neural network training will be addressed in the next section.

#### **3. Neural Network Training**

As previously noted, it is necessary to have example vectors related to the problem to be solved by the neural network. These sample vectors must come from real examples of the objects or the system to be modeled. In this case, examples of the motor's response to different applied torques are required.

For this reason, a classical Proportional, Integral, and Derivative (PID) controller has been implemented in order to obtain previous test values to train the proposed network. Figure 3 shows the block diagram of the PID controller used. This figure consists of a DC/AC converter, usually called a voltage inverter. This inverter supplies the three-phase voltages for the BLDC motor. The applied load torque, the sensing of the rotor speed, a reference speed block that will serve for the training of the network, the PID control, and the inverter switching stage determined by the states of the Hall effect sensors are detailed in Figure 2.

From the PID control shown in the diagram in Figure 3, the different values for the input vectors of our neural network are obtained.

**Figure 3.** Block diagram of the PID control used.

Figure 4 shows the training signal made to the BLDC motor with the PID control. This signal must follow the desired reference that starts from scratch and increases its speed smoothly to 750 rpm (revolutions per minute). It is worth mentioning that the value of 750 rpm is the maximum speed that the motor can reach. In the same figure (Figure 4), it is possible to observe the signal resultant, which was obtained with no external load pair applied to the system. For this reason, it will be mentioned as a zero pair in future mentions of it. In order to have greater control over the gains of the PID controller, they were chosen heuristically. Hence, the chosen earnings were 5, 0.001, and 0.0001 for *Kp*, *Ki*, and *Kd*, respectively. From this test, pairs of velocity values (*ω*) and the control signal (*u*) necessary to reach the velocity values for each pair (*<sup>ω</sup>*, *u*) are taken. These values are sampled every 40 rpm; therefore, 600 input vectors will be used as examples for the neural network. These values will serve to train our neural network so that it is capable of controlling the motor with zero torque.

Figure 5 graphically shows the 22 values obtained from the zero torque PID control tests that will be used to train the neural network. It is worth mentioning that, within the sample pairs used, the minimum and maximum values are included, which are 0 and 800 rpm, respectively.

Obtaining the previous values, as can be seen in the previous paragraphs, is only to train the neural network when the motor does not have an applied load, that is, when the torque is zero. Therefore, to determine the behavior of the network when a non-zero torque is applied, it is necessary to train the network with different load values.

As it was required to have the performance of the neural network in a range of 0 to 1 Nm, it was considered to train the network with load pairs applied in the said range in increments of 0.25 Nm.

To obtain the input vectors for each of the different load pairs to be learned by the network, the same procedure is performed as for obtaining the vectors with zero torque. Obviously, this time the network is trained with the desired speed values, control signal, and applied torque (*<sup>ω</sup>*, *u*, *τ*) for each applied torque from 0 to 1 Nm in increments of 0.25 Nm.

Some values obtained for each of the different applied load pairs (*τ*) are observed in Figure 6. These values are used to train the network that can control the BLDC system when any load pair is applied.

This will allow the neural network to have a dynamic performance when applying a load in the range of 0 to 1 Nm. Although the network will train only with well-defined load values every 0.25 Nm, it will be able to infer the performance that it should have in the desired speed values that were never presented to the system.

**Figure 4.** Training signal without torque load applied.

**Figure 5.** Values obtained from the PID controller (*τ* = <sup>0</sup>).

**Figure 6.** Training values obtained from PID control with different loads applied.

Like any control system, it is necessary to determine the parameters with which the controller will work. Unlike a PID controller, a neural network does not require that these values be modified every time any element of the system changes. This is another advantage of using a neural network compared to classical control methods. This is because the network adapts to resolve cases that were not presented during training. It should be mentioned that this only happens within the logical ranges of the expected behavior of the system.

In this case, the parameters of the neural network and its training are presented in Table 1.

Some observations regarding the values shown in Table 1. First, it will be mentioned that, although the neural network training indeed used the backpropagation algorithm, this algorithm has four variants. These variants are listed below:



**Table 1.** Neural network parameters.

Being the Levenberg–Marquardt algorithm, the backpropagation variant with which, generally, better performance is obtained in the tasks assigned to the neural network. For this reason, in this

implementation, it was decided to use this variant. Although this variant indeed has the highest computational cost, it is compensated by the excellent performance it offers.

Another observation regards the number of epochs that were specified as the maximum value in this implementation. In general, for a neural network to converge towards the optimal values of the weights, 1000 to 10,000 epochs are required. For this reason, this parameter began to carry out tests from 5000 epochs. However, in the different experiments made, it was observed that the neural network had a convergence in a range of 18 to 50 epochs. The last-mentioned means that training does not take a long time of 50 epoch to obtain a result. Then, this parameter was established in 50 as a maximum value that training needed to reach the optimal values of the weights.

The above is due in part to three main things. One of them is the use of the Levenberg–Marquardt algorithm for training, which has a faster convergence towards the optimal values of the network weights even if it requires more processing to ge<sup>t</sup> convergence of the network. The other is the number of network layers, which, in our case, only have the input and output layers.

Finally, the number of neurons is mentioned; in our implementation, only nine neurons are necessary. Eight of these neurons are in the input layer, while the output layer only has one neuron.

It is important to emphasize that our implementation occupies few neurons, as previously mentioned. This is a feature that will allow us to implement this controller quickly and efficiently in an embedded system, such as an FPGA [52]. It would even be possible to implement it on a lower-performance device such as an Arduino. The above would give portability to this controller, thus obtaining a lower-cost hardware implementation.

Once the implementation of the brushless motor controller through neural networks is presented, the results obtained are shown. Therefore, in the following section, both the tests performed and the results obtained from this implementation will be presented.

## **4. Results**

This section presents the different tests carried out on the implementation of the control performed with the neural network as well as the comparison against the control carried out by the PID. It will begin with the performance of the control performed by the neural network when there is no load applied to the plant.

The different tests and results were developed using the Matlab/Simulink-PSIM package. For this, the BLDC model SG/F14 Gearless motor parameters were used. Parameters mentioned were obtained by characterizing it and used in the PSIM simulation environment. These values are shown in Table 2.



Figure 7 shows the block diagram of the plant which is made up of the following elements:


**Figure 7.** Configuration diagram for the BLDC system.

On the other hand, Figure 8 shows the diagram of the implementation of the neural network made in Matlab/Simulink. In this diagram, the stage that defines the desired path, the applied load torque, as well as the implemented neural network and the BLDC motor system can be seen, shown above in Figure 2.

It will start with the performance of the control performed by the neural network when there is no load applied to the plant. The behavior of the trained network can be seen in Figure 9. In this test, the neural network is subjected to following a desired speed reference path from zero to 650 rpm. It should be mentioned that this was not a network training value. However, the fact of training without a load applied to the plant was to have a reference value for later comparison with variable load.

**Figure 8.** Implementation of the Matlab/Simulink-PSIM simulation system.

**Figure 9.** Speed response of the neural network and the PID with no load applied to the plant.

Furthermore, in this same figure, it can be observed the comparison of the control signals of both the network and the PID control. This comparison shows that both velocity signals are very similar, but the neural network remains around the desired reference. With this, it is shown that the scheme of the proposed network is functional.

The behavior of the implemented neural network control signals compared to that of the PID is shown in Figure 10. In this figure, it can be seen that the two responses to the desired velocity values are very similar.

**Figure 10.** Control signals, speed, and current error on the controller CD bus with the neural network and with the PID.

In the same Figure 10, a satisfactory behavior of the neural network is observed both in the speed error obtained and the current required by the inverter. Analyzing the system error and leaving aside the part of the transient. In this case, it can be seen that the neural network has a much smaller error than that obtained by the controller through the PID; furthermore, the neural network is maintained around the desired reference.

On the side of the current required by the inverse, it can be seen that the one required with the control of the neural network is more stable and constant, unlike the requirement of the PID.

With the finality of extending these results, a test was also performed with a constant load torque applied to the BLDC motor and variable load torques.

Having seen the performance of the systems under conditions known, as are the values close to those of neural network training, it was proceeded to evaluate the system control with values different from these. In this test, the system was subjected to a load torque. The applied load was 0.3 Nm at *t* = 2.5 s.

Under these characteristics, Figure 11 shows the speed monitoring from a speed of 0 rpm to 650 rpm. In this figure, it is possible to emphasize that the neural network is capable of compensating the speed response to this applied load torque. It should be noted that this applied torque was not used for network training.

**Figure 11.** Speed response of the neural network and the PID to two applied load changes.

Although the neural network indeed maintains an error with respect to the reference value, especially after the application of the load, it can be seen that the response of the network is smoother and without transients that could affect the performance of the plant as with the PID response.

Continuing with the analysis of this test, Figure 12 shows the control output of the neural network, which minimizes the speed error. Here, we also observe the comparison of the current consumed by the inverter for both the grid and the PID.

**Figure 12.** Control signals, speed, and current error on the CD bus for the neural network and the PID.

An important point that should be mentioned is that, in this implementation of the control by the neural network, the output speed of the system is not given as feedback. Therefore, this neural network control can be considered as a sensorless type system. The latter is due to it not being necessary to measure the speed for the system to work acceptably, with the inclusion of a system that does not require excessive computational load, and that does not use a sensor to measure speed. This allows us to make the implementation less expensive, mainly in computational terms. Therefore, the use of a neural network for the control of this type of motors is a highly recommended element to carry out the control.

Finally, a test was performed where the system was subjected to the same desired speed path as the previous tests. However, to carry out this test, the system was subjected to a variable load torque. This torque load varied from 0 to 0.7 Nm in an irregular way and can be seen in the lower part of Figure 13.

**Figure 13.** Speed response of the neural network and the PID by applying a variable load over time.

This experiment gave us an interesting result and is the one presented in Figure 13. In this figure, it is observed that, despite the variable load torque, the system implemented with the neural network is capable of responding to this load variation. However, the PID controller fails to respond to these load variations adequately.

The reason the PID is unable to respond to changes in applied load variation is that the PID control signal becomes saturated and prevents it from reacting adequately to variable torque changes.

Another important point to highlight in this test is that the error generated by the neural network is less and closer to the value of zero than that obtained by the PID. This can be seen in Figure 14.

**Figure 14.** Speed response of the neural network and the PID by applying a variable load over time.

## *Controller Performance*

Sometimes, it could be challenging to follow the graphics where the results are shown. The graphics are indeed a better way to present information but tiny, and essential details, are possibly not highlighted.

For this reason, in this section, some specific parameters like the controller performance, the power consumption, and the mean square error will be presented to give another point of view of the advantages in the approach presented in this work.

Some notes about the tables are next. The test marked as "No-load applied" belongs to the experiment shown in Figures 9 and 10, while the legend "Constant load applied" is for the results in Figures 11 and 12. The results presented in Figures 13 and 14 are labeled as "Variable load applied."

Beginning with our explanation, Table 3 shows the performance developed by each controller. Here, it is possible to see the different tests done and the performance obtained in every case. In this Table 3, it is easy to observe that the performance carried out by the two controllers is so close. However, the controller implemented through neural networks is robust since its performance, in the three cases, is around 99%. Meanwhile that made by the PID begins to show a dispersion when the load is applied to the motor varies.



Concerning the mean square error, similar behavior is observed. In this case, Table 4 shows the way that the error grows for the two controllers as the load applied to the BLDC motor varies. From the results presented in Table 4, it is evident that the values shown are high. This is due to the oscillations generated by the controllers when trying to follow the desired speed. Even so, the fact that the controller made by the neural network has a tendency to be more close to the desired value must be highlighted since the mean square error values in all three cases are lower than in the PID controller.


**Table 4.** Mean square error for the controller implemented.

Finally, Table 5 exhibits the values corresponding to the average power consumption for each controller in the different tests carried out. As a reference value, the BDLC motor used for the experiments in this work can deliver a maximal power of 50 Watts. Thus, the values that are shown in Table 5 tell us that the PID controller wears more power than the one made using the neural network. In the test with a no-load applied, the power consumption in both controllers has almost the same value for both PID and Neural network controllers with just a minimal variation of 0.0529 Watts. In the other two tests, the power that is expended by the PID controller begins to grow; meanwhile, the power expended by the neural network maintains stable growth without significant variations. Here, again, the neural network controller is better than the PID controller.

**Table 5.** Average power consumption


## **5. Discussion**

In order to clarify some points about the results obtained, a discussion will be presented in this section.

One of the considerations that it is necessary to comment on is the fact that, when a BLCD motor does not have Hall sensor, the counter electromotive force detection methods are commonly used to know the position of the motor at all times.

However, when the BLCD is fixed, no counter electromotive force is generated; therefore, there is no information on the position of the stator and rotor. The above mentioned is why motor starting methods are used, such as starting the motor in an open-loop configuration by activating the coils in a predetermined sequence. Now, when using Hall sensors, the use of digital tachometers based on the time of the rising edge of one of the Hall sensors or use of external sensors dedicated to speed reading, such as encoders or resolvers, solves the problem of starting and running the engine at low speeds.

Therefore, this work addresses the use of Hall sensors to control switching by varying the PWM output signals that go to the driver (see Figures 3 and 7).

Another consideration is that the term sensorless refers to the fact that, in this approach, no external sensor or digital tachometers are used; that is, the proposed system only makes use of the desired speed and applied torque.

The next point to take into account is the expected performance of the control implemented using neural networks. It is evident that there will almost always be differences between real models and those used experimentally on simulations.

Independently of the method used to simulate a system like that shown in this work, it is almost certainly necessary to make adjustments in the real implementation. For this reason, the logical step to develop is to retrain the neural network. However, some points must be taken into account. First, the fact of the vectors for training the neural network to develop the proposed control were obtained from the real parameters of the BLDC motor target in this work. The above gives us an idea of the behavior of the real from the simulation tests. The physical parameters and variation due to wear are indeed an essential variable in the real motor. This is going to have a direct impact on the BLDC motor performance. However, the behavior of the real is expected to be closely similar to simulation. From the experience of when other control approaches have been applied, similar results have been obtained both in simulation and in the real system, especially in terms of the speed and current values obtained.

However, the behavior of the real and simulation tests is expected to be very similar since different control approaches have been applied, obtaining similar simulation and real results in terms of speed and current.

Finally, one last question arises: what if the BLDC motor changes? Here, the expected response of the neural network will be close to the training done. This means that the neural network will be able to always control the motor, and the parameters of the BLDC motor are near the value used to train in our work. The above mentioned is due to the ability of the neural networks to generalize information from data learning. It is an advantage of the neural networks facing other methods like PID, since the neural network will only need to be trained if the parameters of the motor to be controlled are very different. While a PID is just one variable changes slightly, the system needs to be tuned again.

## **6. Conclusions**

In this work, an implementation of the speed control of a BLDC motor using a multi-layer perceptron type neural network was presented. From the tests carried out in this article, it was observed that the control implemented from the proposed neural network scheme is efficient, and satisfactory results similar to those presented by a PID in the presence of constant load pairs are obtained.

According to the results obtained in the different tests and experiments carried out in our implementation, it was evident that the neural network is superior to a PID control. This is because, in most real applications, it is difficult to find a constant load torque; therefore, the use of a PID control

may not be appropriate for a system. This is highlighted by the fact that the PID control is not capable of supporting variable load changes. At this point, the neural network was superior since it is capable of supporting torque changes without the need for a speed sensor.

Finally, it is noted that the implementation of the neural network is computationally less expensive since it only needs nine neurons distributed in two layers. This will allow the future implementation of this control in embedded hardware.

Among the perspectives considered for the continuation of this work, just two of them will be mentioned—first, to implement this controller in an embedded system to validate its performance in a real system. Secondly, the improvement-oriented towards obtaining a system that does not depend on any sensor in which the neural network functions as the observers required for motor control.

For the above, the problem of starting the BLCD motor must be considered because, as it does not have any sensor, the observers will not give results at speeds close to zero, therefore it implies a greater challenge.

**Author Contributions:** Investigation, writing—original draft preparation, software, and validation, O.-D.R.-C.; Conceptualization, Project administration, and writing—review and editing, F.T.-R. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Conflicts of Interest:** The authors declare no conflict of interest.
