Inﬂuence of Microstepping Signal Shape on Shaft Movement Precision and Torque Variation of the Stepper Motor

: Stepper motors are widely used in many applications where discrete, precise movement is required. There is a variety of dedicated stepper motor controllers (sometimes referred to as “step sticks”) available on the market. Those controllers provide a number of different motor control schemes that vary by aspects like current control method, reference current shape or maximum resolution increase (microstepping). The two most widely acknowledged signal shapes are sine-cosine microstepping and quadrature microstepping. The choice of the control scheme impacts torque output, torque variation, positioning error and maximum power supply requirements. This paper presents a family of generalised microstepping signal shapes, ranging from sine-cosine microstepping to quadrature microstepping. Derivation of signal shapes as well as their mathematical analyses are provided. Those signals are then implemented on the control board. A series of experiments is performed on a test bench to analyse the inﬂuence of different signal shapes on the performance of the motor in both load and no load conditions. The comparison of the new generalized shapes inﬂuence on the motor operation to the commonly used sine-cosine and quadrature control is provided.


Introduction
Stepper motors have become a motion actuator of choice in many small-to-medium devices, such as CNC machines, robots, office printers, 3D printers and other devices, where a precise movement with a well-defined angular resolution is a crucial operating factor [1][2][3][4][5][6]. In the case of smaller devices, the maximum output of their power supply can become a bottleneck of the whole design, imposing constraints on the choice of motors and their nominal power. At some point, even low-resolution, sinusoidal microstepping may not provide enough incremental torque margin. As a consequence, shaft skipping can occur. In such cases, the square current phasor path pattern can be recommended [5], as it provides higher torque margin (at least in some positions). This, however, comes at the expense of introducing torque variation and therefore greater mechanical vibration of the whole motor body. The aim of this paper is to provide other meaningful pattern choices for microstepping signals which represent a middle ground between smooth operation of sine-cosine and high peak torque output of quadrature microstepping. This is achieved via a generalization of sine-cosine and quadrature signal to the whole family of p-norm unit circles [7].

Stepper Motor Principle of Operation
The stepper motor can be classified as a brushless DC motor akin to a switched reluctance machine in its general mechanical and electrical construction [8]. Only stator windings are actively powered, while the rotor consists of permanent magnets, soft magnetic materials, or a combination of both. The combined soft magnetic-permanent magnet construction, known as hybrid, has become dominant, since it can be designed to achieve comparatively high efficiency [9]. In permanent-magnet and hybrid constructions, when no voltage is applied to the stator coils, the number of magnetically stable shaft positions is defined by the ratio of the shaft's magnetic pole pairs to the number of pole pairs of stator windings. Electrically, stator windings consist of two coils with each of the coils wounded in alternating direction onto an even number of electromagnetic poles, as shown in Figure 1. An in-depth description of stepper motor construction and their principle of operation can be found in [8].
It is convenient to analyse stepper currents in both Cartesian coordinates of winding currents i A , i B and polar coordinates of phasor length |L| and phasor angle φ e related to winding currents as follows: where i n denotes nominal current per coil. In this paper, we assume that i n is also the maximum acceptable setpoint for coil current.
In polar representation, φ e corresponds directly to the shaft position between two adjacent pole pairs [10] and |L| corresponds to the motor torque. The shaft can rotate with current phasor if the vector difference between consecutive states corresponds with force (so-called incremental torque) is greater than, or equal to, the cumulative torque load (the sum of load and friction) [11].
In the simplest control scenario, the current on both coils is switched between ±i n according to a 2-bit Gray code. This method is known as full-step operation [6] and can be described as a simple look up Table 1: +i n −i n +i n +i n −i n +i n −i n −i n Full-step control can be equivalently described as rotation of phasor of length √ 2i n by an angle of π 2 with initial angular offset of π 4 . By rotating the phasor of length |i n | by a specific angle increment smaller than π 2 , one can achieve an increased positioning resolution and smoother mechanical operation resulting in sine-cosine microstepping [12][13][14]. Since phasor length does not change, the torque variation is effectively absent for motors with perfectly sinusoidal back-EMF [5]. The smaller the angle increment, the smaller the incremental torque. In many cases, this may result in lower positioning accuracy (despite higher positioning resolution) due to a static friction [11]. This effect can be partly mitigated by introducing microstepping, which allows not only phasor rotation, but also its length variation, as shown in Figure 2. A special case of such signal is quadrature microstepping, which allows only one of i A , i B coordinates at any given point in time to be of the absolute value lower than i n . This is tantamount to achieving the highest possible peak torque and torque increment [5]. However, at the same time, it introduces significant torque variation due to the change in phasor length |i II | − |i I | (as in Figure 2) [13]. Another drawback of this approach is the highest coils heating (Joule heating), due to relatively high current flowing through the coils.

