How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise?

One might be well aware of the encoders, their operation and how to count their pulses for various purposes like position or speed control in different types of applications, and here we are not going to talk about that, instead we are going to talk about the problems any designer will face, during dealing with encoders and one of them is called “NOISE”! Yeah, not a very beautiful word to hear, especially when you are dealing with electronics and believe me, a good “NOISE” can ruin any good design! That might look silly, but even if you design a top-notch circuit, and you feed it with a noisy input, it can get disturb, and you need to be ready for how to deal with them. Let’s dive into the topic, Encoders are normally placed very close to the shaft of the electrical motors that they are supposed to take the feedback from and send it back all the way to the main controller, so the controller can measure the exact position of the shaft, and then the magic will happen, but guess what? The story usually will not be so easy as it looks! And let me tell you why? The Encoder is at very close vicinity of a big magnetic field that is generated by the Motor, it will be also subjected to very powerful and high current switching harmonies that the Driver or Controller applies to the Motor and they will affect the encoder pulses, and you might get an output from your encoder, like image below, which we shoot during one of our tests with a brushless Motor, in this image, you see the encoder output signal right without doing any signal conditioning or filtering.

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 1

Figure 1: an output of a noisy quadrature encoder prior to filtering

The image above, will not make no one happy, but that’s what you might get when you are in this business, as can be seen, the main quadrature output signals of the Encoder are covered by some harmonies that they look indeed with a pattern! And Yes, that’ the switching frequency of the controller on the Motor, and it seems they have a frequency around 40 to 50 kHz or near that ( 20 – 25µs between harmonies), but as you see there are ups and downs in the noise, and in reality the switching frequency of the controller was at 80kHz, which caused such harmonies. You can get similar noises from the cable of the encoder, that might pick some noises from the surrounding environment, they might not be so clean and predictable noise like the encoder pulses we saw in Figure 1, but they will have more or less the same effect.

What Is the Main Problem With Noisy Encoder Pulses?

The answer to this question is not trivial, but the first and the most critical answer is, these sorts of noises can destroy the readings of pulses for the controller, or cause the controller to read much more pulses than reality, in practice counting noises as well! One more time look at the Figure 1, if you feed this pulse to your controller, there is a good chance that your controller counts all the harmonies as the encoder pulse or even worse, it can get lost regarding the expected phase shift between encoder pulses in Quadrature encoders, each of those harmonies can trigger the rising or falling edge interrupts in your micro-controller, and we all know what’s next… Nothing will go as planned. . . But these issues will not stop us from encountering them, and below we will talk about some methods and how to address these issues in Motor Controlling or other types of projects.

Low-pass RC filters and Filtering at circuit level

This is the most common way of filtering unwanted high-frequency noises on a digital line at circuit level, the simplest form of RC low pass filters are composed out of one resistor in series with the main signal and one capacitor parallel between the output of the Resistor and the Ground as can be seen in Figure 2 below:

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 2

Figure 2 – The circuit of a RC low-pass filter

In these types of low-pass filters, they only allow signals with lower frequency than their cutt-off frequency pass without getting filtered or in technical language “attenuated”; So the main design decision in these kinds of filters, is proper selection of the cutt-off frequency which the notion can be seen in Figure 3 below:

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 3

Figure 3- The frequency response of a generic RC low-pass filter and the cut-off frequency [wikipedia]

The RC filter will behave in a way that it will attenuate (weaken) the harmonies that have much higher frequency than the cutt-off frequency of the low-pass RC filter and as a rule of thumb the best effect of filtering with Low-pass filters of this kind is achieved when the noise has a frequency more than 7 to 10 time of the cutt-off frequency of the low-pass filter, the cut-off frequency of a RC low-pass filter can be found using formula 1 below:

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 4

Formula 1 : Cut-off frequency of a RC low-pass filter

Where :

Fc : is the cut-off frequency in Hz
R : is the value of the resistor in Low-pass filter
C: is the value of the capacitor in Low-pass filter

So now as an example, for our Encoder, imagine that we want to design a RC filter, the following can be a good design guide:

Firstly, We need to know

What Is the Maximum Encoder Frequency of Encoder Pulses That We Can Accept?

