Designing driving and control circuits of four-phase variable reluctance stepper motor using fuzzy logic control

Precise positioning and repeatability of movement for stepper motors require designing a robust control system. To achieve that, an analytical model of a four-phase variable reluctance stepper motor is presented. A proposed open-loop driving circuit is designed to control the motion of a variable reluctance stepper motor. The driving circuit has an ability to drive the motor into two-step angles, i.e. a full step (15∘)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^{\circ })$$\end{document} and a half step (7.5∘)\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$^{\circ })$$\end{document}. The direction of movement can be either into clockwise or counterclockwise direction. The operation of the variable reluctance stepper motor in an open-loop control circuit has demonstrated disadvantages of an oscillation and a relatively high settling time. Therefore, a closed-loop control circuit has been introduced using fuzzy logic control to overcome the oscillation problem and to obtain on a precise positioning within a reasonable settling time. The fuzzy logic control is used to improve and enhance the behaviour of the step position response based on oscillatory response and hence to reduce the overshoot significantly. The comparisons between the open- and closed-loop circuits are presented to demonstrate the disparity between both control circuits. The simulation results of the open-loop and the closed-loop circuits show that the time responses have been improved using different loads conditions. The simulation experiments are conducted and investigated using MATLAB–SIMULINK software package.


Introduction
Stepper motors have various motion control applications in many systems such as industrial machines and electronics. Nowadays, they are used in a wide variety of applications that require a position driving system including computer peripherals and robotics. There are three main types of stepping motors, i.e. variable reluctance (VR), permanent magnet (PM), and hybrid stepper motors. Generally, stepper motors can be defined as an electro-mechanical device that converts a pattern of inputs and the rate of change of those inputs into a precise rotational motion [1,2]. In the state of the art, many pieces of research have been reported to tackle the positioning control of PM stepper motor [3][4][5][6] and hybrid stepper motors [7,8]. The variable reluctance stepper motors have been around for a long time. Nonetheless, they have not been widely applied into real-world situations that demand a quite precise positioning. One of the major concerns regarding the influence for the response behaviour of the rotor position is the oscillatory response and the high overshoot and undershoot. It can be described as the variation of the rotor response to stationary poles. In fact, the construction of the VR stepper motor is much simpler than other types; hence, the complexity of control circuits can be minimised and cost can be reduced. As a result, a development of the VR stepper motor is needed to cope with the current limitations that imply with the operation of such type of motors.
Practically, a VR stepper motor has a number of functional differences when compared with a PM stepper motor. Because the rotor is not magnetised, it produces less torque rather than a similar sized PM stepper motor. In addition, it has no detent torque when there is no electrical power supply, which can be an advantage or disadvantage depending on required applications. Finally, because of the small step size and reduced detent torque, the VR stepper motor has more of a tendency to overshoot and the destination step might not be reached. The step position response in VR stepper motor demonstrates a poor damping characteristic, which in turn leads to generate a significant overshoot and extended settling time. In addition, resonance phenomenon may occur in such motors. These characteristics disturb the normal operation of the stepper motor under certain conditions in operation. This is a significant disadvantage when it occurs. In particular, if the VR motor is operated in an open-loop circuit. Moreover, in some applications related to a high-speed repetitive motion, it is essential to reduce the overshoot and settling time in order to guarantee that rotor attends a required step. Hence, this would positively increase the speed of the response and enhance the behaviour of the VR stepper motor. Furthermore, it is necessary to diminish significantly the oscillatory response and maintain zero tracking.
Previous studies demonstrated an application of robust nonlinear controller of the VR stepper motor. The control design had shown to be applicable to other motor models wherein the flux linkage was modelled as separable products of functions of the rotor position and winding currents [9]. Recently, many control circuits have been implemented to drive a stepper motor. For example, in reference [10], a driving system was designed for a stepper motor using an AT89C51 microcontroller. This driving system is to drive the stepper motor in an efficient manner so that the user has the provision to select the forward or reverse motions, full or half step, and speed or fixed number of steps of movement. In [11], a driving circuit was implemented using a switch mode H-bridge method to derive a stepper motor. However, the implemented circuit did not consider constructing a mathematical model for a specific type of stepper motors. Hence, it might not guarantee an accurate step response. In [12], an adaptive artificial neural network controller applied on a PM stepper motor for regulating its speed. The dynamic response of the PM stepper motor with the proposed controller was studied during the starting process under the full-load torque and under load disturbance. The stepper motor in an openloop driving circuit presented in a reasonable performance [13].
In the state of the art, a few pieces of research have been introduced based on a fuzzy logic control to achieve an accurate position tracking of stepper motors. For instance, in reference [14], a simple transfer function based on second order was used to achieve the position tracking. Several limitations are observed in that work such as lacking of sequence stepping-based system behaviour. The motor was represented as single-loop electrical circuit. Hence, this does not reflect an accurate representation of the system modelling. In principle, that would be likewise to a direct current (DC) motor. Also, a driving circuit was given to drive the stepper motor based on specific sequences. Similarly, in reference [15], although the application of the fuzzy logic controller was demonstrated. However, some constraints are noticed such as a single step was only conducted without achieving further sequences to mimic the practical performance of stepper motors. In reference [16], another simplification of a stepper motor was conducted. The mathematical model was accomplished using so-called direct-quadrature (DQ) model to analyse a system. A linear representation of the model did not take into consideration the influence of nonlinearity for variables of stepper motor such as self and mutual inductance. Hence, it suffers from lacking of accuracy in a representation of the model.
In this paper, we have introduced a new approach based on a fuzzy logic controller. This controller will be integrated into a proposed open-loop driving circuit and a presented model of the VR stepper motor. Such controller is utilised due to its wide range of applications to control nonlinear systems. By using the FLC, the overshoot will be diminished dramatically and the settling time will be reduced. The contribution can be understood as follows: the mathematical model of the four-phase VR stepper motor is derived and analysed to provide a comprehensive and accurate modelling of the multiple-phase stepper motor. In addition, a thorough and diligent open-loop driving circuit is designed to drive the motion of stepping sequence. Finally, a closed-loop control circuit is proposed based on fuzzy logic controller to overcome the overshoot problem and reduce the settling time of a response. The position responses of the rotor using the open-and closed-loop circuits are conducted based on many operational scenarios. The simulation results are established under different load conditions starting from the no-load to full-load situation using MATLAB software package.
The rest of the paper is structured as follows; Sect. 2 studies the mathematical model of the four-phase VR stepper motor. Section 3 illustrates the design of open-loop driving circuit. The designing of the closed-loop PD fuzzy controller is presented in Sect. 4. The simulation results are reported and explained in Sect. 5. Finally, the conclusion is given in Sect. 6.