Derivation of p-Circle Signals
Torque margin is a crucial aspect for maintaining low overall discrepancy between current angle and shaft angle. Maintaining adequate torque margin becomes an important problem in small devices when stepper motor cannot be replaced with a bigger one, or when maximum power consumption is a bottleneck. Conversely, in order to minimize mechanical vibrations, torque variation should also be minimized. To satisfy both needs, we use the fact that both sine-cosine's circular path and quadrature's square path belong to a wider group of p-norm unit circles. Those can be defined parametrically in a Cartesian coordinates as follows [7]: where p ≥ 1 denotes the specific vector space norm. For p = 2, this leads to the Euclidean norm and, due to the Pythagorean trigonometric identity, creates a circular path corresponding to sine-cosine microstepping. As p → ∞, the curve remains bounded [15] and approaches perfect square of length 2 centered in (0, 0), i.e., quadrature microstepping. By choosing values of p ∈ [2, ∞) (i.e., from euclidean circle to quadrature path) one can achieve different peak torque and torque variation values. Choice of p < 2 leads to a non-zero torque variation and minimum phasor length below 1 and as such does not pose any practical sense as a candidate for microstepping signal. Although there are no obstacles in using any real value of p (from the defined range), in this paper, for the sake of simplicity, only integer values of p will be presented.
It is worth noticing that any p-circle microstepping signal can be generated from the sine-cosine table and the table of Equation (2) denominator values generated for a given value of p.  Phasor length L(φ e ) is a transcendental function  For sine-cosine microstepping δφ e ≡ 0 and, as such, every microstepping resolution produces zero torque variation. In general, for any value of p ∈ (2, ∞), the Equation (4) holds Significantly, only for an infinite value of p is there a discontinuity in the plot Figure 5. For any finite p, with increasing microstepping resolution, the function smoothly approaches zero torque variation at points φ e = π+kπ 4 , k ∈ Z. This means that the use of the p-circle shaped phasor path not only leads to a lower maximum torque variation compared to quadrature microstepping, but it also doubles the number of near-zero torque variation points if microstepping resolution is high enough to fit microsteps on both ridges between function extrema.
The points of the minimum phasor length lie at angles kπ 2 , k ∈ Z and the maximum phasor length corresponds with the angles of π+2kπ 4 , k ∈ Z and equals So, for any arbitrarily chosen maximum phasor length L * ∈< 1, √ 2 >, a proper value p * of p can be derived using the formula By discretizing signals in the φ e domain, microstepping signals of given resolution are obtained. The resolution is defined as the number of points between two consecutive full steps; that is, the number of points at every quarter-wave. Figures 6-9 show module variation and incremental torque relative to a sine-cosine microstepping (of the same resolution) for two exemplary p-circle signals. Module variation is defined as the difference between unit phasor and phasor length at a particular point of the signal curve. Figure 10 presents the relationship between minimum and maximum incremental torque and microstepping resolution. It can be inferred from this that the relationship between maximum incremental torque of a given shape and sine-cosine microstepping does not depend on the microstepping resolution.

Materials and Methods
A test bench was prepared in order to compare the influence of different signal shapes on the movement of the stepper motors. The test bench consists of a stepper motor, motor load, microcontroller, power stage, angular position sensor and PC. The key parameters of the experimental table can be found in Table 2 and the parameters of the stepper motor can be found in Table 3.   Figures 11 and 12 present the schematic of the laboratory stand and the actual laboratory stand used in this study, respectively.
An SM57HT76-2804B bipolar stepper motor was chosen with each coil driven by an independent ST L6203 DMOS H-Bridge driver. A Texas Instruments TMDSCNCD28335 control card serves as the control unit. Coil currents are measured by a pair of ACEINNA MCA1101-5-3 AMR sensors [16]. The sensors were individually calibrated in the whole range of measured currents to ensure precise current control on both coils.
Constant load torque is applied to the motor shaft in the form of gravitational force generated by mass m load = 3.09 kg suspended on a nylon string of negligible mass wound on a lightweight aluminum pulley of mass m pulley , whose moment of inertia J pulley is also neglected. The string together with the pulley gave a lever of suspension equal to r = 2.19 cm, while the string was fully tensioned by the weight. This yields T load = 6.67 kg·cm of load against the nominal torque of 18.9 kg·cm of the tested motor.
Shaft position is measured by a Renishaw VIONIC R incremental optical encoder [17], which provides a resolution of 180e3 pulses per revolution (physical line count 9000 with x20 interpolation provided by the readhead). For 1.9 deg/step mechanical resolution of motor with x32 microstepping, this yields exactly 28.125 pulses/microstep, which is sufficient to measure shaft oscillations at the sub-microstep scale for microstepping resolutions up to and including x32. Encoder data are processed by the TMS320F28335 eQEP module into the angular position. The PC is used to acquire, save and analyse data obtained by the microcontroller. Motor currents are controlled by PI controllers with clamping type anti-windup. The controllers are synchronized with PWM outputs which switch the H-bridge transistors with frequency f PW M = 50 kHz. Current reference is changed according to stepping tables generated in the Matlab R environment, in which phase-space equations presented in Section 2 are implemented and cast to the time domain. This ensures that for every p-norm signal, the same set of phasor angles is achieved, and in case of an ideal motor geometry, no load applied to the motor and ideal currents control, no difference in shaft position should be observed between all analysed signals. Figures 13-16 exemplify currents generated in motor coils on the test setup.     Code Composer Studio is used to start and control experiment sequences. The first sequence directs the motor to move in the counterclockwise direction with a constant rpm value. Rotational speed was adjusted for different microstepping resolutions, as shown in Table 4. Those values were chosen to minimize the duration of steady-states in shaft position, which do not contain important information about system dynamics. Maximum current per coil is stabilised at the motor nominal value in order to maintain nominal motor performance. Shaft position data and current reference index in the stepping table are both acquired online and stored in microcontroller RAM. Data are sampled at 1 kHz. When the buffer is full, it is sent to a PC using SPI communication. In the second sequence, a switch to clockwise movement occurs when half of the position dataset has been acquired. Experiments were performed in both load and no load conditions. During measurements, no more than one full shaft turn was used in order to maintain constant length of the suspension lever.  In Figure 17, a characteristic periodic curvature can be observed. Plotting position together with AB coil currents, as done in Figure 18, exposes the probable relation of this phenomenon, with a change in phasor length.

