IQ sampling#

Covered topics:

  • IQ-, complex-, or quadrature sampling

    • many digital receivers use this

    • more complex than regular digital sampling

  • Nyquist sampling

  • complex numbers

  • RF carriers

  • downconversion

  • power spectral density

In-class#

Sampling basics#

  • we sample

    • audio with a microphone

    • radio waves with an antenna

Exercise 59

Which electronic device helps us to sample the voltage levels provided by an antenna?

  • sample period

    • regular interval that we wait after each sample

    • inverse of sample rate

Exercise 60

Imagine we are sampling a signal \(S(t)\) with a sample period of \(T\). What would be the mathematical representation of the values that we sample?

Nyquist sampling#

  • How fast must we sample?

Exercise 61

How do the sampled values look like if we sample a sine signal with the frequency \(f\) with a sample rate of \(f\)?

Exercise 62

  1. Which sample rate should we use to reconstruct a signal accurately?

  2. How is this sample rate called?

  • noise floor

    • a measure that represents all the sum of all the noise sources

Tip

Demo: show noise floor on a spectrogram

  • aliasing

    • phenomenon that happens if we don’t sample fast enough

  • SDRs filter out frequencies above the half of the sampling rate before sampling

Quadrature sampling#

  • quadrature

    • two waves that are 90 degrees out of phase

Exercise 63

What kind of function (shape) do we get if we add two sinusoids, e.g., a \(\sin\) and \(\cos\) with different amplitudes and phases?

  • I stands for in-phase

  • Q stands for quadrature (90 degrees out of phase)

  • we can control both the phase and the amplitude using I and Q

    • we don’t have to deal directly with the phase

    • we just adjust the amplitudes I and Q

  • in the IQ circuit we only have to have a constant shifter of 90 degrees

Complex numbers#

  • imaginary part corresponds to \(Q\)

  • real part corresponds to \(I\)

Exercise 64

You want to create a signal with

  • \(I=\sqrt{3}\)

  • \(Q=-1\)

What is the amplitude and the phase of the generated signal?

Exercise 65

Even we are working with complex numbers, we cannot transmit something imaginary. What does the imaginary component of the complex number represent (in context of quadrature sampling)?

Complex numbers in FFTs#

Exercise 66

  1. When we FFT an input signal, we get a series of complex numbers. What so the components of these complex numbers represent?

  2. What happens when we create quadrature signals from these complex numbers?

Receiver side#

  • receiver multiplies the input signal with a

    • sinusoid to get the \(I\)

    • quadrature of the sinusoid to get the \(Q\)

  • each sample of the SDR gives us \(I\) and \(Q\)

Exercise 67

How many real numbers do you get when you have a sample rate of 1 MHz?

  • we can receive & transmit complex integers or floats

Carrier and downconversion#

  • carrier frequency

    • is the center frequency of a signal that we send

  • carrier signal

    • carrier, because it carries our signal on a certain frequency

(2) shows the analogy between a signal representation and IQ values.

(2)#\[A \cos(2 \pi f t + \phi ) = \sqrt{I^2 + Q^2} \cos(2 \pi f t + \tan^{-1}( \frac{Q}{I}) )\]

Exercise 68

You have a carrier signal with a frequency \(f\). You tune your SDR to the frequency \(f\). What do the received I and Q values mean?

  • FM, Wi-Fi, Bluetooth, LTE, GPS

    • carrier frequency 100 MHz - 6 GHz

  • microwave ovens use 2.4 GHz like Wi-Fi.

  • visible light 500 THz

    • we don’t use antennas, but LEDs to transmit at these frequencies

  • radio frequency (RF)

    • 20 kHz - 300 GHz

    • at these frequencies electric current can radiate off the antenna

  • frequencies > 6 GHz have been used for radar and satellite

    • now in 5G

  • modulation

    • if we change IQ values of a carrier signal, we modulate the carrier signal

    • if we change the frequency of the carrier, we have a frequency modulation FM

Exercise 69

Imagine you have to sample a Wi-Fi signal at 5 GHz.

  1. What must be your sampling rate?

  2. What is the alternative if you cannot sample at this frequency, because your ADC cannot catch up?

  • Downconversion

    • \(I \cos(2\pi ft) + Q \sin(2\pi ft)\) => \(I\) and \(Q\)

  • after downconversion, in the frequency domain

    • our spectrum gets centered at 0 Hz

    • we get signals around 100 kHz - 40 MHz

  • Upconversion

    • happens before transmission

Exercise 70

What do we have to do to downconvert a signal in an SDR?

Exercise 71

  1. How do we calculate the wavelength of an RF signal?

  2. What should be the length of an antenna if we want to receive a signal at a carrier frequency of \(f\)?

  • radio waves travel ~30cm per nanosecond

Receiver architectures#

  • figure

  • direct sampling

    • direct through ADC

  • direct conversion

    • frequencies directly converted down to baseband (and then sampled)

    • also called zero-IF

  • superheterodyne

    • non-zero IF

    • used in old radios

Exercise 72

What is the purpose of an LNA (low-noise amplifier) which is directly connected to the antenna?

Baseband and bandpass signals#

  • baseband

    • signal centered around 0 Hz

    • the opposite bandpass

      • signal not around 0 Hz

  • examples

Exercise 73

Why can’t we transmit a bandpass signal?

Exercise 74

Even we cannot transmit a negative frequency directly, we can still modulate it. What happens with the negative frequency upon modulation? In other words, what does negative in this context mean?

Exercise 75

What is the motivation to work with baseband signals?

  • baseband signals are often complex signals

  • bandpass signals must be real signals

    • otherwise we cannot transmit

  • => if you see that positive and negative frequencies are not identical, then we must have complex signals

    • reason: if we don’t have any imaginary component in our signal, then we don’t have any Q values. This in turn means that we only have cosine signals without any shift. A sum of cosine signals will be symmetrical around the y-axis and will have the same positive and negative components.

  • SDR devices will only give us a representation of the baseband signal

    • storing the whole RF would take lots of memory

    • we are anyway interested in a small portion of the spectrum

DC spike and offset tuning#

DC spike or DC offset or LO leakage

  • LO stands for local oscillator

    • downconverts the signal

  • large spike in the center of the baseband signal

  • observed in direct converters

    • they downconvert the signal using an LO

  • additional energy created through the combination of frequencies

  • removal

    • difficult, because close to the desired output signal

    • built-in in SDR, however requires a signal

      • so a spike will be apparent when signal absent

  • alternative way of handling the DC offset

    • e.g., to view 5 MHz around 100 MHz

    • oversampling and off-tuning

    • 20 MHz around 95 MHz

    • because 95 MHz is outside the spectrum that we want, we don’t get LO leakage

Sampling using our SDR#

Calculating average power#

We can use (3) for discrete complex signals:

(3)#\[P = \frac{1}{N} \sum_{n=1}^{N} |x[n]|^2\]

In Python: np.mean(np.abs(x)**2)

Warning

We need the absolute value before squaring because we have a complex number.

For real numbers, squaring a negative number gives a positive result anyway, so we don’t need the absolute value operator. However, squaring complex numbers work differently.

If the signal has roughly zero mean, we can simply take np.var(x) because (4) corresponds to the average power if the mean \(\mu\) is zero.

(4)#\[P = \frac{1}{N} \sum_{n=1}^{N} |x[n] - \mu |^2\]

Calculating power spectral density#

also called PSD

  • the result of FFT – we already did this in Frequency domain.

  • uses dB: \(10 log_10\)