# Common Motion Problems and How to Fix Them - Part II

~ Chuck Lewin

### We continue with our deep dive series that gives you tools to diagnose common motion control problems and get your machine back on track!

In this deep dive we provide the second part of a multi-part deep dive series on how to fix common motion control problems.

## My Machine Looks A Bit Shaky

There are a couple of behaviors that can make a machine look like it's knocked back a few. The most obvious is having a motion axis overshoot the target destination, but others include accelerations or decelerations that cause the whole machine, or specific parts of the machine, to move when only the axis should move.

In a perfect world, the machine is rigid, and axes don't interact. So let's start with the number one way that you can make your machine look strong and stable.

### Make it strong and stable!

When axes move, Newton's laws of motion apply. For every action there is an equal and opposite reaction. When your main drive motor accelerates the load, the force imparted on the load is also reflected back onto the machine chassis. If this support chassis isn't stiff, it will deflect a small amount in the opposite direction to the motion.

Worse, this chassis deflection has its own natural resonance frequency. After deflecting, the chassis may bounce back and impart a secondary force on the moving load, which may then cause it to overshoot, which in turn can cause the servo to drive the motor back, etc.

Even if the load looks fine as it runs, small deflections of the mechanics can increase settling time and reduce accuracy. So building the tightest mechanical system that you can almost always has benefits. The tighter the mechanics, the faster you can accelerate the load without exciting resonances.

### Measure the machine

A basic approach to getting a handle on the dynamic performance of your mechanics, although one not used often enough, is to drive each loaded axis with a sinusoidal position command, slowly increasing the frequency. For highest accuracy, you can measure movement of the actual axis load with a separate encoder or strain gauge, but you will usually get similar information if you look at the magnitude of the servo error at the motor you are driving. This is because resonance, even if mainly caused by deflection located 'out there' in the mechanics, will reflect back into the motor making servo tracking more difficult, and increasing the average servo error.

Figure 1: Sine Sweep

You can use this 'sine sweep' approach before and after adjustments and design changes in the mechanics to get a measure of how things are improving. In a perfect world, you will not excite resonances in any part of the range of the frequencies associated with the accelerations you will be using while the machine is moving.

How is acceleration related to frequency? This gets a bit complicated mathematically, but is related to what is called Fourier Theory. The net net is that abrupt changes such as those found in square waves generate energy at high frequencies (actually high and low frequencies), and smoother transitions just at lower frequencies. Measuring the machine and understanding where your resonances are will help you determine how aggressively (read that abruptly) you can change acceleration without exciting the load into resonance.

### Smooth out the profile

At some point you will have reached the limit of what can be done with the mechanics. For cost reasons or any number of other reasons, at some point you need to optimize the performance for the mechanics you have. So what to do?

The single most important tool you have to avoid exciting resonances is the trajectory profile. The trajectory profile affects how torque gets injected into the load and therefore also the chassis. As mentioned above, the basic principle at play here is to avoid injecting torque at higher frequencies, because high frequencies are more likely to excite a resonance in the mechanics.

Figure 2: S-Curve Profile ("S" segments are I, III, V & VII)

For point-to-point moves, plan on using an S-curve profile (Figure 2). S-profiles transition smoothly between accelerations, resulting in less injected vibration energy into the mechanics. Think about driving a car and decelerating to a stop. Although you may not realize it, good drivers ease off the brake pedal at the very end of the stop and 'feather' the deceleration to zero. Without this, the car would oscillate back and forth on its rubber tires at the end of the stop.

The "S" portion of the profile eats up transfer time though. So play around with the profile S-curve until you're sticking the landing and also getting good transfer times. Happily, it often takes very little S to dramatically reduce the overshoot at the end of the move.

### Get a tune-up

The next area to work on is the servo loop. Focus on developing stable profile parameters that work well for all settling positions of the axes, and for new and old machines.

Particularly if you are fighting a resonance, you may get good improvement out of a frequency-based filter in the control loop. Usually provided as a general purpose bi-quad filter, you can construct notch or band-pass filters that help tune out certain specific resonances that you have recorded in the mechanics during your sine sweep studies.

Frequency-specific servo tricks tend to be limited in their effectiveness though, so don’t expect miracles. With wear and tear, resonances can change over time, and each new machine may be a bit different in its characteristics as it comes off the line.

## My Step Motor Suddenly Stops During Acceleration Or At High Speed