Results
In total, 144 experiments under mechanical load were recorded and analysed. Every dataset was cut to a series of step responses, where the medium value from the previous step in series (see Figure 18) is treated as a zero and the signal is debiased accordingly. Such signal undergoes normalization to a full shaft revolution (i.e., is divided by an encoder resolution). The reference signal is generated, which corresponds with the ideal increment of the position of 200 steps/revolution motor for a given microstepping resolution. This pair of signals (reference position and actual position) is then treated as input (reference position) and output (actual position) of the I I nd order damped oscillator [18][19][20] given by continuous transfer function (7). The choice of I I nd order system is inferred from [20].
where K-static gain, T-natural harmonic frequency, ζ-damping factor. An example of an input-output signal pair is given in Figure 19. 1/32 step reference (input) unprocessed output data preprocessed output data Figure 19. An example of input-output signals used for system identification. Output signal obtained from raw position data by defining steady initial condition and debiasing.
Each input-output pair is fed to tfest() function of the Matlab R environment, in order to estimate the parameters of model (7). For every signal and microstepping resolution, both the mean and the median values were calculated from datasets of size specified in Table 5.      The above analysis is obviously based on many silent assumptions regarding the nature of stepper motor movement, due to an arbitrary choice of reference model given by Equation (7). As such, it gives a limited and biased insight into the effect the microstepping shape has on shaft positioning. As a complementary approach, a more direct parameter of positioning error was also analysed. Here, normalization to one full step was chosen to provide a better perspective for analysis. For each experiment datum, an idealized reference position was generated, as shown in Figure 24 and error between the reference and measured position is calculated, as shown in Figures 25 and 26. Figure 27 presents the mean of absolute error calculated from all gathered measurements with load applied.    As can be seen in Figure 24 , introducing load to the system leads to a stronger step variation and stronger oscillation variation (especially for high values of p). By adjusting the p value, those effects can be partially mitigated. Error analysis provides a clear suggestion that the optimal signal shape (in the sense of positioning accuracy) is neither sin-cos nor quadrature. In particular, 3-norm (p3) microstepping with load applied roughly follows the one with no load (where signal shape is generally not important) and positioning error presents overall best results in our test scenario.

Discussion
A novel generalization of the sine-cosine and quadrature signal to a whole family of the p-norm unit circle for a stepper motor is presented in the paper. The mathematical derivation of the p-norm unit circle, as well as application analyses regarding stepper motor, are provided. Generalised p-norm signals are used to generate reference phase currents for a stepper motor coils. A number of tests were performed on the experimental test bench to analyse the influence of the control method on the performance of the motor both in load and no load conditions. A broad statistical analysis of the acquired results is presented. It has been found that the generalised p-norm unit circle allows a payoff selection in the whole range between maximum torque output, torque variation, microstep homogeneity and average angle positioning error. A selection of the p value may depend on a particular case due to: selected motor, control strategy, load, etc. It has been demonstrated that, in our particular case, selecting the sinp3 shape reduces the average positioning error in comparison to the square based control, while maintaining sufficient maximum torque. The proposed methodology can be applied to any particular case, in order to select a value of p that best matches certain conditions. However, based on our research, no generalization regarding p selection can be derived.