# Stepper Motor

Implement stepper motor model

## Library

Fundamental Blocks/Machines

## Description

The Stepper Motor (STM) block implements a generic model that represents two most popular families of stepper motors:

• Variable-reluctance stepper motors

• Permanent-magnet or hybrid stepper motors

The Stepper Motor model consists of electrical and mechanical sections. The electrical section is represented by an equivalent circuit, configuration of which depends on the motor type. The equivalent circuits have been built with the supposition that the magnetic circuit is linear (no saturation) and the mutual inductance between phases is negligible. The mechanical section is represented by a state-space model based on inertia moment and viscous friction coefficient.

For a variable-reluctance stepper motor, the equivalent circuit for one phase is shown in the following figure.

In this model, Ra and La(θ) represent respectively the resistance and the inductance of phase A winding. The winding inductance varies as a function of the rotor position:

La(θ) = L0 + L1cos(Nrθ),

where L0 is the average inductance, L1 is the maximum inductance variation and Nr is the rotor teeth number.

Note that at the reference position (θ = 0), the rotor tooth is fully aligned with A-axis pole so that the A-phase winding inductance is then maximum.

The total electromagnetic torque produced by the motor is the sum of the torques produced by the motor phases:

${T}_{e}=\sum _{x=1}^{m}0.5{i}_{x}^{2}\frac{d{L}_{x}}{d\theta },$

where m is the phase number, ix is the winding current in phase x and Lx is the inductance function of phase x winding.

For a permanent-magnet (PM) or hybrid stepper motor, the equivalent circuit for one phase is shown in the following figure.

In this model, Ra and La represent respectively the resistance and inductance of A-phase winding. Due to the large value of the air gap introduced by the magnets, the winding inductance of the permanent-magnet or hybrid stepper motor can be considered to be independent of the rotor position. The voltage source ea(θ) represents the motor back EMF (electromotive force) which is a sinusoidal function of the rotor position:

${e}_{a}\left(\theta \right)=-p{\psi }_{m}\mathrm{sin}\left(p\theta \right)\frac{d\theta }{dt},$

where p is the number of pole pairs and ψm is the motor maximum magnetic flux.

Note that at the reference position (θ = 0), the North pole on the rotor is fully aligned with A-axis pole so that the A-phase back EMF is then zero.

The electromagnetic torque produced by a two-phase PM or hybrid stepper motor is equal to the sum of the torque resulting from the interaction of the phase currents and magnetic fluxes created by the magnets and the detent torque, which results from the saliency of the rotor:

Te = –miasin() – mibsin(π/2) – Tdmsin(2).

## Dialog Box and Parameters

Motor type

Select `Variable reluctance` to implement a variable-reluctance stepper motor.

Number of phases

You can select 3, 4 or 5 phases.

Maximum winding inductance

The maximum inductance Lmax (Henry) of each phase winding.

Minimum winding inductance

The minimum inductance Lmin (Henry) of each phase winding.

Winding resistance

The resistance Ra (ohm) of each phase winding.

Step angle

The step angle (degrees) of the rotor movement.

Total inertia

The total inertia momentum J (kg.m2) of the motor and the load.

Total friction

The total viscous friction coefficient B (N.m.s) of the motor and the load.

Initial speed

The initial rotation speed ω0 (rad/s).

Initial position

The initial rotor position Θ0 (degrees).

Motor type

Select `Permanent-magnet/Hybrid` to implement a permanent-magnet or hybrid stepper motor.

Number of phases

You can select 2 or 4 phases.

Winding inductance

The inductance La (Henry) of each phase winding.

Winding resistance

The resistance Ra (ohm) of each phase winding.

Step angle

The step angle (degrees) of the rotor movement.

The maximum flux linkage ψm (V.s) produced by the magnets.

Maximum detent torque

The maximum detent torque Tdm (N.m) resulting from the saliency of the rotor.

Total inertia

The total inertia momentum J (kg.m2) of the motor and the load.

Total friction

The total viscous friction coefficient B (N.m.s) of the motor and the load.

Initial speed

The initial rotation speed ω0 (rad/s).

Initial position

The initial rotor position Θ0 (degrees).

## Inputs and Outputs

`TL`

The mechanical load torque (in N.m). TL is positive in motor operation and negative in generator operation.

`m`

The Simulink® output of the block is a vector containing 5 signals. You can demultiplex these signals by using the Bus Selector block provided in the Simulink library.

Signal

Definition

Units

Symbol

1

Phase voltage

V

Vph

2

Phase current

A

Iph

3

Electromagnetic torque

N.m

Te

4

Rotor speed

w

5

Rotor position

Theta

## How to Get Stepper Motor Parameters

The parameters used in the stepper model are usually obtained from the manufacturer data sheets. In the case where the parameters are not available, they can be determined from experimental measurements.

### Variable-Reluctance Stepper Motor Parameters

The parameters provided by manufacturer data sheets are usually: number of phases, holding torque, step angle, voltage per phase, current per phase, winding resistance (Ra), maximum inductance (Lmax), average inductance (L0), and rotor inertia (J).

### Permanent-Magnet/Hybrid Stepper Motor Parameters

The parameters provided by manufacturer data sheets are usually: number of phases, holding torque, step angle, voltage per phase, current per phase, winding resistance (Ra), winding inductance (La), and rotor inertia (J).

The maximum detent torque (Tdm) is not always specified. This parameter can be assumed to be equal to 1-10% of the maximum holding torque.

The maximum flux linkage (ψm) is not always specified. This parameter can be obtained experimentally by driving the motor to a constant speed N (rpm) and by measuring the maximum open-circuit winding voltage Em (V).

The parameter ψm is then computed by the following relation:

ψm = (30/)(Em/N),

where p is the number of pole pairs given by p = 360 / (2m·step). Here m = phase number, step = step angle in degrees.

## Example

The `power_steppermotorpower_steppermotor` example illustrates the operation of a stepper motor drive using a two-phase hybrid stepper motor model.

The motor phases are fed by two H-bridge MOSFET PWM converters connected to a 28 V DC voltage source. The motor phase currents are independently controlled by two hysteresis-based controllers which generate the MOSFET drive signals by comparing the measured currents with their references. Square-wave current references are generated using the current amplitude and the step frequency parameters specified in the dialog window. The movement of the stepper drive is controlled by the STEP and DIR signals received from external sources.

The following waveforms are obtained from a simulation of 0.25 sec operation of the stepper motor drive during which the stepper rotates during 0.1 sec in the positive direction, stops for 0.05 sec, rotates in the reverse direction for 0.05 sec and stops.

Detailed waveforms are shown in the following figure.

## References

[1] T. Kenjo, A. Sugawara, Stepping Motors and Their Microprocessor Controls, 2nd Edition, Oxford University Press, Oxford, 2003.

[2] P. Acarnley, Stepping Motors - A guide to theory and practice, 4th Edition, The Institution of Electrical Engineers, London, 2002.