CMP EMBEDDED.COM

Login | Register     Welcome Guest   IPS  
HOME DESIGN PRODUCTS COLUMNS E-LEARNING CONFERENCES CODE FORUMS/BLOGS NEWSLETTERS CONTACT FEATURES RSS RSS




DSP and Motion Control

Don Morgan

Motion control is a wide-ranging and complex topic. When I first approached the idea of writing about motion control using DSPs, it seemed fairly straightforward. Having dealt with motion control for almost 20 years, I felt I had the experience, knowledge, and scope to do a decent job. Maybe. Once I started, though, I saw motion control did not fit this neat little package I had anticipated. As a result, I have re-written this column several times, looking for a meaningful entry point to the subject.

In the early '90s, one of the first applications for DSP chips was in motion control. Although this area may not seem to have the sophistication associated with signal analysis or synthesis, it employs many of the same tools and mathematics and has many intriguing features of its own. Not only can DSPs provide extremely facile, precise, and programmable control for any application, but the speed of the DSP and its math engine allows other functions that are usually supported as peripherals to be integrated into the software. This provides an immediate size and cost advantage.

With integration increasing and die sizes dropping, peripherals such as encoder interfaces, PWM generators, multiple synchronous A/Ds, and more are available on the same chip with the DSP. Other functions associated with high-end applications (and expense), such as real-time interpolated sinusoidal encoders, resolvers, and other transducers, can be done in software. This can mean that low-cost encoders/transducers may be used to produce very high resolutions.

With this in mind, I would like to address some of the issues of motion control and control theory in relation to DSP. The truth is that control theory and traditional signal processing are not far apart. The mathematics are the same as what we've been using in our discussions of signal processing, but with a different look. The concerns vary and inevitably involve the time domain. What's more, the processing is more likely to be stochastic than many signal processing applications. Nonetheless, a transfer function remains a transfer function.

In this column, we will look at popular hardware solutions with an emphasis on DSP and PWM, as a number of the manufacturers make parts specifically designed for this increasingly popular form of motion control. We will look at many of the basic algorithms, PID, the Park and Clarke transformations, sinusoidal encoder interpolation schemes, as well as software resolver conversions, PWM generation, and more. And we will delve more deeply into the concerns of control theory.

Our interest is in algorithms, DSPs, and applications. Clearly we cannot really discuss any aspect of these subjects without some familiarity with the concepts of the technology involved. To do this adequately, however, it is necessary to introduce some terms and concepts so that we can see how they relate to DSP and the design of such systems.

What is a motion control system?
What are the components of a motion control system? Typically, there is a trajectory generator and a drive or amplifier for the axis of motion, which may ultimately be a motor but might also be a valve or anything else that the user must control. The trajectory generator commands the drive to produce a given velocity, position, or torque (it may be many things). The drive sources power to the load in accordance with these commands. If motor controls are this uncomplicated, why DSP?

Let's answer this question with an example. Perhaps the simplest implementation of a motion control system would be a basic positioner. People use their cars as positioners. If you wish to drive yourself to work, you probably don't attempt to go from zero to 60mph in an instant, then from 60mph to zero again when you have arrived. The wear and tear on the vehicle and the passenger would be too great for either to last long. You must accelerate, that is, increase your velocity, in measured increments until you have reached a speed suitable to you, your vehicle, and the environment. As you approach your destination, you must decide on a point you feel is appropriate to you, your vehicle, and the environment to begin decreasing this speed, so that you can stop in the right place.

The same is true for any motion control system. The function of providing these measured commands to the system is assumed by what is known as the trajectory generator, and its functionality can become quite complex, depending upon the needs of the system. Most modern applications have special requirements regarding the equipment they control.

