Routing the filtered output of a simple low-pass filter to the input of another low-pass filter creates a cascading filter. Making a single-pole filter is easy, so it takes just a little more effort to make a two-pole filter by copying, pasting, and doing a little editing. The result is that the noise will be attenuated twice as fast than it is with a single-pole filter. The disadvantage of using two single-pole filters is that the phase delay increases even more rapidly. Each pole adds up to 90˚ of phase delay and will cause the amplitude of the signal to be attenuated by -3 dB at the cutoff frequency.

yn = A yn-1 + B xn              (6)

qn = A qn-1 + B yn              (7)

where qn is the new filtered output.

Two-pole low-pass filters
A two-pole low-pass filter is more effective at attenuating noise than a one-pole filter. It can function like two cascaded single-pole low-pass filters, but the calculations for the coefficients get a little more complicated because there are more of them. If you decide to go through this much effort, you should consider another improvement step and skip to a two-pole Butterworth filter.

Two-pole Butterworth filters
Compared to two-pole filters, two pole Butterworth filters have the advantage that gain stays closer to unity below the corner frequency. The gain for simple low-pass filters starts to roll off at lower frequencies sooner. Also, phase delay of the Butterworth filter is less than with the cascaded two-pole low-pass filter.

Figure 1 shows that each pole will add up to 90˚ of phase delay at higher frequencies. The Butterworth filter is a little better than the two-pole filter because its “knee” at the cutoff frequency is sharper and closer to that of an ideal low-pass filter. Therefore, the Butterworth filter will not affect the response below the cutoff frequency as much as the simple two-pole low-pass filter will. Plus, the Butterworth filter is better at filtering noise above the cutoff frequency.

Figure 2 shows that the two-pole filters attenuate the signal at a rate of -40 dB per decade instead of just -20 dB per decade of the single-pole filter.

A two-pole Butterworth filter can be implemented as:

z = 21/2/ 2

B0 = 1 - 2e-zv∆t × cos(zv∆t) + e–2zv∆t

A1 = 2e-zvt× cos(zv∆t)

A2 = -e-2zv∆t

yn = (A1yn-1) + (A2yn-2) + (B0xn)

The formulas for calculating the coefficients are derived using matched z transforms. Other methods can be used to calculate the coefficients, but the matched z transform method is the easiest to implement. Also, there are two A coefficients (A1 and A2), and the PLC must remember not only the last output (yn-1), but also the output before that (yn-2).

A comparison of filters
The corner frequency for each of the three filters, where the frequency response has an abrupt change in slope, is 1 Hz, or 2 π radians/sec.

Figure 1 illustrates how noise at each frequency is attenuated. This Bode plot shows that the slope to the right of 1 Hz is twice as steep for the two-pole filters. The noise at 10 Hz will be attenuated by a factor of 100 for the two-pole filters, but only by a factor of 10 for the single-pole filter. The phase lag for the two-pole filters is much more than the single-pole filter’s, Figure 2. However, in an application where the measured value is really only changing at 1 Hz or less, the delay between the filtered value and the true value is about 125 msec for the single-pole filter and 250 msec for the two-pole filters. These delays are fine if the filter value is being used for display, but they are too slow for most control applications. To reduce the delay, the cutoff frequency needs to be increased, but less noise reduction will result. Tradeoffs must always be made when using filters

Some PLCs have analog input cards and output cards that have simple low-pass filters built into them. This often eliminates the need to write a low-pass filter, but the options for the filter cutoff frequencies usually are limited. Some motion controllers have built-in filters that usually are more sophisticated and the sampling is done at a much higher control loop rate than what PLCs can achieve. Therefore, results are usually much better when using a motion controller.

For example, RMC motion controllers, Figure 3, from Delta Computer Systems Inc., contain built-in adjustable filtering parameters for position, velocity, acceleration, and even jerk (derivative of acceleration). In addition to input filtering, these controllers can also filter the control outputs in order to smooth the output to the electrohydraulic control valve. This can be helpful when the control output voltage to the valve is grassy (noisy).

Conclusion
Filtering techniques can help resolve real-world problems in hydraulic systems that would otherwise impact the rate and quality of machine output and increase maintenance costs. Some programmable motion controllers have built-in filtering functions to smooth the inputs and outputs of a motion control loop. But several different options for electronic filtering exist.

Basic low-pass filters have been presented here. The simple single-pole low-pass filter is relatively simple to implement and adjust to obtain desired results. The two-pole Butterworth filter needs to have some calculations done to correctly calculate the filter coefficients, but it reduces noise much better and has a sharper knee at the cutoff frequency and can produce even better results.

Peter Nachtwey is president of Delta Computer Systems Inc., Battle Ground, Wash. For more information on these topics, visit www.deltamotion.com.

Free book details motion control applications

Delta Computer Systems, Inc., Battle Ground, Wash., has released the second edition of its popular practical design guide authored by Delta president and chief motion control engineer Peter Nachtwey.

This 64-page guide covers 16 technical topics in fluid power motion control systems by combining theoretical and practical insights. Designers, mechanical and control systems engineers, fluid power technicians and others will benefit from this guide. The guide’s purpose is to be a resource when applying fluid closed-loop motion control systems in a wide variety of industrial and testing applications.

Topics covered include applications in different industries along with valuable tips related to open and closed loop motion control as they apply to component selection of accumulators, valves, and cylinders. Sensor resolution hints and tuning secrets round out the added information in the guide.

Click here to request a free copy, then enter your contact information and state “Design Guide” in the comments section. You may also call Delta at (360) 254-8688 or e-mail sales@deltamotion.com to request a copy.