Re: Sampled Data and Frequency Rejection RC Filter Question



In article <6cednVxIse5vRh_XnZ2dnUVZ_o-dnZ2d@xxxxxxxxxxxx>,
datesfat.chicks@xxxxxxxxx says...
"Tauno Voipio" <news@xxxxxxxxx> wrote in message
news:sFAgm.92$a02.64@xxxxxxxxxxxxxxxx
Datesfat Chicks wrote:
Hi,

We are sampling a signal at 1kHz (every 1mS) and debouncing it (it has to
be "high" or "low" 20 times to fall be debounced ON or OFF), but we are
still having problems in our application with frequencies coming through
(presumably around 1kHz or 2kHz) and "tricking" our debouncing scheme.
The mechanism is that we are just catching the "peaks" 20 times in a row
(standard aliasing stuff).

We don't have a big-budget filter (just an RC).

What is the standard rule of thumb for the relationship between the
sampling rate and the RC time constant? Since an RC doesn't roll off
very sharply, we aren't sure if we want to reduce 1kHz to 1/e amplitude
or if there is a rule of thumb that says we want to reduce it even
further.

How big should our RC time constant be? How much do we want to attenuate
a 1kHz signal. 1/e? Less? More?

Thanks, Datesfat


The Nyqvist rule states that you have to get rid of
all frequency components at and above fs/2 (500 Hz).

This doesn't immediately make sense to me in our application. If we have a
500Hz signal and we're sampling at 1Khz, it seems we might "perceive" the
500Hz signal correctly -- no harm done. I can't come up with a scenario
where a 500Hz signal would cause us to perceive "ON" when it isn't.

I don't see that the frequencies in [500Hz, 1000Hz) will do us any harm. I
could be missing something.

We aren't trying to reconstruct signals. We have a discrete (on/off) input,
and we are trying to prevent a certain class of noise in the input from
causing us to erroneously sense the discrete value incorrectly.

Our "input" is effectively a "light switch" (we are only interested in
on/off), just that there is some noise on it periodically that has tricked
our debouncing filter.

Can you give an example of how frequencies in 500 <= x < 1000 could hurt us
in our application, or a bit more background?

Clearly a 999.9Hz signal would be perceived as a long period of OFF then a
long period of ON. Maybe similar effects down to 500Hz?

It depends on your application how near to the limit
you want to go with the passband, but the nearer you
want to come, the more complicated filter you'll need.

A single-pole RC low-pass with a time constant of
1 ms has 3 dB attenuation at 159 Hz, and the response
drops by 6 dB / octave. The frequency limit scales
inversely to the time constant.

The mechanics of the filter I understand. It is just a question of what is
a good design rule for how far the signal has to be attenuated at 1kHz (or
perhaps at 500Hz, depending on the question above). How far "down" do we
want it? 1/e seems safe, but I'm wondering if there is some scientific way
to think about it.

Our application is automotive (12V). Our threshold is about 8V. Every
1ms, we sample, and if it is 8V or above we say "ON", otherwise we say OFF.
Our debouncing filter is that if we get 20 consecutive OFFs or ONs, we then
say the output of the filter is OFF or ON.

If we attenuate to 1/e at 1kHz (or 500Hz, depending on the response to the
question above), then a 1Khz square wave at 12V should get knocked down to
about 4.4V, always below our "ON" threshold. 1/e attenuation seems
adequate. Not sure if there is another way to think about it.

Perhaps you need hysteresis as well as filtering.

Is your input a sensor that provides a continuous analog output,
or is it a mechanical switch? Your mention of an 8V threshold
makes me think the former.

Mark Borgerson


.


Loading