Mathematical model of a VR stepper motor
The VR stepper motor is characterised by the fact that there is no permanent magnet either on the rotor or the stator. The rotor carries no windings either. It is of salient pole type and is made entirely of soft iron stampings. The stator carries the windings, and the number of poles on the stator is an even multiple of the number of phases for which the stator windings are wound [17]. The construction of a four-phase VR stepper motor made of eight teeth on the stator and six teeth on the rotor is shown in Fig. 1. In this section, the modelling and analysing of the mathematical model for the VR stepper motor are presented. The aim is to obtain a group of differential equations that represent the dynamic behaviour of the motor under different operating conditions. This model has four input voltages, which are provided from pulses in different sequences, and forms by utilising a driving circuit. The equations are derived after series of calculations for the VR stepper motor given below [18].
The calculation of the step angle 'R' can be conducted using the equation given below: where 'n' represents the number of steps per revolution and can be calculated by the following equation: where N s , number of teeth on the stator, and N r , number of teeth on the rotor. The developed model in this paper has eight teeth on the stator and six teeth on the rotor as shown above. Therefore, the step angle can be calculated using both Eqs. (1) and (2) that will yield '15 • ' step angle. The voltage of each phase of the four-phase VR stepper motor can be written as: The flux linkage of each phase depends on the selfinductance of its phase and mutual inductance with other phases as given below.
Following equations can be derived by substituting the flux linkages from Eq. (4) into (3): Similar statements can be written for the voltages, currents, and so on for the phases B, C, and D.
For the VR stepper motor type, the self and mutual inductances equations can be written as follows: l cd = −10.6 + 11.4 |i c | + |i d | 2 The total developed torque is composed of self and mutual components. Using the same subscript convention as is used for the self and mutual inductances, the total developed torque is written as: The self-torque can be written as: In order to determine the mutual torque, it is necessary to energise two phases together and measure the developed torque as a function of the rotor position for different values of current. These torques can be approximated as given below: The motor developed torque can also be written as: The shaft load can be given by the following equation: where K w , Load torque constant (N ms). The parameters of this motor are given in Table 1.
After deriving and implementing the mathematical model based on SIMULINK, it has been tested manually to verify its response to the given inputs. The next step in this paper is to design and construct a control circuit which is capable of automatically taking the VR stepper motor of reaching the required position. The pipeline of the designed control circuit is given in the next section.