Step motors are like the old nursery rhyme; when they are good they are very very good, but when they are bad they are horrid. The symptom that we are talking about here is the occasional tendency of the step motor to suddenly 'fall off the train' and coast to a stop during acceleration, or at high speed.

What is happening is that the step motor and load cannot keep up with the request for motion, and they lose step-lock, also known as synchrony, with the commanded profile. Once the condition starts, on-the-fly recovery is impossible - the profile proceeds even farther forward while the step motor comes to an unceremonious halt.

To understand why this happens, it is helpful to keep a model of how mechanical torque is generated in step motors. When the motor's coils are excited, a force 'valley' is created which drives the step motor to settle at a specific position. This is shown in Figure 3:

Figure 3: Force 'Valley'

When motion begins, the electronic controller starts moving this valley forward or backward (depending on the commanded direction of motion) in phase space and the motor 'falls' forwards or backwards to keep up. Just like a surfer paddling to slowly catch a wave though, when synchrony loss occurs, instead of sliding happily down the wave face, the board goes up and over the wave and the surfboard is left behind.

### Slow down

A straightforward corrective action is to reduce the commanded profile acceleration. Acceleration of the load means that the load inertia will 'push back' on the step motor. If the acceleration is high enough, this force will eventually cause the motor to lose synchrony. Slowing the acceleration rate reduces the inertial 'push back' force that the step motor has to overcome.

Another aspect of slowing down is to reduce the motor's top speed. Step motors lose torque output at higher speeds because the increased back EMF (electromotive force) and inductive resistance cause the coil current to decrease. Lowering the top speed will give the motor more torque, reducing the chance of synchrony loss.

### Beware of mid-range instability

The symptom of this behavior is that there is a drop in the available torque at a specific frequency located somewhere in the 'mid-range' of overall step rate output. So when the step motor reaches a particular step rate, all of a sudden the effective torque output drops significantly, dramatically increasing the chance of synchrony loss.

Why does this happen? Going back to the hills and valleys metaphor from above, the instability is an interaction of the natural resonance frequency of the motor as it 'climbs' and 'falls back' around the target position (very much like a resonant spring), and the current control circuit. At the instability point, the effective current in each coil may lag excessively, reducing, or even reversing damping effects in the system that normally counteract the tendency of the motor to resonate.

So what to do? There are a number of remedies. The first is to investigate a current control approach that is less susceptible to this problem. This includes special amplifiers that provide anti-resonance control.

Another approach is to use a micro-stepping controller if you aren't already. Relative to full step or half step control, micro-stepping control is less jerky, and therefore has the potential to reduce the impact of mid-range instability.

You can also try using a step motor with a skewed rotor or other step motor design that is designed to minimize resonance or increase natural damping. Other mechanical solutions that you may consider are to add an elastomeric coupler, viscous damper, flywheel, or ferrofluidic coupler to the drive train. Note that these will affect the overall capabilities of the system including positioning accuracy and top speed.

### Increase the voltage

Increasing the motor voltage may or may not be an option, but if it is you will be able to generate more current and therefore increase the torque generating capacity of the motor. This will have the effect of increasing the available acceleration as well as the top speed. Needless to say, don't increase the voltage such that you violate the motor's voltage or current rating.

Another trick that is used to combat mid range instability is to jump right past the step rate where the torque drop off occurs. Many control products, including those from PMD such as Juno® Velocity & Torque IC, provide a separately programmable parameter for the start velocity, which means the trajectory profile immediately jumps to that velocity and accelerates from there. On the deceleration side of the trajectory, the reverse occurs, and the motor jumps to zero speed, bypassing the unstable step rate as it decelerates. Refer to Figure 4 below for a trajectory profile with non-zero starting velocity.

Figure 4: Trapezoidal Profile with Non-zero Starting Velocity

Whether or not this will work in your application depends on a few factors including the load inertia, but it may be worth a try if you are struggling with mid-range instability.

### Commutate

One final, somewhat exotic technique that can cure loss of step motor synchrony is to drive the step motor as if it were a servo motor. This is done by connecting a high accuracy encoder, and phasing the rotor from the encoder feedback position rather than letting the rotor settle to the position established for it by the controller electronics.

This technique has the obvious downside that you will need to add an encoder, thereby adding cost. But since step motors with encoders are becoming more common, this may well be an approach worth considering. Note that you need to select an encoder with fairly high resolution. Standard 1.8° step motors have 50 magnetic pole pairs, and to get reasonable commutation efficiency you will want at least 40 commutatable positions per pole pair (a pole pair is four full steps or one complete electrical cycle). This puts the encoder for this application at 2,000 counts per rotation or higher.

