# Simple Torque Control Method for Hybrid Stepper Motors Implemented in FPGA

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Methods

#### 2.1. Torque Generation and Step Movement

#### 2.2. Torque Modulation

## 3. Method Implementation

#### 3.1. The Electronics

#### 3.2. FPGA Implementation

_{T}every 1 ms. P

_{T}feeds the PI controller [10] that compares P

_{T}to the actual position PA and outputs the target torque ${\Gamma}_{E}$. The torque is then processed in the Torque block, which applies the first step of the control procedure detailed in Figure 2, and generates the required current ${I}_{t}$ and the target load angle $L{A}_{T}$. $L{A}_{T}$ is delivered to the LoadAngle block, while ${I}_{t}$ is directly programmed to the driver through the SPI. Both the PI and the load angle calculation run every 200 μs.

#### 3.3. Debug Memory

_{A}, $L{A}_{T}$, ${I}_{t}$, CP, RP, and $S{T}_{i}$ parameters are simultaneously saved with a sampling rate set by the user from 1 μs to 100 ms. Up to 4096 values of each parameter can be saved without interfering with the algorithm. The memory can be downloaded to a host PC when the motor is stopped. Although this feature has no impact on the algorithm, it is essential for debugging and performance analysis.

#### 3.4. Timings and Resources

_{T}, every 1 ms, and executes in 1.0 μs on a Nios processor clocked at 100 MHz. The PI controller and the torque control run every 200 μs, and execute the calculations in 1.5 μs only. This result is obtained using a look-up table for the sin inversion necessary in control step 1 (see Table 2, second row) for low torque condition. The remaining tasks, performed in FPGA fabric, are simple mathematical calculations or logic operations that take a few clock cycles at most to execute. The LoadAngle block (step 2 in Figure 2) is evaluated every 50 μs. In this period, the StepMan block issues a SPI command and a step-clock burst to the driver (see Figure 5). The SPI transmission, 1 byte at 4 MHz, takes about 3 μs. PowerSTEP01 driver requires a step-clock period of 1 μs, so the maximum length of the burst is of 32 μs (every position in a 64 μ-steps electrical circle can be reached by, at maximum, 32 μ-steps towards the shorter path). The minimum temporal length of a torque control loop is thus 3 + 32 = 35 μs, which fits well in the 50 μs period used here.

## 4. Experiments

#### 4.1. Experimental Set-Ups

#### 4.2. Control Procedure Test

#### 4.3. Torque Load Disturbance Test

_{T}= 0 (see Figure 4). The debug memory was programmed to save a parameter set every 200 μs. In this test, the motor shaft was loaded with an external positive torque, which was released at time t = 0. Figure 8 reports the shaft position measured by the encoder, P

_{A}, the current ratio, It/I

_{M}, the target angle, $L{A}_{T}$, calculated by the motor control, and the measured load angle, $L{A}_{M}$, together with its error with respect to the target angle.

_{A}= 0 by imposing the maximum load angle $L{A}_{T}$ = −16 μ-steps and a current of about 50% of the nominal value. After the external torque was released (t > 0), the control system reacted by reducing the current to its minimum of 10% in about 40 ms, then further reduced the torque by lowering the load angle towards 0. Meanwhile, due to the sudden load change, the shaft rotated of about −1.5 rad out of position, so the PI responded by imposing a slight positive load angle (t > 60 ms), while maintaining the current at its minimum level. The shaft recovered the target position in about 250 ms and the load angle decreased to 0. The error between the target and measured load angles, shown in last row, is within ±1 μ-step, except for few outliers. The load angle error is the same with (t < 0), and without (t > 0) the presence of load. The position error calculated as mean ± standard deviation of the errors measured before torque release (t < 0) is 0.05 ± 1.3 mrad, while after a stable condition was reached at t > 250 ms, is 0.09 ± 1.4 mrad. The test shows that the control reacts to a strong load change recovering the original position and controlling the load angle with a high level of accuracy.

#### 4.4. Trajectory Test in Different Load Conditions

^{2}and a maximum velocity of 16.4 rad/s. The experiment was repeated with the motor free, i.e., no load except the encoder, and with the motor connected to a load. The load was realized with a weight suspended by wire wrapped around the shaft. In the movement, the motor raised up the weight generating a torque that corresponds to about 20% of the full motor capacity. Figure 9 reports the parameters acquired in the FPGA every 300 μs. Left and right columns report the measurements obtained without and with the load, respectively. The errors are expressed as mean ± standard deviation calculated on the samples population of the corresponding measurement.

