# How to Filter Noise of Different Frequency Based on Motor Power

filtermotorsignal processing

I am taking torque readings from strain gauges on an actuator and trying to filter the signal to look usable. I have already put in place a median filter that reduces sporadic spikes.

When I have the actuator locked, I can set its power (through PWM duty cycle) to different values and see the torque readings accordingly. In such a situation, I have 0.1Nm of noise. This is acceptable.

However, when I leave the motor unconstrained, and set it to turn at different speeds (again, set it to different powers through PWM duty cycle), I get high noise on the torque sensor readings that seems to have a direct relation with the speed of the motor.

In this image, you can see the readings while the motor goes from fast to slow in 4 quite obvious steps:

(Obviously, since the motor is free running, the torque readings are (should be) a constant 0.)

My question is, how can I filter this data during the operation of the motor? Offline processing is out of the question, and I imagine the filter window can't be too large (as it produces a large latency in reading the current torque value), but perhaps that's inevitable?

I thought about a low pass filter, naturally, which would work great for high speeds of the motor, where the noise frequency is quite high, but as the motor slows down, I would essentially have to look at seconds of history to be able to filter out that low frequency noise, which is just too high to be useful for feedback control.

The "noise" you are measuring appears to be related to the rotor velocity as you indicate this was measured while decelerating & equally it can be see there is a decrease in frequency.

What is unknown is whether that frequency is matched to the rotor velocity or some higher harmonic. Knowing the frequency correlation between the rotor and the "noise" would facilite in narrowing down the source.

If there is a desire to filter this unwanted component the one complication is a desire to filter from 0Hz to n rotor frequency. This rules out a low pass filter.

Two options

AC rejection

Below is an equation to remove the AC component. It determines the AC component and then subtracts it from the original signal.

\$reject = x - [ x - \frac{1}{N} \sum_{n=0}^{\infty} x ] \$

The equivalent difference equation for the DC rejection filter is:

\$y_n = 0.999*( ( x_n - x_{n-1})+y_{n-1}) \$

As with most filters it is a tradeoff between settling time and rejection capability. The 0.999 factor is the key here. This trades off settling time of rejection.

2. Pass through filter. \$y_n = 0.999*( ( x_n - x_{n-1})+y_{n-1}) \$
3. generate the AC rejected version \$reject = x_n - y_n\$

Taking a ramp of data & superimposing on top of it an increasing in frequency AC component of significant amplitude + some random noise. The tradeoff can be seen below.

NOTE if a complete rejection is required but the settling time is unwanted... there are additional digital tricks to help the filter deal with large delta's

NOTE2: the effectiveness of the 0.9... factor is dependent on the sampling frequency with regards to the signal of interest & unwanted components. The below were done with a Ts of 100us, quite slow

Tracking bandstop filter

If the present speed is known & the harmonic number of the component is equally know, an adaptive bandstop filter can be realised.

I shall hold off on this suggestion as it is a bit more involved an requires additional infomation