Theoretical BEMF during current zero-crossing

Get Complete Project Material File(s) Now! »

Technical Background and Theory

This section presents relevant technical background and theory about stepper motors and stall detection. It briefly describes the functionality of linear stages and stepper motors, details what the load-angle is, how it can be measured, and finally how it can be used for stall detection. This is necessary to later understand the experiments with a com-mercial stall detection system (Trinamic’s StallGuard) and to find out how it functions in practice.

Linear Stages

Using a ball screw as depicted in Fig. 2.1, an object (e.g. a stool sample under a mi-croscope) can be put on the platform and moved along an axis by spinning the shaft. When in addition using a high-precision motor, such as a stepper, the sample can be positioned with high precision. For example, using a screw with a pitch of 2 mm, and a stepper with 200 steps per revolution, the theoretical step size is 2200mm = 10µm. Further precision can also be attained by moving partial steps (micro-stepping). For example, using 256 microsteps per full step theoretically leads to a step size of 0:04µm. While this assumes perfect mechanical construction and operation, it nevertheless hints at how good the precision can get. As a comparison, Soil-Transmitted Helminth (STH) eggs are approximately 50-60 µm in diameter at their longest points, more than 1000 times the theoretical step size.
Since all linear stages used in this project are motorized, the term “linear stage” is used with the implication that it is motorized using a stepper motor, unless otherwise specified.

Sensorless homing

For each linear stage, the relative position from startup can be determined by counting the step commands sent to the stepper-motors. As such, the position of the platform can be tracked in an open loop, without any feedback from a sensor. However, to get the absolute position along the shaft, the initial position still needs to be determined. This is commonly referred to as homing of the axis. For example, it could be used to position the platform at a specific distance from the start of the shaft, getting it directly under the microscope.
One way to home an axis is to move the motor in a single direction until it hits the physical endpoint of the shaft, where it is unable to move any further. This is exemplified in Fig. 2.2. Then, the absolute position is known to be the end of the axis and an initial absolute position has been acquired. To detect the endpoint, a limit switch can be used, e.g. an optical sensor or physical switch. Alternatively, endpoint detection can be done without any external sensors. This is called sensorless homing, where for example measurements on the current and voltage of the motor coils are used instead.

Trinamic StallGuard

A specific commercial implementation of sensorless endpoint detection is StallGuard from Trinamic Motion Control [4]. It is a sensorless load estimator present in many of their stepper drivers. It can determine the approximate load torque on the motor without external sensors, measuring up to 1024 discrete levels of load. The project at Etteplan currently uses stepper drivers from Trinamic, meaning StallGuard is available at hand for stall detection in this thesis project.

Stepper Motor

Operating principle

The operating principle of a stepper motor is, similar to many other motors, to apply a magnetic field to a rotor. An illustration of this is shown in Fig. 2.3. Specifically, it is showing a Permanent Magnet (PM) stepper motor, which is characterized by a central PM (rotor) which is moved by the magnetic field of the coils (stator) [10]. By moving the magnetic field ahead of the rotor, the rotor follows and a rotating motion, a step, is achieved. By keeping the magnetic field constant, a fixed position can be held indefinitely. Additionally, the relative position of the rotor can be known by keeping track of how many steps in each direction it has moved.
In a practical setting, the rotor often has more than two poles, instead using a set of teeth of alternating magnetic polarity. This is called a hybrid stepper motor. An example of this is shown in Fig. 2.4. Such a construction achieves a small rotation between steps, typically 1.8° [10], and less distance between the magnetic poles of the stator and the rotor. The motor is constructed such that the teeth of the rotor align with at most the teeth of one phase at a time (coil 1 and 3 or 2 and 4). As such, actuating the other phase instead will move the rotor one step to align with those teeth. The operating principle remains the same as shown in Fig. 2.3: actuating alternating stator coil pairs (phases) to move the rotor. The step size is simply smaller and torque higher.

Micro-stepping

Micro-stepping is a technique to divide each step into several smaller steps, an illustra-tion of which is shown in Fig. 2.5. By using more current levels than coils just being on or off, a smoother motion is achieved. A step is divided into a fixed number of micro-steps, commonly up to 256, where the current levels of the micro-steps together form a sinusoidal shape. The rotor can also be held at a fixed micro step position. For example, actuating neighbouring coils both with the same current, the rotor will be pulled to a position precisely in between them.

