3
$\begingroup$

I am building a "scanner" sort of program, which reads IQ samples from an rtl-sdr stick, and keeps track of the power on certain frequencies, in certain bands. I am interested in detecting activity on frequencies, which I do by looking at changes in power. Since I'm simply calculating changes over time, can I get away with not filtering the data before calculating power, or is there some reason I should filter?

$\endgroup$
0
$\begingroup$

If the output from the SDR matches the band you're interested in, I see no point in filtering.

You want to filter when you have a scenario similar to this: you want to track the power in a band of $B$ Hz around a frequency $f_c$, but the SDR's output covers a band that is larger than $B$. In this case you want to filter, since otherwise a signal outside the band of interest could affect your calculations.

$\endgroup$
0
$\begingroup$

It is more likely than not that you would want to filter your signal to the band in which you are calculating power before making the power measurement. The case in which you would not, as described by MBaz is actually less likely in many applications: all filtering is finite, and there can be a wide variation in power level between signals of interest and signals in other frequencies. Further, these signals in other frequencies will have changing power levels over time. Note any filtering that you provide will also be finite, so the problem I describe does not get eliminated, but at least it will be understood and in your control.

So I would highly recommend filtering! It is not difficult to do, unless you know how much band selectivity (filtering) your SDR is providing, and understand that this exceeds the maximum signal strength by more than 10 dB of the total power outside of your band after the SDR provides its own channel filtering (I say 10 dB as this would result in a maximum error of 0.4 dB: $err=10log10(1+x/10)$, where x is the total undesired power in dB, an err is the resulting error in dB, but you can replace x with whatever your err criteria is to determine how much additional filtering you should provide).

Note at some point for very strong differences in power from adjacent channels, any further filtering will be of no help as non-linearity effects in your SDR will have corrupted your signal in band.

$\endgroup$
0
$\begingroup$

i had to look up what SDR meant.

if your aim is to compute the power coming out of various frequency bands that are scanned by the scanner, you would apply bandpass filtering first to define the band, then the output of that would be squared for instantaneous power, then that instantaneous power signal would be further lowpass filtered to get the mean power. The cutoff frequency of the lowpass filter would define the approximate time interval that the power is averaged. It's a weighted average, even if it's a sliding or moving average. From that sliding average power signal, you could take the square root and get r.m.s, but you would likely go straight to dB, but remember it's a power signal so it's scaled by 10 instead of 20:

$$ dB[k] = 10 \log \left( \frac{P[k]}{P_\mathrm{ref}} \right) $$

$P[k]$ is the sliding mean power for the $k$-th band.

$\endgroup$
4
  • $\begingroup$ Would you please describe the relationship between lowpass filtering and the mean power? Intuitively I just take the power values at each time (evenly sampled) and take the mean of that array. $\endgroup$ – HH- Apologize to Carole Baskin Apr 20 '20 at 21:22
  • $\begingroup$ if the input to the $k$-th band low-pass filter (LPF) is $x_k^2[n]$ and if the DC gain of the LPF is 1 (or 0 dB) then the output of the LPF is a sliding average with no scaling. the lower the corner frequency (or "cutoff frequency") of the LPF means the longer is the averaging time of the sliding average filter that your LPF is. just make sure that $$H_\mathrm{LPF}(e^{j0})=1$$ for every band, $k$. $\endgroup$ – robert bristow-johnson Apr 20 '20 at 23:50
  • $\begingroup$ i just re-read your question, so are you starting with $$i[n]\ +\ j \,q[n]$$ and it's a single-sided signal with no negative frequency and you want to pass that through a bunch of bandpass filters? $\endgroup$ – robert bristow-johnson Apr 21 '20 at 0:03
  • $\begingroup$ From what I remember (I asked this question nearly 4 years ago) I use a bandpass filter and calculate the power using i and q components as normal, then use it in in conjunction with the number of samples total and other info to adjust to the current mean, each time I take a sample. So I have a running mean and adjust it with each new measurement $\endgroup$ – HH- Apologize to Carole Baskin Apr 21 '20 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.