Learning SDR

Logo

Harvey Mudd College

Lesson 2 — Signal Generator as sine-wave transmitter and RTL-SDR receiver

Notes on the Video

The simplest radio signal to work with is a pure sinusoidal wave with no modulation (changes) in frequency or amplitude. I generate such a signal around 100 MHz with a signal generator, show it on an oscilloscope, and look at the data coming from the SDR tuned to 100 MHz. I make a few observations whose significance will be fully explained in the next few lessons.

  1. The data that comes out of the SDR is a sequence of complex numbers. We’ll spend a lot of time explaining why this is and what it means.
  2. A plot of the real part of the complex numbers looks like a consine and a plot of the imaginary part of the numbers looks like a sine.
  3. The frequency of the real and imaginary sinusoids isn’t at the absolute frequency of transmission of 100.010 MHz — we don’t sample fast enough to see that. Instead, it’s at the difference between the frequency that the transmitter sends and the frequency that the receiver is tuned to. (100.010 MHz - 100.000 MHz = +10 kHz).
  4. A plot of the spectrum shows a peak not at the absolute frequency 100.010 MHz, but at the difference in frequencies of +10 kHz.
  5. If the transmitter then sends 99.990 MHz, a frequency 10 kHz lower than what the tranmistter is tuned to, it will show up as a negative frequency, -10 kHz, on the frequency spectrum. In the time-series plots, the imaginary part’s sine wave has switched signs. Negative frequencies and the details of these complex numbers will be further explained in the next few lessons.

Sines and cosines are both sinusoids; they differ only by a phase. The combination of both a sine wave and a cosine wave at a given frequency can always be represented either as two signals—the cosine part, which we identify as the real part (or the in-phase part) of the signal, and the sine part (or the quadrature part) of the signal, which represents the imaginary part of the signal. In GNU Radio, the real part is represented by default with a blue curve and the imaginary part is represented with a red curve.

Dictionary of GNU Radio Companion Terms

RTL-SDR Source: Uses a signal received from a RTL-SDR USB source, which should be connected to some antenna to receive a signal.

QT GUI Time Sink: Plots a sequence of complex numbers coming out of the source

QT GUI Frequency Sink: Plots the frequency of complex numbers coming out of the source

Variable: Creates a variable with a name and a value, similar to instantiating a variable in Python. (In the video, we instantiated samp_rate with value 1e6. 1e6, in this case, is meant for a signal of 1 Mega Hertz (1 MHz); since the RTL-SDR source uses the variable samp_rate, it will be checking for some signal at a frequency of 1 MHz.)

When Writing a GNU Program with the RTL-SDR Source

  1. Title your program in the ‘Options’ box at the top left of the screen
  2. Set your variable samp_rate to the frequency you are expecting to receive (a value of 1 means 1 Hertz)
  3. Place your RTL-SDR Source, a QT Time Sink, and a QT Frequency Sink

When real life intrudes…

You would think that if the function generator is tuned precisely to 100.000 MHz and the SDR is set to receive the exact same frequency, that the resulting output (at the difference frequency) should be a constant (0 Hz). While entirely logical, that’s not what happens, because the precision of the clocks in the function generator and in the SDR aren’t perfect. They will have small but noticeable frequency offsets that may fluctuate in time with variations in local temperature. Even if they were in perfect agreement at one moment, we cannot count on their remaining synchronized as time passes. As we look at the output on the QT GUI Time Sink, we indeed see real and imaginary signals oscillating very slowly in time; they are not steady and constant.

Dealing with the small and gradually changing difference between clock rates in different components of a radio system will occupy a significant portion of this course; we will need to develop methods to monitor and correct for slow drifts in both frequency and phase, so that we can extract meaningful information from signals transmitted “on the back” of radio-frequency carriers.

Homework

  1. When frequency goes up, do the peaks of waves in the Time Sink get closer or farther apart?
Click to expand

The peaks should get closer together.

  1. Which signal is real in the Time Sink: the blue or the red? Which sample are real numbers associated with in the Time Sink key? What sinusoidal function does represents it? What about the complex signal?
Click to expand

The blue wave is the real wave. It is indicated by sample 1 - additionally, it is considered as a cosine wave. Inversely, the red wave represents the complex part of the signal. This is sample 2, and it’s sinusoidal function is a sine function.

  1. If we are looking to receive 100 MHz on our RTL-SDR Source, but the generator’s clock is slightly different than the source’s (which is often the case), what happens to the functions in our Time Sink when the generator is at exactly 100 MHz?
Click to expand

The plots will very slowly oscillate.

  1. When the frequency of the signal generated is greater than the tunning of the receiver, what do the Time and Frequency Sinks look like?
Click to expand

The real signal reaches its maximum before the imaginary signal in the Time Sink, and the peak on the Frequency sink lies above the value we’re looking for.