Continue to Site

# Detecting the presence of a signal?

Status
Not open for further replies.

#### Coper

##### Member level 4
I have a possibly beginner's question.
ADC I sample the signal, using digital filters I select one frequency from it.
For example, I have 128 signal samples and I need to decide whether there is a signal in this section or not.
Maybe RMS
XRMS=Sqert( (x1^2+x2^2+x3^2+xn^2)/n)

but maybe it's even easier somehow
simpler, I mean with faster math than 128 square rooting and addition

Or can you recommend a book that doesn't deal so much with theory, but with practical examples of digital signal processing?

Hi,

please define what you mean with "signal".
And please define how you decide whether it´s present or not.

A signal can be anything (usually anything but noise)
But your RMS calculation also includes noise.

Does your "signal" have any dedicated frequency and/or waveform. Or is it something like "dual frequency" (DTMF).
.. or digital data...or a carrier (for AM, FM...)

****
You tell you use digital filters to select one frequency. Is it a single frequency you are after?
Maybe a DFT or an FFT (frequency analysis) is what you are looking for.

But still they need to take every single sample into calculation.

***
If you are looking for one single (sine) frequency. Then after your filter you should have sine. Thus there is a fixed relation between RMS and peak or peak_to_peak.
A sine with 1V amplitude
* has a peak of 1V
* has a peak to peak of 2V
* has an RMS of 0.707V
So maybe it´s easier to look for peaks instead of doing ful RMS math.

***

Klaus

Goertzel method of tone detection :

Regards, Dana.

please define what you mean with "signal".
And please define how you decide whether it´s present or not.
the signal is a sine wave
if the maximum of the signal is -1 +1, then the minimum is -0.2 +0.2 (anything below 0.2 is noise)
at the same time, the signal should be detected as True if it is present in at least half of the processed sample.

Are trying to say : 'A signal detection is true if there is a sinewave with an amplitude greater than 0.2 for half the sample time'?

Can it be any frequency, or a specific frequency?

Maybe you can just do an FFT of the signal.

What's the signal period in samples?

Sampled is more than 4 and less than 5.5 samples per period.

According to the given information, rms calculation is the simplest way. By the way, you calculate square root once, not 128 times.
--- Updated ---

Less effort, not sure if it fulfills your requirements, calculate average rectified value, (sum abs(x))/n.

Hi,

squaring is rater simple compared to squareroot.
You may optimize a lot.

Usually you have to
* square 128 values
* divide by 128
* take the root
Compare with threshold

* calculate the new thresbold at compile time to: threshold^2 × 128

The during run time you just need to:
* square 128 values
... no divide by 128
.... no sqare root
* compare with new threshold

Klaus

Status
Not open for further replies.