The load angle of the motor is the angle between the magnetic fields of the rotor and the stator. It is also a measurement of the mechanical load being driven by the motor, meaning it is an indication of the force counteracting the rotor’s current position. As the load angle increases, the rotor will increasingly lag behind the magnetic field of the stator.
If there is no load, the rotor will align itself with the stator such that all magnetic forces are aligned with the rotor normal and cancel out, thus producing no torque. This is shown to the left in Fig. 2.6 and Fig. 2.7. By rotating the rotor (e.g. by applying a load), the rotor will no longer be aligned with the stator’s magnetic field. The effect is that the magnetic forces produce a net torque counteracting the rotation. This is shown in the middle of Fig. 2.6 and Fig. 2.7. To the right is shown the maximum load angle in a hybrid stepper motor: 90°. Any increase in load angle at this point will cause the rotor teeth to align with the previous ones of the stator, moving backwards with respect to the stator, which is called a step loss.

Use-cases

The idea of sensorless load angle estimation is to, without any external sensors, estimate the load angle of the motor during operation of varying load. It has both been covered in research, e.g. by [12], and is available in commercial products such as Trinamic Motion Control’s StallGuard [4]. Since, as shown, the load angle is roughly proportional to the sine of the load torque, load angle estimation is in effect also load torque estimation. This has several potential use cases, such as:
• Reducing current for low load, saving energy and producing less heat.
• Detecting step-loss by the load angle becoming too large.
Specifically of interest to this work is detection of step-loss, since this is what happens during stalling of the motor; the load torque becomes too large for the produced torque to keep the rotor in sync with the magnetic field of the stator. By estimating the load angle, a motor step-loss can be detected by the load angle becoming large.

When the rotor is rotating, its magnetic poles are moving and applying a varying mag-netic field to the stator’s coils, essentially acting as a generator. By Faraday’s law, this induces an electro-motive force in the coils, also known as Back-EMF (BEMF). For a given stator phase, the BEMF will be a sinusoidal voltage over that coil. As shown by [12], the load angle can be effectively estimated with knowledge of the phase difference between BEMF and the coil current (also sinusoidal).
An illustration of how the phase difference between coil current and BEMF relates to the load angle is shown in Fig. 2.8. The phase of the BEMF (\E) is 90° ahead of the phase rotor flux (\ r), which is fixed to the actual rotor rotation. The phase of the coil current (\is) is fixed to the stator’s magnetic field. Thus, the phase difference between the two magnetic fields (the load angle ) can be determined from the phase difference between the BEMF and the coil current as follows: = \is \ r = \is + 90 \E (2.2)
To determine E, the voltage u over a stator coil can be modelled as [13]: dis + E (2.3) u = RiS + L dt where is is current, R is coil resistance, L coil inductance, and E is BEMF, the variable of interest. Measuring u and is is trivial, but as suggested by [11], simply solving for E does not work in practice due to taking the derivative didts of a noisy signal. Addi-tionally, R and L are possibly unknown for the used motor or may change significantly with temperature. To overcome these problems, several methods have been presented, two of which are detailed in the following sections. One measures E at the precise mo-ments when didts = is = 0 and one uses a Fourier transform to extract the fundamental sinusoidal component of E without noise.

Current zero-crossing method

Measuring BEMF E during current zero-crossings has been suggested by [12] and [14]. Once every full step one of the phases will change direction of current, passing zero. Giving the current time to settle (the coil’s magnetic field collapsing), the current and its rate of change is zero: didts = is = 0. This simplifies Eq 2.3 to u = E, meaning the BEMF can be measured directly as the voltage over the phase coil.
Measuring E during current zero-crossing does not directly include information about the phase and thus load angle as per Eq 2.2. However, it can be calculated given knowledge of the motors BEMF constant Ke. For a two-phase hybrid stepper motor, the exact BEMF that will be measured for the first phase is [12]:
This section presents relevant technical background and theory about stepper motors and stall detection. It briefly describes the functionality of linear stages and stepper motors, details what the load-angle is, how it can be measured, and finally how it can be used for stall detection. This is necessary to later understand the experiments with a com-mercial stall detection system (Trinamic’s StallGuard) and to find out how it functions in practice.

Linear Stages

Using a ball screw as depicted in Fig. 2.1, an object (e.g. a stool sample under a mi-croscope) can be put on the platform and moved along an axis by spinning the shaft. When in addition using a high-precision motor, such as a stepper, the sample can be positioned with high precision. For example, using a screw with a pitch of 2 mm, and a stepper with 200 steps per revolution, the theoretical step size is 2200mm = 10µm. Further precision can also be attained by moving partial steps (micro-stepping). For example, using 256 microsteps per full step theoretically leads to a step size of 0:04µm. While this assumes perfect mechanical construction and operation, it nevertheless hints at how good the precision can get. As a comparison, Soil-Transmitted Helminth (STH) eggs are approximately 50-60 µm in diameter at their longest points, more than 1000 times the theoretical step size.
Since all linear stages used in this project are motorized, the term “linear stage” is used with the implication that it is motorized using a stepper motor, unless otherwise specified.

Sensorless homing