_{A}is reported on the 1st row of Figure 9. The movement lasted 0.83 s; it featured a typical “S” shape, which is barely visible because of the high acceleration used. The position error Perr is shown in the 2nd row. In the experiment with no load, the error peaks up to ±0.2 rad in the high acceleration/deceleration regions, but it is as low as 1 ± 2 mrad in the constant velocity region. The motor reacts to the acceleration in presence of load with an oscillation error of ±0.02 rad, which damps down in 200 ms. In the remaining part of the constant velocity region, the error is the same as in the no-load condition. With load, after the movement, the controller recovers the right steady position a bit more slowly with respect to no-load condition.

## 5. Discussion and Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## References

- Athani, V.V. Stepper Motors: Fundamentals, Applications and Design; New Age International: New Delhi, India, 2005; ISBN 81-224-1006-5. [Google Scholar]
- Robert, B.; Feki, M. Control of the stepping motor. In Control of Non-Con- Conventional Synchronous Motors; Louis, J.P., Ed.; Wiley-ISTE: London, UK, 2012; ISBN 978-1-848-21331-9. [Google Scholar]
- Gaan, D.R.; Kumar, M.; Sudhakar, S. Real-time precise position tracking with stepper motor using frequency modulation based microstepping. IEEE Trans. Ind. Appl.
**2018**, 54, 693–701. [Google Scholar] [CrossRef] - Derammelaere, S.; Vervisch, B.; Cottyn, J.; Vanwalleghem, B.; Cox, P.; De Belie, F.; Stockman, K.; Vandevelde, L.; Van Den Abeele, G. The efficiency of hybrid stepping motors. IEEE Ind. Appl. Mag.
**2014**, 20, 50–60. [Google Scholar] [CrossRef] - Krause, P.; Wasynczuk, O.; Sudhoff, S.; Pekarek, S. Analysis of Electric Machinery and Drive Systems; IEEE Press Wiley: Hoboken, NJ, USA, 2013; ISBN 978-1-118-02429-4. [Google Scholar]
- Wang, F.; Zhang, Z.; Mei, X.; Rodríguez, J.; Kennel, R. Advanced control strategies of induction machine: Field oriented control, direct torque control and model predictive control. Energies
**2018**, 11, 120. [Google Scholar] [CrossRef] - Blackburn, J.L. Symmetrical Components for Power Systems Engineering; Marcel Dekker: New York, NY, USA, 1993. [Google Scholar]
- Monmasson, E.; Cirstea, M.N. FPGA design methodology for industrial control systems—A review. IEEE Trans. Ind. Electron.
**2007**, 54, 1824–1842. [Google Scholar] [CrossRef] - Ricci, S.; Meacci, V.; Birkhofer, B.; Wiklund, J. FPGA-based system for in-line measurement of velocity profiles of fluids in industrial pipe flow. IEEE Trans. Ind. Electron.
**2017**, 64, 3997–4005. [Google Scholar] [CrossRef] - Astrom, K.J.; Hagglund, T. Advanced PID Control; ISA-The Instrumentation, Systems, and Automation Society: Research Triangle Park, CA, USA, 2006; ISBN 13: 978-1556179426. [Google Scholar]
- Kim, W.; Yang, C.; Chung, C.C. Design and implementation of simple field-oriented control for permanent magnet stepper motors without DQ transformation. IEEE Trans. Magn.
**2011**, 47, 4231–4234. [Google Scholar] [CrossRef] - Le, K.M.; Hoang, H.V.; Jeon, J.W. An advanced closed-loop control to improve the performance of hybrid stepper motors. IEEE Trans. Power Electron.
**2016**, 32, 7244–7255. [Google Scholar] [CrossRef] - Jimenez-Fernandez, A.; Jimenez-Moreno, G.; Linares-Barranco, A.; Dominguez-Morales, M.J.; Paz-Vicente, R.; Civit-Balcells, A. A neuro-inspired spike-based PID motor controller for multi-motor robots with low cost FPGAs. Sensors
**2012**, 12, 3831–3856. [Google Scholar] [CrossRef] [PubMed] - Le, Q.N.; Jeon, J.W. Neural-network-based low-speed-damping controller for stepper motor with an FPGA. IEEE Trans. Ind. Electron.
**2009**, 57, 3167–3180. [Google Scholar] [CrossRef] - Matsui, N.; Nakamura, M.; Kosaka, T. Instantaneous torque analysis of hybrid stepping motor. IEEE Trans. Ind. Electron.
**1996**, 32, 1176–1182. [Google Scholar] [CrossRef] - Cetin, E.; Daldaban, F. Analyzing the profile effects of the various magnet shapes in axial flux PM motors by means of 3D-FEA. Electronics
**2018**, 7, 13. [Google Scholar] [CrossRef] - Kazmierkowski, M.P.; Malesani, L. Current control techniques for three-phase voltage-source PWM converters: A survey. IEEE Trans. Ind. Electron.
**1998**, 45, 691–703. [Google Scholar] [CrossRef] - Ricci, S.; Meacci, V.; Russo, D.; Matera, R. Encoder-Motor Misalignment Compensation for Closed-Loop Hybrid Stepper Motor Control. In Proceedings of the 6th International Conference Applications in Electronics Pervading Industry Environment Society (APPLEPIES 2018), Pisa, Italy, 26–27 September 2018. [Google Scholar]
- 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 2016 IEEE Vehicle Power and Propulsion Conference (VPPC), Hangzhou, China, 17–20 October 2016. [Google Scholar]
- Liu, G.F.; Li, H.W. Design of stepper motor position control system based on DSP. In Proceedings of the 2017 2nd International Conference on Machinery, Electronics and Control Simulation (MECS 2017), Dubai, UAE, 24–25 June 2017. [Google Scholar]
- Crnosija, P.; Kuzmanovic, B.; Ajdukovic, S. Microcomputer implementation of optimal algorithms for closed-loop control of hybrid stepper motor drives. IEEE Trans. Ind. Electron.
**2000**, 47, 1319–1325. [Google Scholar] [CrossRef] - Tsui, K.W.H.; Cheung, N.C.; Yuen, K.C.W. Novel modeling and damping technique for hybrid stepper motor. IEEE Trans. Ind. Electron.
**2009**, 56, 202–211. [Google Scholar] [CrossRef] - Derammelaere, S.; Vervisch, B.; De Viaene, J.; Stockman, K. Sensorless load angle control for two-phase hybrid stepper motors. Mechatronics
**2017**, 43, 6–17. [Google Scholar] [CrossRef] - Gutierrez-Villalobos, J.M.; Rodriguez-Resendiz, J.; Rivas-Araiza, E.A.; Martínez-Hernández, M.A. Sensorless FOC performance improved with on-line speed and rotor resistance estimator based on an artificial neural network for an induction motor drive. Sensors
**2015**, 15, 15311–15325. [Google Scholar] [CrossRef] [PubMed] - Gómez-Espinosa, A.; Hernández-Guzmán, V.M.; Bandala-Sánchez, M.; Jiménez-Hernández, H.; Rivas-Araiza, E.A.; Rodríguez-Reséndiz, J.; Herrera-Ruíz, G. A new adaptive self-tuning Fourier coefficients algorithm for periodic torque ripple minimization in permanent magnet synchronous motors (PMSM). Sensors
**2013**, 13, 3831–3847. [Google Scholar] [CrossRef] [PubMed]

