Abstract

This paper presents an FPGA-based microstepping driver which drives a linear motion system with a smooth and precise way. Proposed driver built on a Spartan3 FPGA (XC3S400 core) development board from Xilinx. Implementation of driver realized by an FPGA and using Verilog hardware description language in the Xilinx ISE environment. The driver’s control behavior can be adapted just by altering Verilog scripts. In addition, a linear motion system developed (with 4 mm movement per motor revolution) and coupled it to the stepper motor. The performance of the driver is tested by measuring the distance traveled on linear motion system. The experimental results verified using hardware-in-loop Matlab and Xilinx cosimulation method. This driver accomplishes a firm and accurate control and is responsive.

1. Introduction

Stepper motors are increasingly used in motion control because of their low price and the ability to position well a connected electromechanical system. Mainly, stepper motors are employed in an open-loop control system, where a lot of shortcomings appear, for example, block or leakage of position by overload, torque reduction by driving in operating range, great power dissipation, and lack of robustness by dynamic loads. At the moment, to solve these problems, closed-loop systems are used; there are sensorless closed-loop controlling systems which were developed to decrease the costs of stepper motor controlling systems. Here we have only the measurement of the phase currents and no encoder which is the most expensive device in such a control system. The control algorithm can build on different kinds of microprocessors. When the closed-loop driver is employed with a DSP via C language, the coding and debugging are straightforward. For such uses it is possible to use FPGAs, where we can unite software and hardware solutions to get better performances because of the parallel computing architecture of the FPGA [13]. By means of this technique, the programming and debugging are more challenging. Because of this, the performance of the FPGA-based driver is still limited. However, an FPGA-based driver with Verilog or VHDL code is easier in ASIC manufacturing. By using FPGA, it is likely to get a faster and more accurate control than it is possible with a microcontroller. Our aim is to improve a microstepping driver for stepper motors which is able to do microsteps in a stepper motor, so that effects like signs of age or the heat which influence the stepper effectiveness, have not any or very low influence on the driver. One more benefit of developing such systems in FPGA will be the power consumption. With low power FPGA devices, it is conceivable to have less power dissipation than in a microcontroller [48].

2. Microstepping Driver Structure

2.1. Theory of Operation

The stepper motor rotation has several direct relationships to the applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shaft rotation. The simplest method to drive a stepper motor is controlling it by switching on/off the current through control windings. Typically, the control windings are excited through driver transistors [9, 10].

Rotating a stepper motor at its rated step size, mainly in high speed condition due to natural resonant frequencies of the motor, results in less smooth movement or in some cases leads to halt movement. Microstepping is a procedure used to smooth the motor’s movement between full steps, solve resonant problems in high speed uses, and increase the step resolution of the motor. Microstepping also develops the efficiency of the system, since the current in the windings of the motor is handled in a controlled routine rather than being turned on and off sharply [9, 10]. Two main advantages of this outline have been well reported in the literature such as reduction of resonance behavior [9, 1113] and smooth drive with very low ripple torque [1114]. A microstepping procedure known as high torque microstepping consecutively alternates the current in the two windings of a stepper motor.

Figure 1 shows a graph of the current in the windings as opposed to angular position using this method [10]. A brief description of what is happening is that one winding is driven while the current in the other winding is dropped to zero bit by bit, reversed, and then ramped up again. This sequence then recurs for the other winding. Note that the transition between a winding being energized in one direction and then energized in the other direction has a sinusoidal shape (Figure 1). This figure offers the smoothest transition between the motor’s rated step increments (i.e., 7.5 degrees). This shape is reached using a digital controller through the use of PWM. Modulating the input to the drive circuitry for a specific winding will result in a current that is related to the duty cycle of the modulated waveform. For instance, if a 5 V stepper motor is rated at 1 amp, then modulating a 5 V supply across the winding at 50% will result in a current of 0.5 ampere (supposing low inductance for windings) [510]. The following equation shows this relationship: whereis the rated current of the motor andis the duty cycle of the PWM signal. With the aim of achieving the sinusoidal transition from a positive to negative charge in a winding, several microsteps are needed. The amount of microsteps typically ranges from 4 to 32 or more (power of 2) microsteps per rated step size. Rather than real-time computing of the duty cycle for each individual microstep, a duty cycle look-up table is realized in software. The number of table values is equal to the number of steps anticipated for a particular microstepping sequence. Equation (2) is used to attain the duty cycle values for the top half of the table. The next half of the table is basically the top half in a contrary direction [510]. We have

