Article FPGA-Based Hybrid Stepper System Design by Variable Structure Control

Chiu-Keng Lai *, Bo-Wei Lin, Hsiang-Yueh Lai and Guan-You Chen

Department of Electrical Engineering, National Chin-Yi University of Technology, Taiping Dist., Taichung 411030, Taiwan; [email protected] (B.-W.L.); [email protected] (H.-Y.L.); [email protected] (G.-Y.C.) * Correspondence: [email protected]; Tel.: +886-4-2392-4505 (ext. 7216); Fax: +886-4-2392-4419

Abstract: A stepper motor is usually operated in position open-loop control for simplicity. However, in order to improve the transient and steady-state performances of the stepper motor-based drive system, a high performance stepper motor drive system is usually designed to feed the encoder signal back to form a closed-loop system such as a general servo motor drive, and high-performance position and speed loop controller can then be used to overcome the nonlinear characteristics of the motor, such as the cogging force and impacts from external load. On the other hand, the existed cogging force of the hybrid stepper motor must be solved to increase the positioning precision. The variable structure control (VSC) is insensitive to the bounded uncertainty and load disturbance, and has been known as a high-performance controller. A predefined sliding surface is used to shape the system performances, and incorporate with switching control to achieve the robustness property. Thus, we applied the VSC to implement the stepper motor drive system about the position and speed control, and the switching control is used to overcome the cogging force. The field programmable

 gate array (FPGA) is a good alternative to be used to realize a motor drive system by considering its  programmable ability and diverse designing environment. It is easily developed as an intellectual

Citation: Lai, C.-K.; Lin, B.-W.; Lai, property (IP) for future use or combined as a part of a large control system. This paper showed the H.-Y.; Chen, G.-Y. FPGA-Based procedures to develop the hardware circuits for the variable structure controller, and applied it to Hybrid Stepper Motor Drive System stepper motor position and velocity control. Functions such as PI controllers, dq-axis transformation Design by Variable Structure Control. and two-phase space vector space vector modulation (SVPWM) designed for the stepper motor Actuators 2021, 10, 113. https:// drives are also shown in the paper. The system simulation and hardware circuit realization are based doi.org/10.3390/act10060113 on MATLAB/Simulink, and realized on Altera FPGA. Simulations on MATLAB/Simulink with trapezoidal velocity profile command, and experiments with and without the load added are shown Academic Editor: Gianluca Rizzello to demonstrate the hardware performances and correctness.

Received: 18 April 2021 Keywords: hybrid stepper motor; variable structure control; FPGA; position control; speed control Accepted: 25 May 2021 Published: 28 May 2021

