Hijacked! - Embedded.com

# Hijacked!

To read original PDF of the print article, click here.

### SpectraHijacked!

Don Morgan

Reader questions prompt a more basic treatment of PWM and motor internals.

Since I started this series, quite a lot of mail has come in with comments and questions concerning motors, PID, motion control, field-oriented control, and pulse width modulation (PWM). I've recieved enough questions, in fact, that I decided to review some of these areas before moving on. I'm going to answer some of the questions by presenting the data that we've covered from a different perspective. I'll also provide additional illustrations.

Specifically, we'll take another look at the physical aspects of controlling brush and brushless permanent magnet motors. Our coverage will also include PWM and a little bit on phase currents. Next month, I'll go into greater detail on the PID algorithms and coefficients. Following that, we will again continue with algorithms on resolver and sinusoidal encoder conversions, which was my initial plan.

PWM
Pulse width modulation is a digital technique for the control of DC supplies to provide varying voltages into a load. I use the word digital because with PWM the full DC supply is either turned on to the load or turned off. That is, power is supplied to the load by means of a series of on and off pulses. The on-time is the period during which the DC supply is placed on the load and the off-time is the period during which that supply is removed, or cut off, from the load.

In this manner, we can control the average voltage delivered to a load. For example, If we have a switch between a light bulb and a 9V battery and we turn the switch on and off at half-second intervals, the bulb experiences an average voltage of 4.5V. This process is illustrated in Figure 1 . To describe this situation, we say that the duty cycle is 50% and the frequency is 1Hz. Most loads, inductive or capacitative, require a higher frequency to achieve tighter control and resolution. Common frequencies for motion control amplifiers range from 4kHz to 20kHz. Whatever the frequency, a 9V supply with a 50% duty cycle will always produce an average voltage of 4.5V.

Click on image to enlarge.

Brush permanent magnet motors
Like brushless motors, brush motors have a rotor (the part that rotates) and a stator (the stationary part). Unlike brushless motors however, the magnets (or field) are mounted on the stator, while the windings (armature) are located on the rotor.

The armature of a brush motor has many windings, or phases, with only one portion excited at any one time, depending on the position of the rotor relative to the stator. Brushes, acting as switches, commutate the motor by connecting current to different windings as the rotor turns. This results in two flux patterns. One generated by the permanent magnets in the stator (field) and the other generated by the armature windings.

Electromagnetic torque is created by the interaction of the field flux and the armature flux. To motor, or produce torque, the electrical angle between the field and armature is typically 90 degrees (about 45 mechanical degrees). So on a brush permanent magnet motor, the brushes are arranged so that current-flow in the armature windings produces flux that leads the stator flux by 90 degrees. So many phases are possible in such an arrangement that each one represents only a few electrical degrees of rotation, making for mostly ripple-free torque.

The relationship between current and torque on a permanent magnet machine is linear. It's possible to create a current source for such a motor, but most often the control outputs a voltage to the motor windings.

This works because the loads we are dealing with in motion control are overwhelmingly inductive. In an inductor, current begins to flow after voltage is applied, and, depending upon the amount of inductance, that current will rise to a certain level in a given period of time. The greater the inductance, the less total current will flow in a given period of time.

Techniques for voltage control abound, but PWM is the most frequently used. PWM controls the average voltage to the windings, as with the lamp in Figure 1, and, therefore, the average current to the windings. In a brush permanent magnet motor, torque is a linear function of current.

In Figure 2, we see a typical brush permanent magnet motor driver. It's often called an H-bridge because of the arrangement of the switches and the motor. The four switches in the diagram control both the direction of current through the motor, and, because they are pulse width modulated, the average voltage across the motor. The one important thing to remember is that one never has an upper and lower switch closed in the same leg at the same time. This would result in a short circuit.

Click on image to enlarge.

When we use a brush permanent magnet motor, we can control the voltage across the motor (and therefore the current through the motor and its torque) with PWM. We control the commutation with brushes.

Brushless motors
Brushless permanent magnet motors differ from brush motors in that the windings are located on the stator and do not move, while the magnets are found on the rotor. The windings are distributed in multiple phases, usually three. Each phase is separated by 120 electrical degrees. One electrical connection exists to each phase. Brush motors switch phases in and out mechanically, and because the device features numerous phases, the motion is relatively smooth. A similar technique is possible on a brushless motor, but because there are only three phases, this technique produces large torque perturbations at each transition.