**Figure 1.**In a stepper motor the torque is related to the load angle ${\theta}_{L}$, present between the rotor magnet, ${\theta}_{R}$, and the current field, ${\theta}_{I}$. The target load angle ${\theta}_{Lt}$ is obtained by advancing of ${\theta}_{In}$ the current field ${\theta}_{i}$.

**Figure 3.**The electronics system is composed of the DECA Max10 and the EVLPOWERStep01 developing boards connected through a homemade interface board. A second drive board can be connected to simultaneously drive 2 motors.

**Figure 4.**FPGA implementation of the proposed method. Control step 1 and Control step 2 refer to the calculations reported in the corresponding steps of Figure 2.

**Figure 6.**Experimental set-up with the stepper motor (left) connected to the encoder (right) through a flexible mechanical coupling (center).

**Figure 7.**Rotor (RP) and Current (CP) Positions, Step Increment ($S{T}_{i}$), and measured Load Angle ($L{A}_{M}$ ) with fixed 2.5 A phase currents and 16 µ-steps target load angle ($L{A}_{T}$ ).

**Figure 8.**The rotor position is controlled at position 0. An external positive torque is applied and released at t = 0 (vertical dashed line). From top to bottom, physical Rotor position P

_{A}, motor current ratio (I

_{t}/I

_{M}), target (LA

_{T}) and measured (LA

_{M}) load angles, and load angle error (Err), are reported.

