Look Ma, No Hands! - Embedded.com

# Look Ma, No Hands!

Not all systems have position or velocity sensors. In those cases, consider using a stepper motor to effect sensorless control.

In my most recent columns I've detailed several motion control techniques that employ position and velocity feedback. But what if position or velocity feedback are not available? What if you had to use other means to control the position of an object?

When processing signals digitally, position control can be performed in a number of ways. Some are well known, but others are not. We will be looking at several of them in this column and the next. We will start with the most popular solution, which involves stepper technology. We will then see how motion control can be achieved with more common and, in some ways, higher performance motors. This particular method uses information from the commutation cycle of the motor itself. Finally, we will perform motion control with a simple induction using an observer called a Kalman filter.

Stepper motors

Perhaps the simplest and most accessible application for sensorless control involves the stepper motor. It requires little overhead and can be implemented as an ancillary driver to a DSP system. Stepper motors are polyphase motors (more than one phase) by means of which you can, with a little bookkeeping, always know where the rotor is within the mechanical and electrical constraints of the system.

A stepper motor is basically a motor whose rotor comprises two pole pieces with a number of teeth on each. In between the pole pieces, a permanent magnet is magnetized along the axis of the rotor. Thus, one end of the rotot is a north pole and the other is a south pole. The teeth are offset at the north and south ends so that they are not in line but adjacent to one another. The motor's stator consists of a shell with four teeth that run the length of the rotor. Coils are wound on the stator teeth and are connected together in pairs.

By controlling the direction of the current in the windings you can predictably position the rotor relative to the stator. This is because the direction of the current establishes the pole orientation of the rotor. Tables that represent direction of current flow may be constructed for the various types of steppers, so that they may be driven from interrupt routines. The tables are short and only describe a short distance of rotor travel, but this is repeated again and again around the circumference of the device.

Each of the table entries is called a step and the distance the rotor will move on each step is guaranteed by the mechanical design of the motor. By establishing a starting point and counting each step that you move forward and backward, you can know where you are relative to that starting point, within the tolerances of the motor. By counting revolutions, you can travel great distances and always be in position within the tolerances of the motor. It is, therefore, quite easy to make a sensorless system with a stepper device.

Tables 1, 2, and 3 are tables for typical steppers. The ones represent driven phase windings, or current applied to a phase, and the zeros represent windings that are off.

`Table 1:  Variable reluctance stepperA 	B	C0 	0	10 	1	01 	0	0`
`Table 2:  Permanent magnet with H-bridgeA	B	C	D0	0	0	10	1	0	00	0	1	01	0	0	0`
`Table 3:  Five-phase motor with H-bridgeA	B	C	D	E0	1	1	0	10	1	0	0	10	1	0	1	10	1	0	1	01	1	0	1	01	0	0	1	01	0	1	1	01	0	1	0	01	0	1	0	1`

One simply moves through the table, one step at a time, to turn the motor. These are circular tables that wrap around at both ends.

This technique is useful in three-phase motors too. In the sensorless applications that follow, we use it to start the motor turning and bring it to a velocity at which other methods can take over. This is often called six-stepping a motor. But as useful and simple as this control is, it has certain limitations, and they need to be examined before you choose it. Two of the main problems are fixed and limited torque. Another problem is that the system is open-loop.

Open or closed loop

Control is often referred to as either open-loop or closed-loop. In open-loop control, the trajectory generator supplies a command to the drive. This command is scaled to produce an expected result. The trajectory generator does not examine or correct for any system errors.

In closed-loop control, scaled values of the error are added to the original command to better fit the command to the load. If the axis is not attaining the correct velocities, the command is increased in proportion to the error. This is called servo control; it is driven by error. The loop may be closed on any particular feature in the system, whether that means position, velocity, or torque.

New math

The next two techniques (I only be have room to discuss one of them in this column) involve some basic motor theory and math, which I will cover in this section. Some of it is review.

As you can see in Figure 2, a brushless DC motor consists of two coaxial assemblies separated by an air gap. The first assembly is the outer shell. This is the stator. It is here that the three-phase windings reside. The second assembly is the rotor, which is either an electromagnet or a permanent magnet.