This technique has the added advantage of running your motor more efficiently. As past deep dives have indicated, servo motors only output the torque that is needed to achieve the desired position, while step motors must at all times be driven at a high enough current to guarantee performance under worst-case conditions.

## I Am Losing Or Gaining Encoder Counts

The most common encoder today is the incremental quadrature encoder, and because it uses an encoding scheme that changes state upon a step transition, any noise that occurs on the transmission lines has the potential to cause missed transitions, falsely counted transitions, or count transitions in the wrong direction.

### Use Differential Signaling

Figure 5 shows the quadrature encoder scheme with its A and B signals. Before making any other changes, make sure your design uses a differential two-wire signal scheme for each phase. Differential encoding provides much, much, more external noise protection than single-ended wiring. So if electrical noise is at all a problem, make sure you use this approach.

One note: when connecting using differential signals, make sure that there is still a common ground reference for the differential signals at the sender and the receiver. If the remote sender uses a separate power supply, depending on how it is grounded, its differential output signals may be referenced at a significantly different voltage level than the receiver circuit. This level difference may violate the receivers input specifications.

If, for whatever reason, you don't use differential signaling and instead choose signal-ended signaling, a common, solid, noise-free ground connection is critical.

### Use a receiver with filtering

A filter at the receiver can remove high frequency noise on the encoder signal. The bandwidth of the filter should be significantly higher than the anticipated encoder signal frequency. Many vendors, Performance Motion Devices included, provide built-in filters to improve noise immunity. But if not, consider adding your own.

### Use Shielded Cables

This is in the 'common sense' category, but make sure that all your signal wires are fully shielded, preferably with a ground shield that is connected to an actual chassis ground.

### Separate PWM signals from quadrature signals

Modern amplifiers switch high currents at high speeds to emulate (but with vastly higher efficiency) the function of a linear amplifier. So while some noise will come from the proverbial 'arc welder near the motor', a lot of noise that can be found on quadrature inputs actually comes from the machine's own high current amplifier/motor signals.

So make sure you separate as well as shield motor cabling to/from the amplifier as much as possible to minimize this source of noise.

### Check the Encoder Power

If the length of the cable to the encoder is long, it is possible that the voltage at the encoder may be too low, or may otherwise not meet specification due to noise. If you suspect this, check it to be sure it is within specification.

Particularly if your motion controller card has on-card amplifier ICs or modules, be careful to lay out the card such that sensitive signals are separated, either by distance or by card plane layers, from high current switching signals. Modern PC card fabrication techniques have made 6, 8, or even 10 layer cards easy to work with and affordable. So don't go overboard trying to minimize card layers if a few extra layers will improve noise protection.

Some companies, including Performance Motion Devices, have technical support lines that provide schematic and layout review for controller card designs. So when in doubt, avail yourself of these services to confirm that you are designing the most robust possible system.

### Autocorrect

If using a rotary motor, make sure you select a motor with an Index pulse, and wire this index pulse into your controller to allow it to autocorrect for small losses. To make this work you must tell your controller the number of encoder counts per motor rotation.

Once set up, here's how encoder count autocorrection works: First time around, the controller records the encoder position of the index pulse. Thereafter, upon capturing additional index pulses, it uses the initial capture location as well as the counts rotation parameter you provided during setup to determine if any counts were lost since the previous rotation.

Small corrections to the motor position are made automatically. Large corrections indicate a serious problem, and cause an alarm to be sent to the host controller for further attention.

How well does it work? Very well thank you. For the vast majority of machines that use incremental quadrature encoders, autocorrection means you will never have to worry about losing encoder counts.

### Don't Use an Incremental Encoder!

Perhaps in the category of the solution to 'it hurts when I punch my arm right here', one solution to quadrature count loss is to not use a quadrature encoder. Alternatives include using absolute encoders with digital bus-type encoding schemes such as SSI (Synchronous Serial Interface) or EnDat.

These schemes are inherently more resilient than incremental encoding schemes because a one-time count loss does not mean the correct position is lost forever.

Resolvers are another option if you are operating in a seriously noisy, dirty, high temperature, or high vibration environment. Once common in the machine tool industry, these analog output sensors are still in use but are gradually giving way to the digital serial-network type encoders mentioned above.