**Figure 9.**Movement of 2π rad with acceleration of 270 rad/s

^{2}and maximum velocity of 16.4 rad/s, performed with motor free (left column) and with a load of 20% motor capacity (right column). From top to bottom, Shaft position (P

_{A}), Position error (Perr), Velocity (Vel), motor current ratio (I

_{t}/I

_{M}), target load angle (LA

_{T}), and load angle error (Lerr), are reported.

Condition | Control Strategy | Angle | Current | Torque | |
---|---|---|---|---|---|

$\frac{{\Gamma}_{E}}{{\Gamma}_{M}}>0.1$ | Angle fixed, ${\Gamma}_{E}$ modulated by $I$ | ${\theta}_{L}=\pm \frac{\pi}{2}$ | $I$ | ${\Gamma}_{E}=\pm {K}_{t}I$ | (2a) |

$\frac{{\Gamma}_{E}}{{\Gamma}_{M}}<0.1$ | Current fixed ${\Gamma}_{E}$ controlled by ${\theta}_{L}$ | ${\theta}_{L}$ | $I=\frac{{I}_{M}}{10}$ | ${\Gamma}_{E}={K}_{t}\frac{{I}_{M}}{10}\mathrm{sin}\left({\theta}_{L}\right)$ | (2b) |

Condition | Control Strategy | Angle | Current | Torque | |
---|---|---|---|---|---|

$\frac{{\Gamma}_{E}}{{\Gamma}_{M}}>0.1$ | Angle fixed, ${\Gamma}_{E}$ modulated by $I$ | ${\theta}_{L}=\pm \frac{\pi}{2}$ | $I=\frac{{\Gamma}_{E}}{{K}_{t}}=\frac{{\Gamma}_{E}}{{\Gamma}_{M}}{I}_{M}$ | ${\Gamma}_{E}$ | (3a) |

$\frac{{\Gamma}_{E}}{{\Gamma}_{M}}<0.1$ | Current fixed ${\Gamma}_{E}$ controlled by ${\theta}_{L}$ | ${\theta}_{L}={\mathrm{sin}}^{-1}\left(\frac{10\xb7{\Gamma}_{E}}{{\Gamma}_{M}}\right)$ | $I=\frac{{I}_{M}}{10}$ | ${\Gamma}_{E}$ | (3b) |

FPGA Blok | Logic Cell | Dedicated Reg | Memory Bits | DSP |
---|---|---|---|---|

Nios | 5017 | 3079 | 195,000 | 6 |

StepManager | 45 | 30 | - | - |

LoadAngle + Mapper Blk | 349 | 132 | - | - |

Enc CNT | 167 | 67 | - | - |

MOTOR | |

Model | M1233041 |

Manufacturer | Lam Technologies, Florence, Italy |

Flange | NEMA23 |

Step angle | 1.8° (200 step/rev) |

Hold Torque | 1.1 N·m |

Detent Torque | 0.035 N·m |

Current | 4.2 A |

Phase Resistance | 0.4 Ohm |

Phase Inductance | 1.2 mH |

Rotor Inertia | 0.280 kg·cm^{−2} |

ENCODER | |

Model | REV621 |

Manufacturer | Elap, Milan, Italy |

Zero reference | yes |

Pulse/revolution | 10,000 |

© 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Ricci, S.; Meacci, V.
Simple Torque Control Method for Hybrid Stepper Motors Implemented in FPGA. *Electronics* **2018**, *7*, 242.
https://doi.org/10.3390/electronics7100242

**AMA Style**

Ricci S, Meacci V.
Simple Torque Control Method for Hybrid Stepper Motors Implemented in FPGA. *Electronics*. 2018; 7(10):242.
https://doi.org/10.3390/electronics7100242

**Chicago/Turabian Style**

Ricci, Stefano, and Valentino Meacci.
2018. "Simple Torque Control Method for Hybrid Stepper Motors Implemented in FPGA" *Electronics* 7, no. 10: 242.
https://doi.org/10.3390/electronics7100242