Because a motor and generator have the same architecture, it is possible to take a motor and turn the shaft to generate a voltage at the phase leads. This is due to a flux associated with the magnetic rotor. As the rotor turns, this flux cuts through the wires in the phase windings and generates an electromagnetic force (EMF), or voltage. Unfortunately, this voltage is present even when we drive the device as a motor. Because it is opposite in polarity to the driving voltage, it is called back-EMF; it is independent of the energy we supply to the motor. Back-EMF is directly proportional to the rotation speed, the rotor flux, and the number of turns in the winding in question. Back-EMF is one of the limitations on the performance of a particular motor. As you cause the motor to turn faster, the back-EMF (the voltage created by the rotor's flux) increases. Since it is opposite in nature to the voltage applied to the windings, it serves to limit the current in the winding and, therefore, the torque and top speed.

We call a motor synchronous if the stator flux and the rotor mechanical rotation speeds are the same. A three-phase brushless DC permanent motor is an example of a synchronous motor. If the flux and mechanical rotation speeds are not the same, it is asynchronous. We will discuss an application involving each type.

In one turn, the back-EMF equation is:

The equation for a complete (multi-turn) winding is:

E = nN Φ

where E is in volts, N is rotation speed, and Φ is flux, measured in Webers.

For a given rotor flux, E and N have the same sign, so the rotation sense of the rotor defines the sign of the back-EMF. E will be at its maximum when the variation of the flux is at its maximum. That is when the rotor passes from a north pole to a south pole. This means that the back-EMF is at max when the rotor flux is perpendicular to the phase.

Useful electric power (mechanical power) is:

Pe = EI

where E is the back-EMF and I is the current in the motor.

Torque is:

C = k ΦI

I is current in the motor, Φ is the flux, and k is a proportionality constant.

The power of the motor is:

Pm = C Ω

where Ω is the angular speed of the rotor.

Sensorless control using back-EMF

Once a motor is turning at sufficient speed, we can use back-EMF to monitor and control it. To bring the motor up to a sufficient speed, we use the six-step method I referred to previously in this column. Six-stepping is not efficient, so it isn't generally used alone for motion control.

In Figure 3, you can see pairs of switches that control the current to the winding of our three-phase motor. Because you can't have a top and bottom switch on at the same time in any single branch, it is only in six combinations that current actually flows in the motor. Using any one of those combinations will cause the rotor magnet to align to a pole. We can take a rotor through a complete electrical cycle in six steps. A table can be made for this, just as we did previously for the steppers. I have made one in Table 4.

`Table 4:  Six-step cycleA 	B	C0	0	00	0	10	1	00	1	11	0	01	0	11	1	01	1	1`

To use the back-EMF method, we need to start the motor in this fashion because initially there is little, if any, back-EMF to measure. The speed at which enough back-EMF will register depends on both the motor and your sensing network.

Back-EMF detection consists of reading the instant when the back-EMF crosses zero at each step in the non-energized phase. This is illustrated in Figure 3. To get maximum efficiency from the motor, the commutation should take place when the current in a winding is in phase with the back-EMF in the same winding.

Basically, when back-EMF crosses zero-called a zero crossing -the next commutation is generated after a computed delay. Then, when the winding has demagnetized, the cycle starts again.

These three events must then occur in sequence:

• We sense the back-EMF zero crossing. At this point, the processor computes a delay. This delay depends upon the rotation speed and will vary. As the motor speed increases, zero crossings happen sooner, and we must shorten the delay between zero crossing and commutation. This delay is computed from stepping calculations and a delay coefficient fit to the motor.
• After the delay we perform our next commutation of the motor.
• We watch for winding de-magnetization. Once this occurs, we start the cycle again.

The complete procedure is outlined as follows:

• Start the motor in six-step mode.
• Ramp up to a point at which the zero crossing event can be detected.
• Wait for zero crossing event in back-EMF.
• Invoke a delay dependent upon the step time.
• Perform next commutation cycle.
• Wait for motor demagnetization.

At this point you repeat the cycle except, obviously, without the first two steps, because the motor is already moving at sufficient speed to register back-EMF.

Next month, we will examine a technique that is applicable to both synchronous and asynchronous motors. It ties in with the concept of field-oriented control with a Kalman filter. That technique provides us with a control mechanism that requires no more feedback than the current sensors necessary for field-oriented control. It will also produce good results standing still as well as in motion. And with the introduction of the Kalman filter, we'll have a bridge to discussing many other industrial and scientific digital signal processing applications.

Don Morgan is a senior engineer at Ultra Stereo Labs and a consultant with 25 years experience in signal processing, embedded systems, hardware, and software. Morgan wrote a book about numerical methods, featuring multi-rate signal processing and wavelets, called Numerical Methods for DSP Systems in C. He is also the author of Practical DSP Modeling, Techniques, and Programming in C, published by John Wiley & Sons, and Numerical Methods for Embedded Systems from M&T. Don's e-mail address is .

This site uses Akismet to reduce spam. Learn how your comment data is processed.