Therefore, on a brushless motor, the commutation is done electronically. The drive, or power stage, monitors the position of the rotor, usually with an encoder, and excites the appropriate winding to maintain a 90 degree commutation angle.

Figure 3 shows a cross-section of a four-pole brushless motor. If you imagine the rotor making a complete mechanical revolution of 360 degrees, you will notice that the flux from the magnets cycles twice, once for each north/south pair. In other words, there are more electrical cycles than mechanical cycles. In fact, the number of electrical degrees is equal to one half the number of poles on the motor multiplied by the number of mechanical degrees. Most brushless permanent magnet motors have more than two poles.

Click on image to enlarge.

Figure 4 is a diagram of a typical power stage. It consists of six switches configured much like the H-bridge depicted previously but with an extra leg for the third phase. Here, we also use PWM to control the average voltage to each winding, and, therefore, the current through each phase. Again, one never has an upper and lower switch on at the same time. In this diagram, the voltage that we speak of is measured from the input to each phase to the center of the Wye.

Click on image to enlarge.

Thus, we can control the average voltage across each phase with PWM, as in the brush application. But how do we do the commutation?

Commutating a brushless permanent magnet motor
Another technique exists that is more suitable for three-phase motors than the six-step method I described last month (p. 179). It's called sinusoidal commutation. Because a brushless motor can control current in multiple phases independently, it moves the winding flux in very small increments.

To understand this, recall Kirchoff's law, which states that the sum of all currents, voltages, and fluxes in an electrical circuit must equal zero. That relationship is represented by the following formulae:

for current

for voltage

for flux

A simple way to understand this is to imagine a water hose. The water moving into the hose, which we'll call +water, must be equal in amount to the water coming out of the hose, which we will call ≠water. Therefore, if we add the +water to the ≠water, we'll get zero. No other waters are involved. If water goes in one end it will come out the other. A three-phase system is similar, except we have three bi-directional inputs. With a high frequency PWM we can make fine adjustments to the amount and the angle of the stator flux.

If we examine the motor from the stator point of view, we see three-phase current flux angles that change constantly. If, however, we assume a fixed position on the rotor, we can see that two fluxes must be present in a motor for it to move and produce torque, and that they will be about 90 degrees from one another. One is the rotor flux, which in a permanent magnet motor, is fixed by the circular magnets on the rotor. The other, the stator flux, is generated by the three-phase windings on the stator. These two fluxes can be mathematically generated by two currents, Id and Iq. This separation of currents is a mathematical operation illustrated by the vector sum in Figure 5. The vector sum of the flux generated by the magnets on the armature and the flux from the windings on the stator, result in a third vector often referred to as torquing flux.

Click on image to enlarge.

Recall that we are imagining this picture from a fixed position on the rotor. Here, the values of Id and Iq change very slowly. You will see from the vector diagram in Figure 5 that on a permanent magnet motor, it is only necessary to manipulate the winding flux to create acceleration, deceleration, or a profile, because the flux from the permanent magnets is fixed. This means that on a brushless permanent magnet motor, the Id may be zero.

But to control the stator flux, we need to generate phase currents; or, you could say, we want to use our power bridge to produce an average voltage across each phase that will generate the proper flux in the windings to cause the motor to turn as we choose. It can be shown (please see the bibliography) that Iq and Id are a result of the individual phase currents and the position of the rotor as shown here:

This formula is the product of twoformulae:

,

Equation 2 transforms three phase currents, ia, ib, and ic, to a homopolar system, but with reference to the stator. This means the values ia and ib change rapidly with time. To get to the fixed position on the rotor where Id and Iq (jd and jq) are moving very slowly, we need to make one more change, and that is a simple rotation based on the position of the rotor relative to the stator. An encoder usually supplies this angle. This transformation is given in Equation 3.

Thus, we have one of the most popular and effective algorithms for controlling permanent magnet motors.

Induction motors
We can view an induction motor much like a brushless permanent magnet motor. The primary difference is that the induction motor has a wound armature instead of permanent magnets. The armature is magnetized by the stator windings; this is the Id component in Equation 1 that must now be supplied to the motor. As a result, an induction motor requires approximately one-third more current to run than a comparable permanent magnet motor.

Next month, we dig more deeply into the PID algorithm and the meaning of the terms and coefficients.

Don Morgan is senior engineer at Ultra Stereo Labs and a consultant with 25 years' experience in signal processing, embedded systems, hardware, and software. Morgan recently completed 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 .

Figures

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