Design an open-loop driving logic circuit
The driving of the four-phase VR stepper motor requires designing a driving logic circuit. The main task of this design is to enable the rotor of the four-phase VR stepper of rotating in both directions clockwise (CW) and counterclockwise (CCW) with two steps: full step (15 • ) and a half step (7.5 • ). The presented driving circuit consists of two inputs and four outputs. The input layer is set by a human user. The output layer is obtained based on the internal interfacing among different components so that the needed phases will be energised. The general construction of proposed logic driving  Fig. 2. It demonstrates that the internal implementation of the driving circuit has three main parts, i.e. a decoding part, an encoding part, and a clocking part.
The angle (A n ) represents the required angular position, and it could take any real number. It is compared with the actual angular position taking into consideration both the magnitude and the direction. By this comparison, the required stepping direction and number of steps will be obtained. A full-step movement can be achieved when a single-phase excitation is used. The clockwise direction happens when the sequence of a single-phase excitation is ABCDA, whereas anticlockwise direction obtains when the sequence of switching ADCBA is applied. Similarly, the full-step movement can also be gained when double-phase excitation is applied. A clockwise stepping occurs when a sequence of AB-BC-CD-DA signals is supplied. Likewise, an anticlockwise stepping can be obtained when a sequence of AD-DC-CB-BA signals provided.
A half-step movement is achieved using both of singlephase and double-phase excitation systems. The sequence of clockwise direction is A-AB-B-BC-C-CD-D-DA-A, and the sequence of anticlockwise direction is A-AD-D-DC-C-CB-B-BA-A. Input (RI 1 ) is to specify that the step angle of the rotor is '7.5 • ' or '15 • ', if 'RI 1 = 0' the motor will rotate in 15 • step angle only. In contrast, it will rotate in '7.5 • ' step angle only if 'RI 1 = 1'. Therefore, we introduced another option which is when 'RI 1 = 2', in this case, the rotor will rotate in any step angle based on the required angle in order to reach the final position as fast as possible. The decoding part is designed using the following truth table given in Table 2.
Using Karnaugh map, the outputs of the decoding parts can be analysed and obtained as in the equations given below. These equations are implemented logically to attain this part.
The encoding part is the final part of the driving circuit. By this part, the four phases of output voltages are generated. The implementation of this part is made by using the truth table given in Table 3. Hence, the output equations of this part will also be obtained logically using Karnaugh map and Boolean algebra.
Single-phase excitation The final part of the driving circuit is the clocking part. It is built based on a SIMULINK model as shown in Fig. 3. It consists of up-counting counter, s-function block, sample and hold circuits (S/H ), and various logic circuits. The upcounting counter has two inputs, i.e. reset and clock. The counter can count from zero up to '126' when the reset input is logic '0' and goes to reset if it is logic '1'. The sample and hold (S/H ) circuit's outputs represent the temporary memory storage that will store the initial and the required angular positions. The s-function block so-called step control is a MATLAB software program. It was coded for calculating the maximum number of steps (M S ), the step angle (R), and the direction of stepping (D).
The input count (C) is used when 'RI 1 ' equals '2' and 'A n ' equals '7.5' or the multiple of '7.5'. This will be utilised to convert the step angle from '15 • ' to '7.5 • ' for the final step of rotation. The maximum step (MS) used to specify the maximum number of steps during the rotation of the rotor. The direction (D) is used to specify the direction of rotation in CW or CCW (if D = 0, the motor will rotate in CW and it will rotate in CCW when D = 1). The resolution indicator 2 (RI 2 ) on the output side of the step control function is employed to specify the step angle of the motor which is either '7.5 • ' or '15 • '. This can be specified when the resolution indicator 1 (RI 1 ) on the input side of the step control function is set to '2'. When the RI 1 = 0, the motor will rotate in '15 • ' step angle, and it will rotate in '7.5 • ' step angle if equals '1' as aforementioned. However, choosing RI 1 = 2 will leave the driving circuit to decide and select which step angle is the best to be used in order to reduce the number of steps to reach a particular destination. Consequently, this will lead to reduce the required time to reach the target angle of the rotor's position. The output (R) For investigation and validation of a full operation for the driving circuit, we introduced four examples of supplied pulses as depicted in Fig. 4 to show the motor input voltages obtained from the driving circuit under different cases. For instance, in Fig. 4a, when phase D winding is energised, the rotor moves to the first '15 • '. When phase D is de-energised and phase C is energised, the motor moves '15 • ' in CW direction. Next, de-energising phase C and energising phase B cause the rotor to move to a further '15 • ' in CW direction. Similarly, in Fig. 4b, when both phase A and phase D are energised at the same time, the rotor will move '7.5 • '. Next, when phase A is de-energised and phase D is energised, the rotor will move '7.5 • ' and so on until reaching the final position. The same rotation will be happening if and only if the same energising principle is applied. Another example is illustrated in Fig. 4c when different sequence of pluses are applied to inputs of the stepper motor. However, these sequences will lead to '15 • ' movement and later on '7.5 • '. This is due to the fact that RI 2 is set to '2' which means both of step angles could be utilised to complete the required angle.