Using (2), duty cycle values were calculated for 16 microsteps per full step sequence using an 8-bit PWM signal in Table 1. Figure 2 shows the block diagram of a microstepping driver. The driver contains a pulse counter and sine wave LUT in the software section and power converter in hardware. To rotate the stepper motor, the currents in the phases of the motor are controlled to track sine and cosine waves. To do this, the pulse commands are counted up to get the ordered position, and the ordered position is used as an index of sine wave LUT. The output of the sine wave LUT is the reference input to the power converter and the currents in the phases of the motor are controlled to track the input reference. In other sections of the paper, the design of these blocks will be explained in detail.

There are H-bridge circuit, antialiasing filter, analog to digital converter (ADC), PI-controller, and PWM generator units in the proposed driver. The H-bridge circuit is used for transferring the current in phases of the motor in a smooth way. The ADC and antialiasing filter are used to get the sampled current value for the PI current controller. The PI controller will adjust the duty cycle of switching pulse according to the current error.

2.2. Bridge Circuit and Current Feedback

The motor currents are controlled by using pulse width modulation procedure (PWM). A dual H-bridge circuit is used to drive a two-phase stepper motor. Such an H-bridge structure is shown in Figure 3. Each phase winding is coupled to each H-bridge circuit; hence, four switching devices are individually controlled to make suitable voltage for each phase winding. The leading benefit of this circuit topology is the independent generation of bipolar voltage between two phases. The H-bridge circuit (Figure 3) consists of four MOSFETs and two low resistance sensing resistors for each phase of the stepper motor [12, 14]. The four mentioned MOSFETs are controlled via a MOSFET driver IC (HIP4081A). With this H-bridge circuit, the currents flow through the phases of the motor as well as the sensing resistors RS1 and RS2. The voltages VS1 and VS2 on the sensing resistors provide current information by the relation VS = RS *  . This voltage is filtered and sampled by an ADC to produce a digital value. This digital value represents the value of the feedback current [11, 1417].

2.3. PI Controller

A PI controller is used to control the duty cycle of the pulses that trigger switching devices [11, 14]. The input of the PI controller is the current error between the reference current and feedback current (VS1 and VS2), and the output is the duty cycle of the switching pulses. To design such a PI controller, the first model of the PWM converter is needed. The H-bridge circuit (Figure 3) contains four MOSFETs, DC power, and the phase of the motor (LM as inductance and RM as resistance). The four MOSFETs are preserved as two pairs of switches (S1, S4 and S2, S3). The MOSFET gate drive IC (HIP4081A) will set one of these two sets of the switches to the ON state. The period and duty cycle of the switching pulse areand, correspondingly. Figure 4 shows the duty cycleand voltage supplied to one phase of the stepper motor. Adjusting the value ofallows the average DC voltage output to be varied. The phase voltage can be described as follows:

The relation between VO and the phase current IO is derived using the model of the RL circuit [11, 14].

The phase of the motor is considered as a low pass filter [5]. The duty cycleis the output of the controller. In fact, the output of the controller is a digital value that is compared with the value of an up-down counter for the purpose of determining the switching moment of the MOSFET pairs. We have

With the transfer function as in (4), a PI controller is used for the current controlling loop Figure 5. By using sisotool and the Ziegler-Nichols method in Matlab software, coefficients for the PI controller are selected as the optimal values [11, 14]. The optimal coefficients of the PI controller are given by the following:

Bode plot of the closed loop power converter is exposed in Figure 6. The PI controller will regulate the duty cycle of the switching pulses with regard to the error in stepper motor phase current. The PWM generator takes this duty cycle and creates the equivalent switching pulses to send to the HIP4082 IC, with the aim of controlling the MOSFET pair switches. Through this control outline, the output current is organized in such a way as to yield the desired current in stepper motor phases [1114].

However, the proposed PI controller is in the analog domain; since we use FPGA which is a discrete device, then we have to use a digitized version of the PI controller. Fortunately, Matlab software has a toolbox called fixed-point converter which could help us in converting analog transfer functions to a discrete fixed-point one that could be implemented in the FPGA.

2.4. Pulse Counter Unit and Sine Wave LUT

The digitized sinusoidal voltage is made via the zero order hold (ZOH) module. The preceding section debates the power unit. To revolve the stepper motor, the currents in the phases of the stepper motor need to be controlled to track sine and cosine signals. The preferred position is sent to the driver by a series of pulse commands. The frequency of these command pulses depends on the desired speed. The driver uses a counter for counting the input pulses and the value of the counter is the index of the sine and cosine LUT to produce the reference current of the power converter (Figure 7) [1114].

3. Hardware Structure

This section shows the implementation of the driver presented in the prior sections in the FPGA-based stepper motor driver. The experimental results prove the performance of the proposed driver.

3.1. Hardware Configuration