So here we can just imagine the answer is 100kHz, this means that the filter we design, should have a cut-off frequency at least 7 to 10 times bigger than our maximum acceptable frequency, because we don’t want to attenuate the valuable signal of the Encoder itself! We want to filter the noise, so if you choose the cut-off frequency very close to your actual pulse frequency, you will indeed harm the quality of your encoder signal at the end by possibly filtering the good signal instead of the noise!
Now by having the 100kHz as the maximum acceptable range for our Encoder pulses’s frequency, our low-pass filter cut-off frequency can be anything from 700kHz to 1MHz, and here we will go for the latter choice of 1MHz just to stay safe!

Now we need to select the values for R and C, again as a rule of thumb, the best way is to select the value of the capacitor first, and from low values, meaning something between 100pF to 1nF and then based on the Formula 1, we will calculate the value of “R” since now we know also the the Cut-off frequency value.

Using the Formula 1, and taking the value of the capacitor as 100pF we will have for the value of the resistor:

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 5
How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 6

With all mentioned above, it worth showing that, a bad selection of cut-off frequency for the RC filter can lead into destruction of main signal as can be seen in Figure 4 down below, which clearly shows how the rising edge of the pulse vanished, and such a pulse will not trigger an edge detector resulting that the Encoder counter and eventually the position or speed controller failure.

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 7

Figure 4: The effect of a bad Filter design on sharp edges of Encoder pulses

So finally we have designed a low pass filter, which will severely filter the harmonies above 1Mhz which is very likely the region where the fast harmonies of switching and the rest will appear. As you can imagine this big interval that we had to consider is the main drawback of single-pole (single capacitor) type of low-pass filters, and they can also potentially affect the quality of your good signals if you don’t design their cut-off frequencies with mentioned tricks.

How SOLO Attempts to Filter Fast Noise Harmonies on Encoder Pulses?

As we saw in Figure 1, the major types of noises on Encoder lines, show themselves as fast harmonies with frequencies normally well above 1MHz, but as we also saw, passive filters like RC filters are suffering from poor bandwidth and attenuation, as the selection of the cut-off frequency is generally tricky and these types of filters are not efficient for very high frequency Encoder inputs. So to tackle the issue, SOLO uses a kind of “notch filter” or anti-glitch filter which will act at digital level during sampling from the encoder pulses in real-time. Figure 4 below demonstrates how SOLO samples an encoder Pulse, and under what condition a valid state change, from High to Low or vice versa is detected:

How to manage Noisy Encoders or Hall sensors? How does SOLO actively Filter the noise? 8

Figure 4: Anti_Glitch Filter at DSP level on SOLO for Encoder’s high frequency noise harmonis

The way this method of Active Filtering works is as below:

  1.  SOLO keeps sampling the Encoder or Hall sensors pulses with 45MHz of sampling rate and memorizes in real time the signal value at each sample

  2.  If after 3 consecutive samples , the level of the signal remains stable, then that signal will be accounted as a valid signal, and that will define for SOLO if a real state change happened or not.

Using this method, SOLO will automatically discard in real-time all the glitches and noises presented on the Encoder or Hall sensor lines, with a very high bandwidth.

But you might ask, based on the given information,

What Is the Maximum Encoder or Hall Sensors Pulse Frequency

that SOLO can accept?!

To calculate that we just need to consider the following definitions:

Ts or the main sampling frequency of the DSP on SOLO which is 11.11ns (1/90MHz)
Tsp or sampling period which is 22.22ns (1/45MHz) and it’s actually twice as Ts
Tsw or sampling window for 3 consecutive samples which becomes 44.44ns (1/27.7MHz)

Both Tsp and Tsw are synchronised to Ts and to account for asynchronous behaviour of input Encoder or Hall pulse with respect to main sampling frequency of DSP (Ts), the maximum acceptable encoder frequency will become:

The maximum denoised pulse frequency to SOLO = 1 / (11.11ns + 44.44ns) = 18MHz

So given this method, SOLO can actively sample and filter very high frequency Encoder or Hall sensor pulses in noisy environments and remain stable with all the control types that it supports.

Share This

Share This

Share this post with your friends!