Design closed-loop proportional derivative (PD) fuzzy logic control
The essential elements in designing a fuzzy controller are defining input and output variables, choosing fuzzification and defuzzification methods, and determining the rule base of the controller. Different types of fuzzy controller can be implemented based on problem requirements such as proportional derivative (PD) and proportional derivative integral (PID) fuzzy controller [19]. In the literature survey, the PD fuzzy controller has been used in many real-world industrial applications [20,21]. In this paper, we utilise the PD type due to the fact that the derivative action helps to predict the future error, and the proportional derivative controller uses the derivative action to attenuate oscillations [22]. In PD-like fuzzy controller, the mapping is established between the control action u(t) on one side, the error e(t), and its change e(t); on the other hand, in conventional case: u(t) = f (e(t), e(t)), but in this design the effect of load torque constant (K w ) is added in the structure of PDlike fuzzy controller. Therefore, the mapping now has an additional factor which is the load torque constant (K w ). In the new considered case, the output can be given as: u(t) = f (e(t), e(t), K w ). The rotor position error is used as an input signal to this controller. The output control signal of the FLC is a switching signal that will be supplied to the motor's windings. The block diagram of this fuzzy controller is shown in Fig. 5. In this controller, the Sugeno fuzzy approach is used to obtain a single-tone output. The architecture of the closed-loop PD-like fuzzy controller for VR stepper motor is demonstrated in Fig. 6.  The block diagram of the angle management circuit is introduced in Fig. 7. It is noticeable that the angle management has four inputs, i.e. the direction signal (DS), step angle (R), clock, and rotor angular position (θ). This circuit is used to ensure that the range of the current angle which will be compared with the reference value (15 • ), is always between '0' and '15 • ', because the FLC is designed using this range.
In order to implement the fuzzy controller, several parameters need to be defined such as memberships and rules of the inference engine. In this controller, the number of the inputs is three so it means that different memberships need to be chosen for these inputs. The choice of these memberships is set based on the expected values of the input that the memberships are set for. For instance, we set the error memberships between '−15' to '15' such as Negative (N), Zero (Z), and Positive (P) as this is the maximum and minimum values of the expected error. Also, the positive side of the error has been partitioned into another six small memberships to  Fig. 8.
The rules of inference engine are presented for the error and the load torque constant in Table 4 and for the error and change in error are given in Table 5. The surface views that show the relationships between the inputs and the output are depicted in Fig. 9a, b.

Simulation results
To test the validation of the proposed driving circuit and fuzzy control, many simulation experiments have been carried out. Various step angles have been applied to verify the target reaching of the rotor position. The simulation results were investigated into three different cases of the applied load. In order to obtain an improvement in the step response of the VR stepper motor, i.e. the overshoot and settling time in the position angular response, the simulation results of the closed-loop control circuit are presented. The three case studies are introduced and explained as follows:

