0
$\begingroup$

As I have already explained here (https://stackoverflow.com/questions/49358449/python-how-to-get-coordinates-of-complex-rtl-sdr-signal-peaks?noredirect=1#comment85722604_49358449), I need to find the coordinates of the peaks in my signal. While my original question is related more to the programming part, this one is about understanding what my signal has to look like for the peak finding to work at all.

It is my understanding that I'm getting a bunch of complex data from my RTL-SDR. For visualisation purposes I plot this data as a PSD, showing the frequencies on the x-axis and the power level in dB on the y-axis. enter image description here Now, I would like to use the Python peakutils.peak.indexes() method to get the y-coordinates of all peaks above a certain power level, e.g., -20.

This power level is specified as threshold in the method, which apparently means that the input data, i.e., the signal, somehow needs to represent all the power levels of the signal (so the method can search for those standing out)?! Is this assumption correct?

And if so, how do I get a representation of the signal that I could use to detect peaks by power level? Right now, the method seems to scan through frequencies (represented by my complex signal?!), looking for a power level (!) of -20, which probably is why it returns lots of useless results.

enter image description here

I already tried converting the complex signal array to a real array, which didn't work. I also tried converting the signal via fft and fftfreq, which didn't get me any further either.

As I said at the beginning: I can figure out the programming stuff myself. But I need someone to explain to me first, what I have to do, please. How do I need to convert the complex signal?

$\endgroup$
1
$\begingroup$

You are missing several steps.

You have (complex) time-domain samples. You need to convert that to scalar frequency domain data to get something like your example plot. Many steps are required to do that conversion before there are any frequency peaks to be found.

You first need to: Pick a segment of complex IQ data from the RTL-SDR of length N (you may need to convert the raw RTL-SDR IQ samples from unsigned 8-bit to signed floating point), window it (von Hann or Hamming, etc.), convert it to the frequency domain via an FFT of length N, convert the FFT result to log magnitude, and label the FFT log magnitude result bins by frequency, which will be roughly

frequency(i) = sdr.center_freq + i * sdr.sample_rate / N

for bins 0 to N/2

frequency(i) = sdr.center_freq - (N - i) * sdr.sample_rate / N

for bins N/2 to N-1

Then you can search along that log magnitude array for peaks, and apply the frequency label to the peaks found.

$\endgroup$
  • $\begingroup$ Sorry, but this answer is so complex and confusing, I don't understand a single thing. I have already figured out that I have to convert my signal array to FFT, even though I don't understand why. But I have no clue about the other steps you mention. $\endgroup$ – ci7i2en4 Mar 19 '18 at 18:17
  • 1
    $\begingroup$ The place to start if you have no clue is the first few chapters of a basic textbook on signal processing. There are several free textbooks and tutorials on the topic online. $\endgroup$ – hotpaw2 Mar 19 '18 at 21:14

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.