In multi-axis applications, the motion of all the axes must be synchronized with the focus of the motion-say, a circle, square, rectangle, or some other shape-executing complicated shapes. This synchronization can come in many forms; it may be geared off a single axis or sourced from a central point. In this case, the trajectory generator must be capable of coordinating the many axes and shaping the motion through splining or some other mechanism, so that all axes arrive correctly at the same place and that this motion is executed exactly, smoothly, and economically.

DSP also becomes involved in the other area of discussion, the drive. The drive is the part that accepts the command-say, a voltage, current, or digital word, usually signifying torque, velocity, or position-from the trajectory generator, and supplies the current, or some other energy, to the load so that it can move. There are many mechanisms for accomplishing this, both analog and digital, and they too are moving to DSP.

Two of the most popular forms of drives are PWM and analog. The analog supplies current to the windings as sinusoids that change frequency and compel the device to move. The PWM drive turns voltage on and off to the windings at a fixed frequency but varying duty cycle, causing the current to the windings to vary in frequency and magnitude with the duty cycle. Both forms have their advantages and drawbacks. DSP can control them both-the analog through DACs and the PWM through pulse generators.

Of the two, PWM is becoming more popular and is now supported directly on many DSP and microcontroller chips. Trajectory generators and drives are the basic components. Now let's look at some forms of control.

Open loop or closed loop?
Control is often referred to as either open loop or closed loop. In an open loop situation, the trajectory generator supplies a command to the drive, scaled to produce an expected result. Here, the trajectory generator does not examine and correct for any system errors. An example of such a control might be a micro-stepper controller as a positioner. The user will usually enter some defaults for acceleration and velocity and give the controller a position to go to. Using the defaults, the controller will calculate accelerations and peak velocities based on how far it must go and whether there are any other special requirements for the move. It will then produce commands for the drive that are expected to take the axis to position. No effort is made to correct for errors the axis may have in attaining velocities or intermediate positions. Using some sort of feedback device (in order to determine when the axis has arrived at its final position), the controller drives the stepper until it arrives at position.

In a closed loop control, the errors are literally added into the equation. 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 velocities, the command is increased in proportion to the error so that it will. This is called servo control-it's driven by error. The loop may be closed on any particular feature in the system, whether it is position, velocity, torque, or some alias.

To view these ideas in another way, imagine an open loop system as a simple operational amplifier. Here, a gain is applied to any input. The result is output. As long as both the input and the output (or load) are well known and bounded, this works fine. But, as with an amplifier, if the input exceeds the parameters of the circuit, you can find yourself with a square wave at the output instead of the nice sinusoid you were hoping for. Such a system can be described with a simple multiplier; it is purely feedforward.

Supplying feedback to the amplifier can produce a filter (or oscillator). A portion of the output is added to the input to refine or adjust the response of the system. This is now a servo system; it produces a transfer function with feedback. As with any system, you may have any combination of feedback and feedforward mechanisms involved. All of this is useful for highly efficient systems because inadequacies in equipment or the load can be overcome by properly modifying the transfer function; this is part of tuning a servo system.

Designing a motion control platform
Some of the most popular motion control applications today involve servo systems and PWM drives. Typically, these controllers will drive anything from AC induction motors (ACIM), permanent magnet synchronous motors (PMSM), brushless DC motors (BDCM), to switched reluctance (SR) motors in industrial applications. Feedback mechanisms are usually encoders, resolvers, or interpolated sinusoidal position transducers.