Publisher’s Note: MDPI stays neutral 1. Introduction with regard to jurisdictional claims in published maps and institutional affil- Considering the advantages of low cost, high precision, and high torque output, iations. stepper motors are frequently used in the field of high-precision control. Traditional open- loop control can lead to momentary step loss or position error when the load changes. As a result, the stepper motor drive system for position and speed control loops has been gradually enhanced as a closed-loop control [1–5]. In Ref. [1], PI controllers are applied for the current and speed closed-loop control, and P control for the position control loop. Copyright: © 2021 by the authors. Licensee MDPI, Basel, Switzerland. For Ref. [2], the closed-loop control structure and PI controllers with motor parameter This article is an open access article identification are applied to the current and position control of a two-phase bipolar hybrid distributed under the terms and stepper motor. Furthermore, feedforward compensation is used for the damping control conditions of the Creative Commons such that the motor can be operated at a high speed range. The authors of Ref. [3] adopted Attribution (CC BY) license (https:// the fuzzy-sliding mode observer to estimate the motor velocity and fed it back as a speed creativecommons.org/licenses/by/ closed-loop system. In that system, PI controllers are used for the stationary A–B phase 4.0/). current control. In Ref. [4], the authors proposed a wide speed range closed-loop-control

Actuators 2021, 10, 113. https://doi.org/10.3390/act10060113 https://www.mdpi.com/journal/actuators Actuators 2021, 10, 113 2 of 18

drive system, and implemented by a field programmable gate array (FPGA) chip. For low-speed operation, the speed control loop is bypassed, and for the high-speed operation, the field-weaken is used to reach the desired performance. Regarding Ref. [5], it proposed a simple torque control method with shaft-position feedback to correct the load angle, and was also realized by FPGA. In Ref. [6], the PID controller and feedforward control are applied to the stepper motor current control to guarantee the desired current response. For most of the AC motor drive systems, such as (IM) and permanent (PMSM)-based systems, vector control is widely used. For such systems, a three-phase modulator is usually used to generate the desired d-axis and q-axis . Clarke and inverse Clarke matrices are used for the transformation between the three-phase and two-phase systems. For a two-phase hybrid stepper motor, it only needs a two-axis modulator mainly made by two H-bridge inverters to convert the DC bus into a pair of quadrature voltages for the two coils. Thus, the stepper motor drive system can be operated without executing the conversion of a three-phase stationary (a-b-c) coordinate system into two-phase stationary (α, β) coordinate system. Regarding the vector control for the stepper motor drive system, for the implementation of the vector control in the stepper motor, only Park and inverse Park matrices are required. The cogging force of the hybrid stepper motor affects the accuracy of positioning. Moreover, for the vector control protocol, the coordinate transformation requires the position feedback to convert the stationary αβ-axis signals into synchronous rotary dq-axis signals. For a closed-loop stepper motor drive system, a high-precision incremental encoder can be used to improve the positioning accuracy. However, the coordinate transformation performs the sin/cos calculation. This requires the position feedback, and the resolution of the sin/cos table holds the precision of the transformation. Additionally, a high-resolution position feedback by incremental encoder is hard to produce the same resolution of voltage generation because of the precision limitations of the space vector pulse width modulation (SVPWM) hardware system, and that leads the current control to not be as precise as the position control loop. As a result, a high-performance variable structure controller is used to improve the positioning accuracy regarding the existence of the problems mentioned above. The variable structure control (VSC) has the advantages of insensitivity to parameter changes, external interference suppression and fast dynamic response [7]. The VSC or sliding mode control (SMC) has been widely applied to single-motor drive design [8–10], or designed for a system such as Ref. [11] which is applied to the balance control of a two-wheel vehicle system. For systems controlled by VSC, some steps are included into the design procedure. First, a mathematic model for the control system is presented. Second, a sliding surface or switching surface which dynamics is equivalent to the desired system performances is made. Third, a control law to guarantee the existence of the sliding mode is made. Sometimes, a VSC system exists in the reaching phase and sliding phase, and the system performance is guaranteed on its sliding phase but not on its reaching phase [7,8]. Furthermore, finding an easy way to shape the desired system dynamics is also important for VSC systems. Thus, for the proposed algorithm, the design procedure of a stepper motor drive system is demonstrated step by step. The controlled system is first represented into state space form, and the linear state feedback control method is applied to find the desired system dynamics and switching surface. Finally, a control law which combines the linear control and VSC is designed to make the sliding condition occur. Hardware circuits realized by field programmable gate array (FPGA) have the benefit of fast prototyping with digital structure, verified with ease. In addition to associating with some of the high-level programming languages, such as C/C++ or MATLAB/Simulink, con- trol systems designed and represented by hardware description language (HDL) are easily achieved. Furthermore, owing to the development of high-density and high-performance FPGA [12–14], hardware controllers implemented by FPGA are widely obtained. Some examples include the design of velocity estimation [15], virtual anemometer [16], PID con- troller [17] and fuzzy controller [18]. FPGA is also suitable for the control system realization of power electronic circuits [19]. In this paper, we first constructed the mathematical model Actuators 2021, 10, x FOR PEER REVIEW 3 of 19

high-performance FPGA [12–14], hardware controllers implemented by FPGA are widely obtained. Some examples include the design of velocity estimation [15], virtual anemom- eter [16], PID controller [17] and fuzzy controller [18]. FPGA is also suitable for the control Actuators 2021, 10, 113 system realization of power electronic circuits [19]. In this paper, we first constructed3 of 18the mathematical model of a hybrid stepper motor and its drive control system in Simulink [4,9]. Next, the models of the controllers were then digitized to be converted into Verilog HDL codes to meet the requirements of hardware design resources. Finally, the designed of a hybrid stepper motor and its drive control system in Simulink [4,9]. Next, the models hardware circuit was used to implement the position, speed and current control to illus- of the controllers were then digitized to be converted into Verilog HDL codes to meet the trate the correctness of the hardware circuit design and the performance of the variable requirements of hardware design resources. Finally, the designed hardware circuit was structure controller. The performances are mainly demonstrated by a 4-ch digital oscillo- used to implement the position, speed and current control to illustrate the correctness of scope with logical input. The main contributions of the proposed model are based on the the hardware circuit design and the performance of the variable structure controller. The state space motor model to the position and speed control, and the applied variable struc- performances are mainly demonstrated by a 4-ch digital oscilloscope with logical input. ture controller reaching the desired position and speed performance. The current loop is The main contributions of the proposed model are based on the state space motor model to based on a two-phase vector control strategy where the d- and q-axis loops are controlled the position and speed control, and the applied variable structure controller reaching the desiredseparately. position The anddesigned speed system performance. was successf The currentully implemented loop is based on on FPGA a two-phase and evaluated vector controlby hybrid strategy stepper where motor the control d- and platform. q-axis loops are controlled separately. The designed systemThe was further successfully contents implemented of the paper on are FPGA as follows: and evaluated in Section by hybrid2, the modeling stepper motor of the controlhybrid platform. stepper motor is shown, and the variable structure controller for position/speed controlThe is further introduced. contents Section of the 3 gives paper the are posi astion follows: variable in Section structure2, the controller modeling design. of the The hybridsimulations stepper on motor MATLAB/Simulink is shown, and theplatform variable of the structure proposed controller are given for position/speedin Section 4. The controlexperimental is introduced. setup and Section results3 givesare shown the position in Section variable 5. Finally, structure Section controller 6 contains design. the con- Theclusions. simulations on MATLAB/Simulink platform of the proposed are given in Section4. The experimental setup and results are shown in Section5. Finally, Section6 contains the conclusions.2. The Modeling of Two-Phase Hybrid Stepper Motor and Variable Structure Control 2.1. Mathematic Model of Two-Axis Hybrid Stepper Motor 2. The Modeling of Two-Phase Hybrid Stepper Motor and Variable Structure Control The electrical circuit equivalent for the two-phase hybrid stepper motor is: 2.1. Mathematic Model of Two-Axis Hybrid Stepper Motor The electrical circuit equivalent for thedi two-phase hybrid stepper motor is: v = Ri + L a − K ω sin(N θ ) (1) a a dt e m r m di v = Ri + L a − K ω sin(N θ ) (1) a a dt e m r m = + dib + ω θ vb Rib L Ke m cos(Nr m) (2) di dt v = Ri + L b + K ω cos(N θ ) (2) b b dt e m r m where va is the voltage of the coil a, vb is the voltage of the coil b, ia is the current of where va is the voltage of the coil a, vb is the voltage of the coil b, ia is the current of the the coil a, ib is the current of the coil b, R is the coil resistance, L is the coil inductance, coil a, ib is the current of the coil b, R is the coil resistance, L is the coil inductance, Ke is ω theKe motor is the back-EMF motor back-EMF constant, constant,ωm is the mechanicalm is the mechanical speed of the speed motor, of theNr is motor, the number N r is θ ofthe number teeth, of and rotorθm teeth,is the rotorand position.m is the Therotor equivalent position. The circuit equivalent of the two-phase circuit of hybridthe two- stepperphase hybrid motor isstepper shown motor in Figure is shown1. in Figure 1.

R L + ia ω θ va Ke m sin(Nr m) −

R L + ib ω θ vb Ke m cos(Nr m) −

FigureFigure 1. 1.The The equivalent equivalent stator stator circuit circuit of of two-phase two-phase hybrid hybrid stepper stepper motor. motor.

The generated torque output without considering the component of is:

Te = Km[−ia sin(Nrθm) + ib cos(Nrθm)] − Fc sin(4Nrθm) 0 (3) = Te − Fc sin(4Nrθm) Actuators 2021, 10, 113 4 of 18

0 where Km is the motor torque constant, Fc is the cogging force constant, and Te is defined as:

0 Te = Km[−ia sin(Nrθm) + ib cos(Nrθm)], (4)

which is the generated torque by the stator coil currents, ia and ib. The mechanical dynamic equation is: dωm 1 0 = (−Bmωm − TL + T − Fc sin(4Nrθm)) dt Jm e (5) = 1 (−B ω − T0 + T0) Jm m m L e

where Jm is the inertia of the motor, Bm is the viscous friction coefficient of the motor, TL is 0 the load torque, and TL = TL + Fc sin(4Nrθm) is the lumped total load for the dynamical control system. To construct the mathematical model of the hybrid stepper motor with MATLAB/ Simulink, Equations (1) and (2) can be rewritten as:

d R K v i = − i + e ω sin(N θ ) + a (6) dt a L a L m r m L d R K v i = − i − e ω cos(N θ ) + b (7) dt b L b L m r m L From Equations (4)–(7), the built models by MATLAB/Simulink are shown in Figure2 , where the blocks “Ia” and “Ib” are equivalent to Equations (6) and (7); cos_sin block is Actuators 2021, 10, x FOR PEER REVIEW 5 of 19 used to generate the sine and cosine functions, and the blocks “Te” and “Wm” are used to realize Equations (4) and (5).

FigureFigure 2. 2. TheThe complete complete stepper stepper motor motor module. module.

2.2.2.2. Variable Variable Structure Structure Control Control InIn the the following, following, the the variable variable structure structure controller controller will will be be used used as as the the main main controller controller forfor the the position position and and speed speed control. control. AA single-input single-input linear linear system system under under nominal nominal condition condition is is expressed expressed in in a a controlled canonical form as: canonical form as: . x = Ax + bu, (8) where x is the system state, u is the scalarx = Ax control+bu , input, and A and b are with the(8) ap- propriate range matrices. The control law u by variable structure system can be divided where x is the system state, u is the scalar control input, and A and b are with the appropriate range matrices. The control law u by variable structure system can be di- vided into two parts: the linear part uL and the VSC part uVSC . First, let the nominal system be under linear state feedback control; we can easily have the control gain, kT to complete the feedback control.

= − T T = uL k x, k [k1, k2, , kn ] (9)

Some techniques such as the pole placement or linear quadratic method can be used to determine the value of k . Under the condition of a closed loop control, from [7], (8) can be expressed as:

= − T = x [A bk ]x Acx (10)

Next, the sliding surface of the variable structure controller is defined as:

σ = T − − T t τ τ (x, t) c [x x 0 ] c Ac 0 x( )d , (11)

and c is a constant vector.

For the closed-loop system (10) under nominal conditions, for any initial value x0 , σ (x, t) = 0 for t ≥ 0 ; i.e., the system states are initially on the sliding surface and will stay

Actuators 2021, 10, 113 5 of 18

into two parts: the linear part uL and the VSC part uVSC. First, let the nominal system be under linear state feedback control; we can easily have the control gain, kT to complete the feedback control. T T uL = −k x, k = [k1, k2, ··· , kn] (9) Some techniques such as the pole placement or linear quadratic method can be used to determine the value of k. Under the condition of a closed loop control, from [7], (8) can be expressed as: . T x = [A − bk ]x = Acx (10) Next, the sliding surface of the variable structure controller is defined as:

Z t T T σ(x, t) = c [x − x0] − c Ac x(τ)dτ, (11) 0 and c is a constant vector. For the closed-loop system (10) under nominal conditions, for any initial value x0, σ(x, t) = 0 for t ≥ 0; i.e., the system states are initially on the sliding surface and will stay on it for all the next proceeding time. However, for a perturbed system, the linear control element (9) may not make the sliding condition exist. We require additional control to make and keep the states on the sliding surface. The additional control law is defined as:

uVSC = −qsgn(σ) (12)

where sgn(·) is the sign function, and q is a positive scalar constant. Then, the combined control law for the designed system is:

T u = uL + uVSC = −k x − qsgn(σ) (13)

To determine the quantity of q, it must be chosen to satisfy the sliding condition,

. σσ < 0 (14)

Thus, the desired closed-loop dynamics for the perturbed system can be obtained even though the perturbations exist.

3. Position Control by State Feedback and Variable Structure Control The vector control methodology is used for the motor drive system design, the Park transformations between the stationary reference frame to synchronous rotation reference frame for winding voltages and currents are, respectively, defined by:

 v   cos(N θ) sin(N θ)  v  d = r r a (15) vq − sin(Nrθ) cos(Nrθ) vb

and  i   cos(N θ) sin(N θ)  i  d = r r a (16) iq − sin(Nrθ) cos(Nrθ) ib

where vd, vq, id and iq are direct voltage, quadrature voltage, , and quadrature current in synchronous rotation reference frame. Applying Park transformation to the state-space equation yields new state-space equation as follows:

d 1 i = (v − Ri + N Lω i ) (17) dt d L d d r m q d 1 i = (v − Ri − N Lω i − K ω ) (18) dt q L q q r m d e m Actuators 2021, 10, 113 6 of 18

With the vector control assumed, the instant motor generated torque by stator coil current can be expressed as: 0 Te = Kmiq (19) Applying the state feedback position controller design, the system model is first described in the state variable form, as shown in (20):

" . #      θm 0 1 θm 0 0 0 . = + (Te − TL) (20) ωm 0 −Bm/Jm ωm 1/Jm

For a desired rotor position θd, we first define two new variables, z1 and z2 as:

 z = θ − θ 1 m d , (21) z2 = ωm

where z1 is the position error, and z2 is its derivative. Substituting (19) and (21) into (20), the dynamic error equation for position control can be obtained as (22):  .         z1 0 1 z1 0 0 0 . = + iq − TL, (22) z2 0 −a z2 b 1/Jm

where a = Bm/Jm and b = Km/Jm, the matrix A and vector b of (8) are:

 0 1   0  A = , b = (23) 0 −a b

The pole placement method is used to design the position control system characteris- tics. At first, we do not have to consider the uncertainty and interference. The feedback gain k of (9) is selected for the nominal condition system. The desired system characteristic equation is shown in (24), 2 s + (a + bk2)s + bk1 = 0 (24) where a and b are defined in (23), in which case the poles of the system are located at: q 2 −(a + bk2) ± (a + bk2) − 4bk1 s = (25) 1,2 2

At first, by appropriately selecting k1 and k2 in (24) to meet the requirements, such as the damping ratio, ξ, and rise time, tr [20]. Second, the sliding surface can be yielded by Equation (11). The matrix Ac in (11) is the equivalent system matrix under linear state feedback control gain k. The constant vector cT can be simply determined by choosing cTb = 1. Since the matrix b of the two-phase hybrid stepper motor system is bT =  0 b , c can thus be set as: cT =  0 1/b  (26) The VSC compensation part, −qsgn(σ), is used to overcome the parameters’ uncer- tainties and external interferences, including the load and cogging torque. For a motor position control system, the form of the total disturbance p is pT =  0 p , so the value of q should be set to satisfy the requirement:

q > |p|max (27)

where |p|max is the upper bound of total perturbation. Note that, with the constraint of (27), the designed system is stable and robust to a bounded uncertainty and load.

4. Computer Simulation and Results Simulations are based on MATLAB/Simulink platform to verify the system per- formance. The parameters of the two-phase hybrid stepper motor used in the simula- Actuators 2021, 10, 113 7 of 18

tion are listed in Table1. Two kinds of command are assumed: (a) position step input, (b) with trapezoidal speed profile limitation. The step input command is 0.628 radian. The motion command includes the acceleration segment, deceleration segment and constant speed, and total angular displacement 0.628 radian in the dura- tion time 0.7 s. Substituting the parameters shown in Table1 into (22), the control gain T     k = k1 k2 = 15 0.4 is chosen such that the resulting second-order system (23) possesses the performances of damping ratio 0.707 and rising time 0.05 s. Thus, the linear control law uL and sliding surface σ are determined as:   T   z1 uL = −k x = − 15 0.4 (28) z2

and Z t σ[x(z1, z2), t] = 0.000273 z2 + (15z1 + 0.4z2)dτ (29) 0

Table 1. The parameters of the simulated motor.

Rated Voltage 3.6 V Rated current 2.0 A Coil resistance (R) 1.6 Ω Coil inductance (L) 0.0063 H −5 2 Rotor inertia (Jm) 4.93 × 10 N · m/s −6 Coefficient of friction (Bm) 4.93 × 10 N · m/s Torque constant (Km) 0.18 N · m/A −1 Back EMF (Ke) 0.18 V/rad · s Cogging torque constant (Fc) 0.006 N · m

According to (28) and (29), and with the setting, Actuators 2021, 10, x FOR PEER REVIEW 9 of 19

q = q0 + q1|ωm|, (30)

where q0 and q1 are two positive constants for the VSC control part. The schematic block diagram of the Simulink model of= the variable+ ω = structure+ controllerω and the structure of the q q0 q1 m 0.05 0.1 m (31) drive system are shown in Figure3.

* iqs

ids B −(K2+ m ) Km iqs

− J m K m

Figure 3. The schematic block diagram of VSC-based stepper motor drive system.

The system shown in Figure3 includes the linear state feedback and variable structure control for the position/speed loops, and the inner d- and q-axis current control loops are

Figure 4. The position command and speed command profiles.

In (31), q0 is mainly used to reduce the steady-state error coming from the dead- band, backlash, cogging torque, or other nonlinear part of the system, and make the slid- ing condition exist. The second part of (31), whereby magnitude is proportional to the motor speed, is designed to guarantee the system states follow the desired trajectory de- fined in matrix Ac . First, the responses of step position command input are shown in Figure 5. There is no speed restriction on the response, and the speed and position are controlled by the equivalent system matrix Ac . Figures 6–8 are the position, speed and current response under the no-load condition. In Figure 6, we can see that the feedback has reached the target position of 0.628 radians at the time of about 0.7 s. The simulation shows that the drive system with variable structure control can ensure the performance of the position control. The speed response displayed on Figure 7 shows that the acceleration segment, constant speed and deceleration are near to the desired speed command profile. From Figure 7, the speed at the run segment is about 1.256 rad/s. Due to the chatter control of VSC and the low-speed operation, there is a little ripple in the speed response. The current response is shown in Figure 8, in which the magnitude is small because a no-load condi- tion is asserted.

Actuators 2021, 10, x FOR PEER REVIEW 9 of 19

= + ω = + ω q q0 q1 m 0.05 0.1 m (31)

Actuators 2021, 10, 113 8 of 18

* iqs dominated by two PI controllers. As shown in Figure3, the command of q-axis current control loop is from the output of the variable structure controller, and the command of the d-axis current control loop is set as 0. The sampling time for the current and speed/position control loops are set as 0.05 ms and 0.5 ms, respectively. A typical trapezoidal speed profile with a displacement 0.628 radian, as shown in ids B −(K2+Figurem ) 4, is used as the command input. The following simulated responses, including the Km position, speed, current and sliding surfaceiqs σ, will be shown for with and without load

− conditions,J m which are defined dependent on whether or not the disk load axis connected. K Them speed profile of Figure4 is made with the time constraints of acceleration period 0.2 s, constant speed period 0.3 s and deceleration period 0.2 s, and the variable structure control part (29) is set as: Figure 3. The schematic block diagramq of= VSC-basedq0 + q1|ωm stepper| = 0.05 motor+ 0.1 drive|ωm| system. (31)

FigureFigure 4. The4. The position position command command and and speed speed command command profiles. profiles.

InIn (31), (31),q 0 qis0 mainly is mainly used used to reduce to reduce the steady-state the steady-state error comingerror coming from thefrom dead-band, the dead- backlash,band, backlash, cogging cogging torque, torque, or other or nonlinearother nonlinear part ofpart the of system, the system, and makeand make the slidingthe slid- conditioning condition exist. exist. The second The second part of part (31), of whereby (31), whereby magnitude magnitude is proportional is proportional to the motor to the speed,motor is speed, designed is designed to guarantee to guarantee the system the statessystem follow states the follow desired the trajectorydesired trajectory defined inde- matrixfined inA cmatrix. Ac . First,First, the the responses responses ofof stepstep positionposition commandcommand input are shown in Figure Figure 55.. There is isno no speed speed restriction restriction on on the the response, and thethe speedspeed andand positionposition areare controlled controlled by by the the equivalent system matrix Ac. Figures6–8 are the position, speed and current response equivalent system matrix Ac . Figures 6–8 are the position, speed and current response under the no-load condition. In Figure6, we can see that the feedback has reached the under the no-load condition. In Figure 6, we can see that the feedback has reached the target position of 0.628 radians at the time of about 0.7 s. The simulation shows that the target position of 0.628 radians at the time of about 0.7 s. The simulation shows that the drive system with variable structure control can ensure the performance of the position control.drive system The speed with responsevariable structure displayed control on Figure can7 ensureshows the that performance the acceleration of the segment, position constantcontrol. speedThe speed and decelerationresponse displayed are near on to Figu there desired 7 shows speed that commandthe acceleration profile. segment, From Figureconstant7, the speed speed and at thedecelerati run segmenton are isnear about to the 1.256 desired rad/s. speed Due to command the chatter profile. control From of VSCFigure and 7, the the low-speed speed at operation,the run segment there is is a about little ripple 1.256 inrad/s. the speedDue to response. the chatter The control current of responseVSC and is the shown low-speed in Figure operation,8, in which there the is magnitude a little ripple is small in the because speed response. a no-load The condition current isresponse asserted. is shown in Figure 8, in which the magnitude is small because a no-load condi- tion is asserted.

Actuators 2021, 10, 113 9 of 18 Actuators 2021, 10, x FOR PEER REVIEW 10 of 19

Actuators 2021, 10, x FOR PEER REVIEW 10 of 19 Actuators 2021, 10, x FOR PEER REVIEW 10 of 19 Actuators 2021, 10, x FOR PEER REVIEW 10 of 19

Figure 5. The position and speed response with step input command. Figure 5. The position and speed response with step input command. Figure 5. The position and speed response with step input command. Figure 5. The position and speed response with step input command. Figure 5. The position and speed response with step input command.

Figure 6. The position command and position response without load. FigureFigure 6. 6.The The position position command command and and position position response response without without load. load. Figure 6. The position command and position response without load. Figure 6. The position command and position response without load.

Figure 7. The speed response without load and speed command profile. Figure 7. The speed response without load and speed command profile. Figure 7. The speed response without load and speed command profile. FigureFigure 7. 7.The The speed speed response response without without load load and and speed speed command command profile. profile.

Figure 8. The current response without load. Figure 8. The current response without load. Figure 8. The current response without load. FigureFigure 8. The 9 current is the response without of the slidingload. surface σ, which shows that the system enters Figurethe slidingFigure 8. The surfacecurrent 9 is the responseonce response the without motor of the starts, load. sliding and surface it can beσ, whichused to shows verify that the thecorrectness system entersof the the slidingFigure surface 9 is the once response the motor of the starts, sliding an dsurface it can beσ, usedwhich to shows verify that the correctnessthe system entersof the Figure 9 is the response of the sliding surface σ, which shows that the system enters proposedthe sliding variable surface once structure the motor control. starts, Sometimes, and it can the be used motion to verify control the is correctness shown running of the the sliding surface once the motor starts, and it can be used to verify the correctness of the

Actuators 2021, 10, 113 10 of 18

Actuators 2021, 10, x FOR PEER REVIEW 11 of 19

Actuators 2021, 10, x FOR PEER REVIEW σ 11 of 19 Actuators 2021, 10, x FOR PEER REVIEWFigure 9 is the response of the sliding surface , which shows that the system enters11 of 19 the sliding surface once the motor starts, and it can be used to verify the correctness of theproposed proposed variable variable structure structure control. control. Sometimes, Sometimes, the the motion motion control control is shown is shown running running for- forwardproposed and variable backward, structure as Figure control. 10 displays. Sometimes, In it,the the motion position control tracking is shown error running is defined for- wardproposed and variablebackward, structure as Figure control. 10 displays. Sometimes, In it, thethe motion position control tracking is shown error is running defined for- as asward the difference and backward, between as positionFigure 10 command displays. andIn it, position the position feedback. tracking Next, error the is simulation defined as theward difference and backward, between as positionFigure 10 command displays. anIn dit, position the position feedback. tracking Next, error the is simulationdefined as underthe difference the load condition betweenis position shown; thecommand command and used position is the feedback. same as the Next, no-load the condition.simulation underthe difference the load betweencondition position is shown; command the comma andnd position used is feedback.the same asNext, the no-loadthe simulation condi- Forunder this the condition, load condition the inertia is shown; and the the friction comma ofnd the used rotor is arethe assumedsame as the by 10no-load times condi- and tion.under For the this load condition, condition the is shown;inertia and the commathe frictionnd used of the is rotorthe same are assumedas the no-load by 10 condi-times twicetion. the For origin, this condition, respectively. the Theinertia simulated and the results friction are of shownthe rotor in Figuresare assumed 11–13 .by 10 times andtion. twice For this the condition,origin, respectively. the inertia The and simulated the friction results of the are rotor shown are inassumed Figures by11–13. 10 times and twice the origin, respectively. The simulated results are shown in Figures 11–13. and twice the origin, respectively. The simulated results are shown in Figures 11–13.

Figure 9. The response of sliding surface σ without load. Figure 9. The response of sliding surface σ without load. Figure 9. The response of sliding surface σ without load. Figure 9. The response of sliding surface σ without load.

Figure 10. The simulated position, speed and position tracking error. Figure 10. The simulated position, speed and position tracking error. FigureFigure 10. 10.The The simulated simulated position, position, speed speed and and position position tracking tracking error. error.

Figure 11. The position response with load. Figure 11. The position response with load. FigureFigure 11. 11.The The position position response response with with load. load.

Actuators 2021, 10, 113 11 of 18 Actuators 2021, 10, x FOR PEER REVIEW 12 of 19 Actuators 2021, 10, x FOR PEER REVIEW 12 of 19 Actuators 2021, 10, x FOR PEER REVIEW 12 of 19

FigureFigure 12.12. TheThe speed speed responseresponse withwith load.load. FigureFigure 12. 12.The The speed speed response response with with load. load.

FigureFigure 13.13. TheThe current current responseresponse withwith load.load. FigureFigure 13. 13.The The current current response response with with load. load. FiguresFigures 11–1311–13 areare thethe position,position, speedspeed andand cucurrentrrent responsesresponses withwith load.load. TheThe positionposition responseresponseFiguresFigures inin 11 FigureFigure –11–1313 are 1111 are the isis almostthealmost position, position, thethe speed samesame speed andasas thandth currentee response responsecurrent responses responses withoutwithout with loadload with load. ofof load. FigureFigure The The position 6;6; position thatthat isis response in Figure 11 is almost the same as the response without load of Figure6; that is whatwhatresponse thethe VSCVSC in Figure controlcontrol 11 wants. wants.is almost However,However, the same becabeca as usethusee responsethethe connectedconnected without flywheelflywheel load of loadload Figure makesmakes 6; that thethe is what the VSC control wants. However, because the connected flywheel load makes the systemsystemwhat the withwith VSC 1010 timestimescontrol thethe wants. inertiainertia However, asas comparedcompared beca totouse thethe the unloadunload connected condition,condition, flywheel whichwhich load reducesreduces makes thethe the system with 10 times the inertia as compared to the unload condition, which reduces the systemsystemsystem bandwidthbandwidth with 10 times andand the presentspresents inertia smallsmall as compared speedspeed riri pples.pples.to the SinceunloadSince thethe condition, controlcontrol lawlaw which ofof VSCVSC reduces partpart theisis system bandwidth and presents small speed ripples. Since the control law of VSC part is usedusedsystem toto make makebandwidth suresure thethe and systemsystem presents statesstates small keepkeep speed thethe sliding slidingripples. condition,condition, Since the itcontrolit isis lookinglooking law offorwardforward VSC part toto a ais used to make sure the system states keep the sliding condition, it is looking forward to a largerlargerused q-axistoq-axis make currentcurrent sure the forfor system loadload condition.condition. states keep However,However, the sliding sincesince condition, thethe systemsystem it is hashas looking thethe samesame forward settingsetting to a larger q-axis current for load condition. However, since the system has the same setting for forforlarger bothboth q-axis thethe unloadunload current andand for loadload load conditions,conditions, condition. the theHowever, cucurrentrrent since responseresponse the systemisis nearlynearly has thethe the samesame same forfor setting bothboth both the unload and load conditions, the current response is nearly the same for bothσ cases, cases,cases,for both asas Figures Figuresthe unload 88 andand and 1313 load havehave conditions, shown.shown. NeNe xt,thext, Figure Figurecurrent 1414 response displaysdisplays is thethe nearly responseresponse the same ofof σ for withwith both as Figures8 and 13 have shown. Next, Figure 14 displays the response of σ withσ load.σ As load.load.cases, AsAs as thethe Figures speedspeed 8 rippleripple and 13 ofof have FigureFigure shown. 1212 isis smallersmallerNext, Figure thanthan FigureFigure14 displays 7,7, thethe the rippleripple response ofof σ of inin FigureFigure with the speed ripple of Figure 12 is smaller than Figure7, the ripple of σ in Figure 14 σis smaller 1414load. isis smallersmaller As the thanthan speed FigureFigure ripple 9,9, of andand Figure thethe systemsystem 12 is smaller alsoalso staysstays than onon Figure thethe slidingsliding 7, the phasephaseripple from fromof thethe in begin-begin- Figure than Figure9, and the system also stays on the sliding phase from the beginning. ning.ning.14 is smaller than Figure 9, and the system also stays on the sliding phase from the begin- ning.

Figure 14. The response of sliding surface σ with load. FigureFigure 14. 14.The The response response of of sliding sliding surface surfaceσ withσ with load. load. Figure 14. The response of sliding surface σ with load. 5.5.5. Experimental ExperimentalExperimental Setup SetupSetup and andand Results ResultsResults 5. Experimental Setup and Results ToToTo practically practicallypractically evaluate evaluateevaluate the thethe actual actualactual performance perforperformancemance of the ofof the proposedthe proposedproposed control controlcontrol scheme, scheme,scheme, the ex- thethe perimentalexperimentalexperimentalTo practically setup setup setup is shown is isevaluate shown shown in Figure in inthe Figure Figure actual15a, 15a, which15a, perfor which which includesmance includes includes theof the FPGA the the proposed FPGA FPGA board, board, board, powercontrol power power board, scheme, board, board, DC the experimental setup is shown in Figure 15a, which includes the FPGA board, power board,

ActuatorsActuators2021 2021, 10,, 11310, x FOR PEER REVIEW 1312 of of 19 18

DCpower power supply, supply, hybrid hybrid stepper stepper motor, motor, motor moto load andr load digital and oscilloscopedigital oscilloscope with logic with analyzer. logic analyzer.On the FPGA On board,the FPGA it includes board, the it Alteraincludes Cyclone the Altera III FPGA Cyclone with typeIII FPGA EP3C16E144C8N, with type EP3C16E144C8N,12-bit serial analog 12-bit to digital serial converter analog to (ADC) digital AD7866 converter made (ADC) byAnalog AD7866 Devices made by and Analog 12-bit Devicesdigital to and analog 12-bit converter digital (DAC)to analog TLV5618 converter made (DAC) by Texas TLV5618 Instruments. made In by the Texas power Instru- board, ments.there are In twothe power H-bridge board, circuits there used are two to transfer H-bridge the circuits DC power used toto thetransfer stepper the motor,DC power and totwo the Hall stepper current motor, sensors and aretwo set Hall to detectcurrent the sensors motor are stator set currents.to detect Thethe motor EP3C16E144C8N stator cur- rents.chip has The 84 EP3C16E144C8N I/O pins, 15,408 chip logic has elements, 84 I/O pins, 516,096 15,408 bits logic RAM, elements, 56 18 × 18516,096 multipliers bits RAM, and 564 PLLs18 × 18 [21 multipliers], and is clocked and 4 byPLLs 20 [21], MHz. and The is FPGAclocked chip by is20 usedMHz. to The develop FPGA the chip hardware is used tocontrol develop system, the hardware which includes control the system, coordinate which transformation, includes the variablecoordinate structure transformation, controller, variablePI controllers, structure 4X quadraturecontroller, encoderPI controllers counter,, 4X two-phase quadrature SVPWM, encoder and counter, the series/parallel two-phase SVPWM,conversions and for the the series/parallel ADC and DAC conver converters.sions for A the non-optimized ADC and DAC usage converters. report about A non- the optimizedproposed driveusage system report is about shown the in proposed Table2. ADC drive and system DAC areis shown serial typein Table 12-bit 2. converters ADC and DACclocked are byserial 20 MHz.type 12-bit ADC converters is used to obtainclocked the by analog 20 MHz. current ADC ofis used phases to obtain A and the B detected analog currentby Hall of sensors, phases andA and works B detected with a 20by kHzHall triggersensors, signal. and works DAC with is used a 20 to kHz output trigger the signal.corresponding DAC is used analog to voltageoutput signalsthe corresponding of the controlled analog variables voltage such signals as theof the rotor controlled position, σ variablesspeed, and such sliding as the surface rotor posiσ totion, be checkedspeed, and and sliding compared, surface and thoseto be signalschecked are and shown com- pared,on the and digital those oscilloscope. signals are DAC shown is workedon the di withgital a oscilloscope. 2 kHz trigger DAC signal is sinceworked it is with used a to2 kHzdemonstrate trigger signal the mechanic since it is signals. used to The demo samplingnstrate times the mechanic for the current signals. control The sampling loop and timesposition/speed for the current control control loops loop are, and respectively, position/speed 0.05 ms control and 0.5 loops ms. are, The respectively, built functions 0.05 of msthe and FPGA 0.5 chip ms. andThe thebuilt signal functions flow diagram of the FPGA out of chip the FPGA and the of thesignal experimental flow diagram system out are of theshown FPGA in Figureof the experimental 16, and signal system flow of are the shown blocks in inside Figure the 16, FPGA and signal can be flow found of in theFigure blocks3. insideLogic analyzer,the FPGA which can be is builtfound in in the Figure digital 3. oscilloscope, Logic analyzer, is used which to capture is built and in displaythe digital the oscilloscope,digital signal is outputs used to from capture the and FPGA. display In here, the thedigital logical signal analyzer outputs is usedfrom tothe display FPGA. the In here,position the trackinglogical analyzer error of is the used position to display control th loop.e position The steppertracking motor error isof athe hybrid position one con- with trol50rotor loop. teeth,The stepper rated current motor is 2 A,a hybrid and is one powered with 50 by rotor DC busteeth, voltage rated current 24 V. Additionally, 2 A, and is poweredit is equipped by DC with bus avoltage 5000 p/rev 24 V. incremental Additionally, encoder it is equipped for the position/speed with a 5000 p/rev feedback. incre- mentalThe load encoder system for for the the position/speed experiment is shown feedba inck. Figure The load15b; itsystem is a flywheel-type for the experiment load, and is showncounterweights in Figure can15b; be it usedis a flywheel-type to change the load, inertia and on counterweights the rotor. For the can comparison be used to purpose, change thethe inertia desired on speed the rotor. waveform For the and comparison angular destination purpose, ofthe the desired experimental speed waveform system are and the angularsame as destination the simulated of the system. experimental system are the same as the simulated system.

Hybrid Stepper Motor

DC Power Supply

Oscilloscope

Logic Analyzer Counterweight

FPGA board

Hybrid Stepper-Motor

Inertia Load Power board (Disk)

(a) (b)

Figure 15. The setup andand loadload forfor experiment. experiment. ( a()a) The The FPGA FPGA board, board, power power board board and and stepper stepper motor; motor; (b) stepper(b) stepper motor motor and andflywheel flywheel load. load.

Actuators 2021, 10, x FOR PEER REVIEW 14 of 19 Actuators 2021, 10, 113 13 of 18

Table 2. The usage of chip to realize the drive system.

Family Cyclone III Device EP3C16E144C8 Total logic elements 5481/15,408 (36%) Total combinational functions 5153/15,408 (33%) Dedicated logic registers 1881/15,408 (12%) Total registers 1881 Total pins 42/85 (49%) Total virtual pins 0 Total memory bits 155,648/516,096 (30%) Embedded Multiplier 9-bit elements 64/112 (57%) Actuators 2021, 10, x FOR PEER REVIEW 14 of 19 Total PLLS 0/4 (0%)

Figure 16. The built functions of FPGA and signal flow diagram of experiment system.

The experimental results with step position command input are shown in Figure 17. The system takes about 100 ms to reach its steady-state value as simulated, and the speed response is not so sharp as the simulation.

Table 2. The usage of chip to realize the drive system.

Family Cyclone III Device EP3C16E144C8 Total logic elements 5,481/15,408 (36%) Total combinational functions 5,153/15,408 (33%) Dedicated logic registers 1,881/15,408 (12%) Total registers 1881

Total pins 42/85 (49%) Figure 16. The built functions of FPGA and signal flowflow diagram of experiment system.system. Total virtual pins 0 The experimental results with step position command input are shown in Figure 17. The experimentalTotal results memory with bits step position command input 155,648/516,096 are shown in(30%) Figure 17. The system takes about 100 ms to reach its steady-state value as simulated, and the speed The systemEmbedded takes about Multiplier 100 ms 9-bitto reach elements its steady-state value as simulated, 64/112 (57%) and the speed response is not so sharp as the simulation. response is not so sharpTotal as thePLLS simulation. 0/4 (0%)

Table 2. The usage of chip to realize the drive system.

Family Cyclone III Device EP3C16E144C8 Total logic elements 5,481/15,408 (36%) Total combinational functions 5,153/15,408 (33%) Dedicated logic registers 1,881/15,408 (12%) Total registers 1881 Total pins 42/85 (49%) Total virtual pins 0 Total memory bits 155,648/516,096 (30%) Figure 17. The experimental responses of position and speed response with step command input. Figure 17.EmbeddedThe experimental Multiplier responses 9-bit ofelements position and speed response with 64/112 step (57%) command input. Total PLLS 0/4 (0%)

Figure 17. The experimental responses of position and speed response with step command input.

Actuators 2021, 10, 113 14 of 18 Actuators 2021, 10, x FOR PEER REVIEW 15 of 19 Actuators 2021, 10, x FOR PEER REVIEW 15 of 19

Figure 1818 gives gives the the position position and and speed speed responses responses with with the 0.628 the 0.628 radian radian position position com- Figure 18 gives the position and speed responses with the 0.628 radian position com- mand.command. The Thetime timebase baseof Figure of Figure 18 is 18 200 is 200ms/DIV. ms/DIV. According According to the to description the description about about the mand.pulsethe pulse generator,The generator, time base the the amountsof amountsFigure of18 oftotal is total200 generated ms generated/DIV. pulseAccording pulse are are 2000 2000to the within within description the the duration duration about [0 [0the s, pulse generator, the amounts of total generated pulse are 2000 within the duration [0 s, 0.7 s]. For the position and speed responses, they fit fit the requirements about the position 0.7 s]. For the position and speed responses, they fit the requirements about the position and speed constraints. To To check the position re responsesponse precisely, we sent the position error andin digitaldigital speed formatformatconstraints. withwith 8 To8 bits bitscheck to to the thethe output positionoutput port portre ofsponse theof the FPGA, precisely, FPGA, and and capturedwe sentcaptured the them position them by the by error logic the in digital format with 8 bits to the output port of the FPGA, and captured them by the logicanalyzer. analyzer. In Figure In Figure 18, it 18, displays it displays that thethat bit the D0 bit is D0 switching is switching between between 0 and 0 and 1, and 1, and the logic analyzer. In Figure 18, it displays that the bit D0 is switching between 0 and 1, and theother other bits, bits, D1-D7, D1-D7, stay stay at 0. at Thus, 0. Thus, the position the position error error in the in steady-state the steady-state condition condition is about is theaboutone other encoder one bits, encoder pulse. D1-D7, pulse. Figure stay Figure 19at is0. the Thus,19 is zoomed the the zoomed po plotsition to plot theerror to steady-state the in steady-statethe steady-state condition. condition. condition Figure Figure 20 isis about one encoder pulse. Figure 19 is the zoomed plot to the steady-state condition. Figure 20the is result the result with with running running forward forward and backward.and backward. 20 is the result with running forward and backward.

Figure 18. The experimental responses of position and speed without load. Figure 18. The experimental responses of position and speed without load.

Figure 19. The experimental position steady-state error without load. FigureFigure 19. 19. TheThe experimental experimental position position steady-state steady-state error error without without load. load.

Actuators 2021, 10, 113 15 of 18 ActuatorsActuators 20212021 2021,, ,1010 10,, ,xx x FORFOR FOR PEERPEER PEER REVIEWREVIEW REVIEW 161616 of of of 19 19 19

FigureFigureFigure 20. 20. 20.The The The responses responses responses of of of run run run forward forward forward and and and backward backward backward with withwith with trapezoidal trapezoidaltrapezoidal trapezoidal velocity velocityvelocity velocity profile. profile.profile. profile. (a ) (( a positiona(a)) ) posi-posi- posi- andtiontiontion position andand and positionposition position tracking trackingtracking tracking error; error;error; (error;b) speed. (( b(b)) )speed.speed. speed.

FiguresFiguresFigures 2121 21 andand and 2222 22 are,are, are, respectively,respectively, respectively, thethe the stator statorstator current currentcurrent andandand slidingsliding surfacesurface σσσ... Since .Since SinceSince thethethethe systemsystemsystem system isisis is withwithwith with aa a trapezoidal trapezoidal trapezoidal velocityvelocity velocity prpr profileprofileofile command commandcommand input, input, the the current current current response response response is is isrequestedrequestedrequested requested toto to torespondrespond respond respond toto to thethe tothe the similarsimilar similar similar profileprofile profile profile asas as thethe the as speedspeed thespeed speed response.response. response. response. InIn In FigureFigure Figure In Figure 22,22, 22, thethe the 22 slidingsliding sliding, the sliding surface is always kept at a quite low value since the system enters the sliding phase surfacesurfacesurface isis is alwaysalways always keptkept kept atat at aa a quitequite quite lowlow low valuevalue value sisi sincence the the system system enters enters the the sliding sliding phase phase from from from starting. starting.starting.starting.

iiiAA

FigureFigureFigure 21. 21. 21.The The The current current current response response response without without without load. load. load.

Figure 22. The sliding surface σσ without the load added. FigureFigureFigure 22. 22. 22.The The The sliding sliding sliding surface surface surfaceσ σwithout without without the the loadthe load load added. added. added.

Actuators 2021, 10, x FOR PEER REVIEW 17 of 19

Next, we are going to display the test with load. The motor is connected to a disk load, as shown in Figure 15b, and four counterweights are added to increase the rotor inertia to about 10 times the case without them, and two-time frictions are assumed. Fig- ures 23–25 are the results of load conditions.

Actuators 2021, 10, 113 16 of 18 Actuators 2021, 10, x FOR PEER REVIEW 17 of 19

Next,Next, we we are goinggoing toto display display the the test test with with load. load. The The motor motor is connected is connected to a to disk a disk load, load,as shown as shown in Figure in Figure 15b, and 15b, four and counterweights four counterweights are added areto added increase to increase the rotor the inertia rotor to inertiaabout 10to about times the10 times case withoutthe case them,without and them, two-time and two-time frictions arefrictions assumed. are assumed. Figures 23 Fig-–25 uresare the23–25 results are the of load results conditions. of load conditions.

Figure 23. The position and speed responses with load.

Figure 23 shows the position and speed responses under the load condition. The speed response is obedient to follow the speed profile as the no-load condition. Since the tested load is constructed by increasing the rotor inertia and friction, more generated torque is needed to overcome the variations as the evidence that the stator current was increased to about 0.35A peak to peak value as shown in Figure 24, and its magnitude is greater than the one without load connected. Comparing the two sliding surface re- sponses of Figures 22 and 25, they show that the ripple of the load condition is greater than the case without load. On the contrary, in the steady-state duration, the system speed is almost zero, and the increased inertia and friction lead to the reduction of system band- width. Thus, the magnitude of the ripple about σ for the load condition is smaller than the unload condition at the steady-state duration. It can also be seen from the steady-state digital tracking error where the load condition is not so active compared to the no-load FigureFigurecondition. 23. 23. TheThe position position and and speed speed responses responses with with load. load.

Figure 23 shows the position and speed responses under the load condition. The speed responsei isA obedient to follow the speed profile as the no-load condition. Since the tested load is constructed by increasing the rotor inertia and friction, more generated torque is needed to overcome the variations as the evidence that the stator current was increased to about 0.35A peak to peak value as shown in Figure 24, and its magnitude is greater than the one without load connected. Comparing the two sliding surface re- sponses of Figures 22 and 25, they show that the ripple of the load condition is greater than the case without load. On the contrary, in the steady-state duration, the system speed is almost zero, and the increased inertia and friction lead to the reduction of system band- width. Thus, the magnitude of the ripple about σ for the load condition is smaller than the unload condition at the steady-state duration. It can also be seen from the steady-state Actuators 2021, 10, x FOR PEER REVIEW 18 of 19 digital tracking error where the load condition is not so active compared to the no-load Figure 24. Current response with load. condition.Figure 24. Current response with load.

i A

Figure 24. Current response with load. FigureFigure 25. 25.The The sliding sliding surface surface with with load. load.

6. ConclusionsFigure 23 shows the position and speed responses under the load condition. The speedAs response we can issee obedient in this paper, to follow the stepper the speed motor profile drive as system the no-load with a condition.variable structure Since thecontroller tested load implemented is constructed on an by FPGA increasing chip ha thes been rotor successfully inertia and friction,realized. more The system generated was torquefirst designed is needed and to simulated overcome on the the variations MATLAB/Simulink as the evidence platform that the to evaluate stator current the perfor- was increasedmance of to the about inner 0.35A loop peak vector to peakcurrent value cont asrol shown and outer in Figure loop 24 position/speed, and its magnitude variable is structure control. It has been shown to be able to overcome the nonlinear characteristics of the fourth harmonic cogging torque and external load; the positioning error is about one bit. The hardware system implemented on FPGA for the variable structure controller and PI controller are verified by practical experiment for the stepper motor drive system with the trapezoidal velocity profile constraint, and the drive system is completed oper- ated on the predefined profile. With the results, it shows that a DSP- or microprocessor- based control system can be replaced by a hardware controller realized by FPGA. Further- more, as the results show in Figures 9 and 14, the system is initially in the sliding surface and the following successive time. It means that the system’s characteristics are com- pletely matched to the designed equivalent system matrix, Ac . In the simulated speed responses of Figures 7 and 12, the speed ripples are obviously different, and no load condition is bigger than with the load condition. An estimator to dynamically determine the magnitude of q0 and q1 in (30) and (31) is going to be de- signed to reduce the chattering.

Author Contributions: Conceptualization, C.-K.L. and H.-Y.L.; methodology, C.-K.L., B.-W.L. and H.-Y.L.; software, C.-K.L., B.-W.L. and G.-Y.C.; validation, C.-K.L., B.-W.L. and G.-Y.C.; formal anal- ysis, C.-K.L., B.-W.L.; investigation, C.-K.L., B.-W.L. and G.-Y.C.; resources, C.-K.L. and H.-Y.L.; data curation, B.-W.L. and G.-Y.C.; writing—original draft preparation, B.-W.L. and G.-Y.C.; writing— review and editing, C.-K.L. and H.-Y.L.; visualization, C.-K.L., B.-W.L. and G.-Y.C.; supervision, C.- K.L. and H.-Y.L.; project administration, C.-K.L.; All authors have read and agreed to the published version of the manuscript. Funding: This research received no external funding. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Not applicable. Conflicts of Interest: The authors declare no conflict of interest.

References 1. Lu, W.; Wang, Q.; Ji, K.; Dong, H.; Lin, J.; Qian, J. Research on Closed-loop Drive System of Two-phase Hybrid Step Motor Based on SVPWM. In Proceedings of the IEEE Vehicle Power and Propulsion Conference (VPPC), Hangzhou, China, 17–20 October 2016. 2. Le, K.M.; Van Hoang, H.; Jeon, J.W. An Advanced Closed-Loop Control to Improve the Performance of Hybrid Stepper Motors. IEEE Trans. Power Electron. 2017, 32, 7244–7255.

Actuators 2021, 10, 113 17 of 18

greater than the one without load connected. Comparing the two sliding surface responses of Figures 22 and 25, they show that the ripple of the load condition is greater than the case without load. On the contrary, in the steady-state duration, the system speed is almost zero, and the increased inertia and friction lead to the reduction of system bandwidth. Thus, the magnitude of the ripple about σ for the load condition is smaller than the unload condition at the steady-state duration. It can also be seen from the steady-state digital tracking error where the load condition is not so active compared to the no-load condition.

6. Conclusions As we can see in this paper, the stepper motor drive system with a variable structure controller implemented on an FPGA chip has been successfully realized. The system was first designed and simulated on the MATLAB/Simulink platform to evaluate the performance of the inner loop vector current control and outer loop position/speed variable structure control. It has been shown to be able to overcome the nonlinear characteristics of the fourth harmonic cogging torque and external load; the positioning error is about one bit. The hardware system implemented on FPGA for the variable structure controller and PI controller are verified by practical experiment for the stepper motor drive system with the trapezoidal velocity profile constraint, and the drive system is completed operated on the predefined profile. With the results, it shows that a DSP- or microprocessor-based control system can be replaced by a hardware controller realized by FPGA. Furthermore, as the results show in Figures9 and 14, the system is initially in the sliding surface and the following successive time. It means that the system’s characteristics are completely matched to the designed equivalent system matrix, Ac. In the simulated speed responses of Figures7 and 12, the speed ripples are obviously different, and no load condition is bigger than with the load condition. An estimator to dynamically determine the magnitude of q0 and q1 in (30) and (31) is going to be designed to reduce the chattering.

Author Contributions: Conceptualization, C.-K.L. and H.-Y.L.; methodology, C.-K.L., B.-W.L. and H.- Y.L.; software, C.-K.L., B.-W.L. and G.-Y.C.; validation, C.-K.L., B.-W.L. and G.-Y.C.; formal analysis, C.-K.L., B.-W.L.; investigation, C.-K.L., B.-W.L. and G.-Y.C.; resources, C.-K.L. and H.-Y.L.; data curation, B.-W.L. and G.-Y.C.; writing—original draft preparation, B.-W.L. and G.-Y.C.; writing— review and editing, C.-K.L. and H.-Y.L.; visualization, C.-K.L., B.-W.L. and G.-Y.C.; supervision, C.-K.L. and H.-Y.L.; project administration, C.-K.L.; All authors have read and agreed to the published version of the manuscript. Funding: This research received no external funding. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Not applicable. Conflicts of Interest: The authors declare no conflict of interest.

References 1. Lu, W.; Wang, Q.; Ji, K.; Dong, H.; Lin, J.; Qian, J. Research on Closed-loop Drive System of Two-phase Hybrid Step Motor Based on SVPWM. In Proceedings of the IEEE Vehicle Power and Propulsion Conference (VPPC), Hangzhou, China, 17–20 October 2016. 2. Le, K.M.; Van Hoang, H.; Jeon, J.W. An Advanced Closed-Loop Control to Improve the Performance of Hybrid Stepper Motors. IEEE Trans. Power Electron. 2017, 32, 7244–7255. [CrossRef] 3. Wang, C.; Cao, D. New Sensorless Speed Control of a Hybrid Stepper Motor Based on Fuzzy Sliding Mode Observer. Energies 2020, 13, 4939. [CrossRef] 4. Lai, C.K.; Ciou, J.S.; Tsai, C.C. The Modelling, Simulation and FPGA-Based Implementation for Stepper Motor Wide Range Speed Closed-Loop Drive System Design. Machines 2018, 6, 56. [CrossRef] 5. Ricci, S.; Meacci, V. Simple Torque Control Method for Hybrid Stepper Motors Implemented in FPGA. Electronics 2018, 7, 242. [CrossRef] 6. Lee, Y.; Shin, D.; Chung, C.C. PID controller with Feedforward Low Pass Filters for Permanent Magnet Stepper Motors. In Proceedings of the 12th International Conference on Control, Automation and Systems, Jeju Island, Korea, 17–21 October 2012. Actuators 2021, 10, 113 18 of 18

7. Shyu, K.K.; Hung, J.C. Totally invariant variable structure control systems. In Proceedings of the 23rd International Conference on Industrial Electronics, Control, and Instrumentation, New Orleans, LA, USA, 14 November 1997. 8. Defoort, M.; Nollet, F.; Floquet, T.; Perruquetti, W. Higher order sliding mode control of a stepper motor. In Proceedings of the 45th IEEE Conference on Decision & Control, San Diego, CA, USA, 13–15 December 2006. 9. Chen, M.; Kong, H.-T.; Liu, H. Conventional and Second Order Sliding Mode Control of Permanent Magnet Synchronous Motor Fed by Direct Matrix Converter: Comparative Study. Energies 2020, 13, 5093. [CrossRef] 10. Xia, X.; Zhang, B.; Li, X. High Precision Low-Speed Control for Permanent Magnet Synchronous Motor. Sensors 2020, 20, 1526. [CrossRef][PubMed] 11. Lin, C.-H.; Hsiao, F.-Y. Proportional-Integral Sliding Mode Control with an Application in the Balance Control of a Two-Wheel Vehicle System. Appl. Sci. 2020, 10, 5087. [CrossRef] 12. Chen, T.-C.; Su, Y.-C. High Performance Algorithm Realization on FPGA for Stepper . In Proceedings of the SICE Annual Conference 2008, The University Electro-Communications, Chofu, Japan, 20–22 August 2008. 13. Zhang, C.; Wu, X.; Zuo, X. FPGA Soft-Core Based Step Motor Driving. In Proceedings of the 2010 International Conference on Electrical and Control Engineering, Wuhan, China, 25–27 June 2010. 14. Cerezo, J.O.; Morales, E.C.; Plaza, J.M.C. Control System in Open-Source FPGA for a Self-Balancing Robot. Electronics 2019, 8, 198. [CrossRef] 15. Hace, A. The Improved Division-Less MT-Type Velocity Estimation Algorithm for Low-Cost FPGAs. Electronics 2019, 8, 361. [CrossRef] 16. la Tona, G.; Luna, M.; di Piazza, M.C.; Pucci, M.; Accetta, A. Development of a High-Performance, FPGA-Based Virtual Anemometer for Model-Based MPPT of Wind Generators. Electronics 2020, 9, 83. [CrossRef] 17. Kocur, M.; Kozak, S.; Dvorscak, B. Design and Implementation of FPGA-Digital Based PID Controller. In Proceedings of the 15th International Carpathian Control Conference (ICCC), Velke Karlovice, Czech Republic, 28–30 May 2014. 18. Kung, Y.-S.; Tsai, M.-H. FPGA-Based Speed Control IC for PMSM Drive with Adaptive Fuzzy Control. IEEE Trans. Power Electron. 2007, 22, 2476–2486. [CrossRef] 19. Siwakoti, Y.P.; Town, G.E. Design of FPGA-Controlled Power Electronics and Drives Using MATLAB Simulink. In Proceedings of the 2013 IEEE ECCE Asia Downunder, Melbourne, VIC, Australia, 3–6 June 2013. 20. Kuo, B.C. Automatic Control System, 4th ed.; Prentice-Hall, Inc.: Englewood Cliffs, NJ, USA, 1982. 21. Cyclone III Device Handbook; Altera Corporation: San Jose, CA, USA, August 2012; Volume 1. Available online: https://www.intel. com/content/dam/www/programmable/us/en/pdfs/literature/hb/cyc3/cyc3_ciii5v1.pdf (accessed on 10 May 2021).