For each linear stage, the relative position from startup can be determined by counting the step commands sent to the stepper-motors. As such, the position of the platform can be tracked in an open loop, without any feedback from a sensor. However, to get the absolute position along the shaft, the initial position still needs to be determined. This is commonly referred to as homing of the axis. For example, it could be used to position the platform at a specific distance from the start of the shaft, getting it directly under the microscope.
One way to home an axis is to move the motor in a single direction until it hits the physical endpoint of the shaft, where it is unable to move any further. This is exemplified in Fig. 2.2. Then, the absolute position is known to be the end of the axis and an initial absolute position has been acquired. To detect the endpoint, a limit switch can be used, e.g. an optical sensor or physical switch. Alternatively, endpoint detection can be done without any external sensors. This is called sensorless homing, where for example measurements on the current and voltage of the motor coils are used instead.
An illustration of how the phase difference between coil current and BEMF relates to the load angle is shown in Fig. 2.8. The phase of the BEMF (\E) is 90° ahead of the phase rotor flux (\ r), which is fixed to the actual rotor rotation. The phase of the coil current (\is) is fixed to the stator’s magnetic field. Thus, the phase difference between the two magnetic fields (the load angle ) can be determined from the phase difference
between the BEMF and the coil current as follows: = \is \ r = \is + 90 \E (2.2)
To determine E, the voltage u over a stator coil can be modelled as [13]: dis + E (2.3) u = RiS + L dt where is is current, R is coil resistance, L coil inductance, and E is BEMF, the variable of interest. Measuring u and is is trivial, but as suggested by [11], simply solving for E does not work in practice due to taking the derivative didts of a noisy signal. Addi-tionally, R and L are possibly unknown for the used motor or may change significantly with temperature. To overcome these problems, several methods have been presented, two of which are detailed in the following sections. One measures E at the precise mo-ments when didts = is = 0 and one uses a Fourier transform to extract the fundamental sinusoidal component of E without noise.

Current zero-crossing method

Measuring BEMF E during current zero-crossings has been suggested by [12] and [14]. Once every full step one of the phases will change direction of current, passing zero. Giving the current time to settle (the coil’s magnetic field collapsing), the current and its rate of change is zero: didts = is = 0. This simplifies Eq 2.3 to u = E, meaning the BEMF can be measured directly as the voltage over the phase coil.
Measuring E during current zero-crossing does not directly include information about the phase and thus load angle as per Eq 2.2. However, it can be calculated given knowledge of the motors BEMF constant Ke. For a two-phase hybrid stepper motor, the exact BEMF that will be measured for the first phase is [12].

1 Introduction
1.1 Background
1.1.1 Automating diagnosis
1.1.2 Motivation
1.2 Purpose and Goals
1.4 Related Work
1.4.1 Stall detection methods in patents
1.4.2 Load angle estimation in practice
1.4.3 Ystruder
1.5 Outline
2 Technical Background and Theory
2.1 Linear Stages
2.1.1 Sensorless homing
2.1.2 Trinamic StallGuard
2.2 Stepper Motor
2.2.1 Operating principle
2.2.2 Micro-stepping
2.3.1 Use-cases
2.4 Sensorless Load-Angle Estimation From BEMF
2.4.1 Current zero-crossing method
2.4.2 SDFT method
3 Method and Implementation
3.1 System Overview
3.2 Hardware
3.2.1 Stepper motor
3.2.2 Stepper drivers
3.2.3 Linear stages
3.2.4 Raspberry Pi
3.3 Software and Development Tools
3.3.1 Raspberry Pi OS
3.3.2 Python
3.4 Stepper Motor Control
3.4.1 Daisy chaining SPI
3.4.2 Accessing driver registers over SPI
3.5 Tuning StallGuard
3.5.1 SGT tuning background
3.5.2 Implementing automatic SGT tuning
3.6 Sensorless Homing
3.6.1 Selecting velocity and current
3.6.2 Relevance of mechanical construction
3.7 BEMF Measurements
3.7.1 Measuring current
3.7.2 Theoretical BEMF during current zero-crossing
3.7.3 Practical measurements of BEMF during current zero-crossing
3.8 Graphical Application
3.8.1 Program structure
3.8.2 Scaling to multiple drivers
3.8.3 Driver event system for GUI reconfiguration
3.8.4 Cancellable calibration routines
4 Results and Discussion
4.1 Prototype
4.2 Homing Precision
4.3 Automatic Tuning of SGT
4.3.1 Effect of velocity
4.3.2 Effect of current
4.3.3 Effect of supply voltage
4.4 BEMF Measurements
4.4.1 Correlating BEMF and StallGuard result
4.5 Graphical Application
5 Conclusions and Future Work
5.1 Conclusions
5.2 Future Work