The overall driver circuit shown in Figure 8 is realized using a Xilinx Spartan3 (XC3S400 Core) FPGA development board operating at 50 [Mhz]system clock. A shot of the overall hardware setup is shown in Figure 10. In this system, the switching frequency was set at 40 [Khz]. Furthermore this is the frequency of overall algorithms which are implemented. Besides, measured currents are sampled at this frequency using the AD578 12-bit ADC outside of the development board. Due to the structure of H-bridge circuit, the FPGA software is designed to generate 1 [us]   of the dead time for upper and lower switching device pairs to avoid short circuit in switching process. Our two-phase stepper motor is rated at 2 A and 1.8° step angle. Xilinx-ISE software is used as an FPGA development and debugging tool.

We had designed and fabricated a linear motion system that attached to the stepper motor. The structure of the linear motion system in CAD environment and its real implementation are shown in Figures 9 and 10, respectively. This motion system will travel 4 mm in forward/backward direction in each stepper motor clockwise/counterclockwise full revolution.

Figure 10 illustrates the configuration of the experimental system. The proposed FPGA-based driver includes a stepper motor and an attached load to its rotor which is a linear motion system (4 [mm]   travel per motor full revolution). The control processes are implemented on an FPGA chip (XC3S400-PQ208) of Xilinx and there are other devices such as ADC (AD578) for sampling the analog input current feedback signals. The sampling frequency of the driver current controller is  40 [KHz], also the PWM switching frequency is  40 [KHz], the supply voltage is24 [V], each phase inductance is  4.3 [mH], and the phase resistance is5 [Ω]. Table 2 shows a summary of the utilized resources of the FPGA and Table 3 is a summary of the timing of the FPGA implementation. The input clock frequency of the FPGA board is 50 [MHz]. In this section, the performance of the driver is verified. In order to verify the flowing currents in stepper motor we performed a hardware-in-loop verification using Matlab-Simulink and Xilinx-Chipscope softwares. Such a configuration is illustrated in Figure 11. First, an experiment was performed to check the performance of the current control loop. Second, the motor is controlled to perform a smooth motion. Figure 12 shows the reference current and feedback current in one phase of the motor. The reference current is a sine wave and the output current follows a reference sine wave. A small ripple (about  40 [mA]) is seen in the output current due to current switching components (Figure 13). The maximum current is set to  2 [A]. The phase shift between the two currents is caused by delays in the driver control loop. This result shows that the current output can follow the desired current. This is because the position of the motor depends on the value of the current; when the output current is smooth, the precise position control can be achieved. In this FPGA-based experimental system, the motor driver can perform position control with maximum 2 pulse errors in 16 microsteps mode, which results in 2.5 [μm]   error in developed linear motion system.

4. Results

With respect to the achieved results, the efficiency of the driver is confirmed. First, an experiment was performed to check the efficiency of the driver control loop. Second, the motor is controlled to follow a smooth motion. Figure 12 shows the reference current and feedback current in a phase of the stepper motor. The reference current is a sine wave and the output current follows this sine wave. The maximum current is 2 [A]. The phase shift between the two currents is caused by the delays existing in the driver control loop and the mechanical movements. This result shows that the current output can follow the desired current. This is because the position of the motor depends on the value of the current; when the output current is smooth, the precise position control can be achieved. Figure 13 shows the currents in the 2 phases of the motor when the motor is controlled at a constant speed. Thus, the currents in the 2 phases follow a sine wave and shift in phase by an electric angle of 90° (this is a cosine wave). Tables 2 and 3 represent the results of the implementation of the microstepping driver on the FPGA device. In this FPGA-based experimental system, the driver can perform position control with 2.5 [μm]  travel error or 2 pulse error when stepper motor drive linear motion system in a 20 [cm]   distant. With this precision, it is possible to make small scale, and low cost, low complexity multiaxis structures. Such a construction is presented in Figure 14.

5. Conclusion

Stepper motors are used in an extensive range of position controlling devices such as robots, printers, plotters, and CNCs. Nowadays, most of the stepper motor controlling systems do not work as accurately as they have potential to. Microstepping is a drive procedure for the stepper motors that allows the smooth movement of the rotor in a fraction of the motor’s full step angle. In high precision applications, the microstepping driver is essential for accurate motor spin. In this paper a digital implementation of a microstepping drive system with current control using a Xilinx Spartan3 (XC3S400) FPGA development board was presented. The dual H-bridge converter is planned to drive the two-phase stepper motor. The model of the current controller and gains of the PI controller for optimal control are calculated using Matlab software. In our design, the FPGA is used to construct a high performance microstepping driver without using any microcontroller, DSP, or driver chip; additionally because all the algorithms are written in Verilog hardware description language, it is compatible with migrating proposed scheme to an ASIC and bulk fabrication methods. The fractional step can be configured and the rotor movement can be controlled up to 1/16-step resolution giving an overall resolution of developed linear motion system. Experimental results tested using hardware-in-loop Matlab and Xilinx cosimulation method. Finally, the experimental results validate the performance of the driver.