Case study I
In this case study, no load was applied on the VR stepper motor. In the simplest case, we tested the rotor response with a '15 • ' step angle to calculate the overshoot and oscillation response in such a case. In fact, the overshoot percentage was greatly high as expected although it takes a short time to diminish. However, this might cause a loss tracking problem in real-world scenarios that require precise position. Figure 10 shows the position angular response of VR stepper motor under no-load condition when ' A n = 15 • ' and 'RI 1 = 0'. It clearly can be seen that the peak and steady state values are '25 • ' and '15 • ', respectively. Therefore, the overshoot percentage can be calculated using the following basic equation; For this experiment, the calculated overshoot is '66.66%' and settling time is '10 ms'. The blue line shows the rotor position response of the closed-loop control circuit under the same conditions. In this case, the peak and steady state values of rotor position response are '16 • ' and '15 • ', respectively. Also, the settling time was reduced to '8 ms'. Again, we can find out how much the overshoot has been improved based on the same Eq. (30) which will be '6.66%'.
The new obtain value demonstrates a significant improvement for the rotor step response using the proposed fuzzy control technique. It can be clearly seen that the overshoot percentage is improved greatly by '60 %' and the settling time is improved by '2 ms'. The obtained results can confirm the rotor reaching to its target without probability of losing the required step angle.
In Fig. 11, the rotor position rotates into CCW direction because the selected rotational angle is '−22.5 • '. To accomplish this response, the first step is '−15 • ' and the second step is '−7.5 • '. The RI 1 equals '2' in this experiment to enable the designed circuit the freedom of choosing the best step angle to reach the destination. In the closed-loop part, it can be clearly noticed that how the rotor response has been improved for both steps as shown below.
Moreover, the rotor response will be tested in case of the required position is ' A n = 37.5'. However, the movement direction will be in CW in this case as shown in Fig. 12. Therefore, the faster way to complete this rotation is to move into two full steps and then a half step. In fact, this is the faster response that can be achieved due to choosing 'RI 1 = 2'. To make the driving circuit more intelligent, we added a privilege of rotation in opposite direction in case the input angle (An) is greater than '180 • ' so that the final position can be reached faster. In Fig. 13, nevertheless, the required angle is '330 • ' in CW direction. However, the rotor will rotate into CCW direction to reach the position because it will take just two steps to reach the same position with '22' steps when it follows the CW direction. Also, the overshoot has been improved significantly using the fuzzy controller as depicted in the blue line.
In the following experiment, we have chosen a value for the angle 'An' which is not multiple of the step angles. Although the chosen value is 'A n = 42 • ', the driving circuit will approximate this angle to the nearest value of the

Case study II
In this case, the half of the load was applied when ' A n = 15 • ' and 'RI 1 = 0'. The rotor angular response has been reduced slightly due to this addition as shown Fig. 15. Also, the closed-loop system responses effectively to the added load. Hence, the overshoot is better compared to the no-(b) (a) Fig. 9 Surface view of the rules of the proposed fuzzy controller for a the error and the load torque constant against the output, b the error and the change of error against the output    load case. From this conducted experiment, the percentage value of the overshoot was 53.3 at the no-load condition and then it became 4.6% after using the fuzzy algorithm. The results show rotor response has been improved further in case of some load existence. In addition, the settling time was improved which has been reduced from '7 ms' to '6 ms'.

Case study III
Finally, in the case study, a full load has been applied to the VR stepper motor. This case allows to verify the tolerance of the response and shows how the rotor step response might be affected. We noticed that in this case the overshoot was reduced slightly compared to the previously conducted experiments. Figure 16 shows that the driving circuit has successfully guided the VR stepper motor to the required position and the step response has been improved successfully when the fuzzy technique is applied. The measured overshoot error is at a minimum which equals to 3.3% in Fig. 16 Angular position response when 'A n = 15 • ' and 'RI 1 = 0' at full load case of using the proposed fuzzy controller. Also, the settling time is minimum and equals to '4 ms'.
The comparison for three load cases is summarised as in Table 6 taking into consideration the overshoot and the settling time in case of the open-loop and closed-loop circuits. The comparison is also depicted graphically to show the difference between each load for the settling time and overshoot as given in Figs. 17 and 18, respectively.

Conclusion
The simulation results have proved successfully that the designed driving logic circuit can effectively control the rotor angular position. In particular, the driving circuit is capable of rotating the rotor in clockwise and anticlockwise directions with two step angles by employing different stepping sequences. It has been observed that the step response of the VR stepper motor suffers markedly from the overshoot and  oscillation. Therefore, the fuzzy control technique is introduced to improve the step position response. In addition, the proposed technique is conducted for the increments of the applied load based on three different conditions, i.e. no-load, half-load, and full-load condition. The overshoot has been greatly reduced to '3.3%', and settling time is minimised to '4 ms' at the full-load condition by using the proposed fuzzy technique. In all experiments, the oscillatory response is diminished significantly so that the resonance phenomenon is eliminated.
In the future work, other soft computing techniques such as neural networks and an adaptive neuro-fuzzy inference system can be introduced to compare the performance of the rotor step response with fuzzy control technique.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecomm ons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.