# Debouncing Noise rejection and Filtering

When dealing with signals from the outside world we often come across the terms Debouncing or Noise Rejection or Filtering to reliably detect the input signal. These 3 terms although want to achieve the same things but depending on the application can have some intrinsic differences as how we implement them.

# Debouncing [top]

Bouncing is referred to an input signal that settles between 2 states but during the switchover will bounce between the 2 states randomly before settling to the right state. For example the signal from a switch circuit shown below would look something like the waveform shown on the right during a switch OFF transient.

Notice the high frequency disturbance in the output before the switch settles down to a strong connection on the other state.
The circuitry or logic that needs to sense the switch state must be shielded from this disturbance and a single state transition edge should be provided to the input circuitry. This is called debouncing the input. Which is shown as the purple curve.

# Noise Rejection [top]

The signal coming to a circuit may contain a disturbance which is totally unwanted and is simply a false signal.Usually depending on the application the definition of the disturbance or noise would change. For a digital circuit noise would be a signal that changes the input so much as to detect as another state. While for analog circuits any signal which is not part of the signal being sensed is noise.
Let us take the example of our switch circuit.There could be that the mechanical contacts are touched accidently due to a sudden impact on the device. The output waveform may look like as shown below:

The noise rejection circuitry should reject the noise and not pass it through.

# Filtering [top]

Filtering is a process of removing unwanted frequencies from a signal. In our current context it can be used as removing the high frequency component from the signal and only pass the low frequency component. How much low frequency is the right signal depends on the application.

# Implementations [top]

So how do we implement circuitry to clean a signal? The signal may be from a switch as discussed above or even the output of a comparator without hysteresis comparing some slow moving signals. One way as we touched upon would be to just add a filter to reject all high frequencies. The circuit as applied to the switch may look something like this:

Here the charging is with R and R1 in series and discharging is with R only. To make the charging and discharging independent we could add a diode across R to get the following circuit:

In IC Design we have transistors and current sources/sinks readily available so we could have the following circuit:

Or when we have a high speed clock on chip we can do the delay in the digital domain using an up down counter.

## The problem [top]

The circuits shown above may work fine most of the time but it is easy to see how we can make them fail. Consider the following waveform:

We can create a signal at the input which can break the noise rejection of such circuits.

## The solution [top]

To solve this problem we need to improve our circuit to reset itself when it decides the previous transition was a noise and remove its memory from it. The circuit shown below would achieve that:

# Testing it out [top]

Making a small RC filter and simulating it with some arbitrary waveform at the input we have the following:

The simulation waveforms look like this:

As can be seen with the waveform of Vc we see the problem is immediately visible. Given enouch noise the circuit may fail. The simulation results below show that:

Now implementing the reset paths in the circuit we have:

And the resulting simulation we get:

This time the noise did not go through because the capacitor is reset every time. Now to verify it does debounce. We run another simulation:

# Conclusion [top]

So to wrap up we need to keep in mind that debouncing is different than simple filtering and we need to have an idea about what kind of bounce noise we are trying to reject. We need to analyze our designs and make sure that there is no way we can make it fail in actual operation.