To get an understanding of the scope of a motion control design, let's look at it using standard parts for the functions. Knowing such a system provides a nice basis for looking at more highly integrated systems on DSP. So let's say that we have a standard DSP, such as a DSP56k, and we wish to build an integrated trajectory generator and PWM drive. (What I'm describing is not the definitive motion control device, but a simple and common implementation.)

We will assume for such a system that the controller is receiving commands from a computer or responding to commands in its own memory. These commands may be position, velocity, or torque commands, and may involve information about other axes and synchronization.

For the system to function, it must have feedback. For our example here, we will assume that it is a simple incremental encoder signal that arrives at a special counter that incorporates some kind of digital filter to remove noise. This gives us position information, but we also need information about the load (motor) in order to control it effectively. This is usually current feedback from two of three axes for a three-phase motor, one of two for a single-phase motor.

Now that the DSP can see position and can compute currents, it is ready to drive the motor. In this case, it needs some mechanism to create fixed frequency pulses that vary in duty cycle according to the values calculated by the DSP. There are a couple of different forms of PWM control, the most popular being center and edge controlled. With edge-controlled PWM, one edge is fixed and the other edge moves with the duty cycle changes. With center-controlled, the center is fixed and both edges move.

Either way, the concept is a simple one: a counter of fixed length driven by a clock. You vary the duty cycle of the output by using different taps to control turn-on and turn-off time. Some manufacturers have rather complex chips for this purpose, but it can be done with a latch if you are willing to sacrifice some computing power and time to the function. And, of course, these pulses must be manufactured for each phase of the motor with sufficient dead time for top and bottom drive transistors to prevent accidental shorts (shoot-through). In a typical three-phase brushless drive, there are six signals-one each for the top and bottom IGBT/FET of the half-bridge associated with that phase. The length of the counter does make a difference; it defines the sort of resolution you can attain. Greater resolution means finer control.

Now you add the motor phase leads to the center of each half-bridge and power and you are ready to go. Of course, we have not looked at the software necessary to drive a three-phase or single-phase PWM system, nor the code for interpreting the current feedback or creating a PID loop or using interpolating sinusoidal encoders, nor resolvers, nor many other things-but we will.

Current integrated DSP offerings
Initially, the DSP was the core of the controller. It was capable of the very fast computation necessary to perform the PID filter operations, position calculations for determining the next velocity. As speeds increased and dies shrank, more and more functions were added to the chip including PWM creation, encoder inputs, and ADCs. Now it's possible to create a complete, high-performance servo application with only a few parts and integrated gate bipolar transistors (IGBTs). This results in inexpensive and interesting applications, such as controller/drive/motor units that may be connected to a central control by merely an optical link or copper pair.

Among the leading contenders for DSP-based motion control are families from Texas Instruments and Analog Devices. Both offer on-board A/D converters, PWM generation capability, counters that can be used for encoder inputs and serial ports for communication, and the addition of external A/Ds and sensors. Both offer a wealth of built-in motion control functions, in addition to standard DSP fare.

TI's offering is the TMS320C24x family. It's a 16-bit, 3.3V, 30 MIPs device with on-board flash and up to 32K words of RAM. Some of which is dual access, allowing more than one access during an instruction cycle. There is a multiplexed (with sample and hold) 10-bit A/D and eight 16-bit PWM channels that allow either edge or centered PWM with programmable dead-band to prevent shoot-through on the IGBTs. It also incorporates an encoder interface and A/Ds. In addition to the standard SCI and SPI ports, some devices even have a CAN port.

Analog Devices' DSP, the ADMC401, is 16 bits, 5V, and 26 MIPs. It sports a 12-bit flash A/D that permits simultaneous sampling on two channels and multiplexed sampling on eight channels. Again, it supports different modes for its PWM generator and deadtime. There is also a high bandwidth quadrature encoder interface with digital filter and a number of other additives. One strong attraction for the Analog Devices part is that it comes with many of the common algorithms for motion control implemented in masked ROM. This, of course, will reduce time to market and memory requirements.

In many modern implementations the trajectory generator and drive are one and the same. You will see how many of the DSPs we present provide functionality for that. The sort of integration provided by the chips mentioned above is making it possible for the motor, drive, and trajectory generator to be a single unit that needs only power and some form of communications, such as an optical cable or twisted pair.

Next month
At least we have made a start. Next month, we'll start looking at some of the algorithms in common use in today's motion controllers.

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.
Embedded.com Career Center
Ready for a change?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS





 :