· · VORTARIAN · 9 min read

Zooming into a Signal: a VORTARIAN Capture Analysed in Python

Step by step, without RF background: save one capture of the VORTARIAN 4R2T-10G, find a pulse in it, zoom in until its frequency sweep is visible, and read the bits of a Bluetooth packet.

Zoomed spectrogram of one pulse of a carrier at 2450.5 MHz: the frequency overshoots when the carrier switches on and runs upwards when it switches off

A spectrogram of the VORTARIAN 4R2T-10G shows that something is on the air. This article shows how to look closer with a few lines of Python: when a signal starts and stops, how strong it is, how its frequency moves, and which bits it carries. It is written for software engineers; every RF term is explained where it first appears. All figures come from one capture of 16.8 ms.

What you need

Our board has the 4R2C-2G5 front end, which moves 2450 MHz to the centre of the received band, and antennas on RX A and RX B.

Step 1: Capture once, analyse many times

python3 vortarian_spectrogram.py --args driver=vortarian,host=192.168.67.2 --nco 375e6 --rf 2450e6 --ms 16.78 --save cap.npy

The script draws the spectrogram and, with --save, also writes the samples to cap.npy. --ms 16.78 gives 221 samples per channel, 2048 spectra of 1024 samples. The other two scripts read this file with --load, so everything below works on the same 16.8 ms and needs the board only once.

Spectrograms of the four receive channels over 16.8 ms around 2450 MHz: three short strong packets, a row of dashes at 2450 MHz and a wide block at the start on RX A and RX B

The saved capture. RX A and RX B have antennas, RX C and RX D do not. Three strong packets at 2402, 2426 and 2480 MHz between 7 and 9 ms, a row of dashes starting at 2450 MHz, a wide block at 2437 MHz in the first millisecond.

What is in the file:

TermMeaning
Sampleone complex number per channel every 8 ns (125 million per second)
I and Qreal and imaginary part of a sample. Its magnitude is the amplitude of the signal, its angle the phase.
Full scalemagnitude 1.0, the largest value the converter delivers
dBFSlevel relative to full scale: 20 log10 of the magnitude. 0.1 is −20 dBFS, 0.001 is −60 dBFS.
Frequencythe samples cover 125 MHz. 0 Hz in the samples is 2450 MHz on the air, +10 MHz is 2460 MHz, −30 MHz is 2420 MHz.
import numpy as np
x = np.load("cap.npy")      # shape (4, 2097152), complex64: RX A to RX D

Step 2: Find where something happens

The level of a channel over time shows when a transmitter is on. vortarian_detail.py computes it as the power |x|² averaged over 64 samples, 0.5 µs:

# Level: power averaged over 64 samples (0.5 us), in dBFS
level = 10 * np.log10(np.convolve(np.abs(x) ** 2, np.ones(64) / 64, "same") + 1e-12)

The script starts its detail where the level first rises above --threshold (default −55 dBFS), or at the time given with --at. We look at RX B from 0.55 ms:

python3 vortarian_detail.py --load cap.npy --channel 1 --at 0.55 --us 700

Zoomed spectrogram, level and instantaneous frequency of 700 µs on RX B: two pulses of a carrier at 2450.5 MHz and the end of a wide block at 2437 MHz

700 µs of RX B. Top: spectrogram with 2 µs per spectrum. Middle: level. Bottom: instantaneous frequency where the level is above the threshold.

The middle panel answers the first questions:

  • A transmitter switches on at 48 µs and again at 558 µs: every 510 µs. Its level is −46 dBFS for 100 µs, then it falls by 10 dB within 30 µs.
  • The step from −59 to −63 dBFS at 277 µs is the end of the wide block at 2437 MHz, a Wi-Fi frame.

The level alone does not tell which signal is which. For that we need frequency.

Step 3: Zoom with short FFTs

A spectrum is computed from a block of samples with the FFT. The length of the block sets both resolutions at once:

FFT lengthTime coveredFrequency per bin
1024 samples8.19 µs122 kHz
256 samples2.05 µs488 kHz
64 samples0.51 µs1.95 MHz

A short block shows fast changes and blurs the frequency; a long block does the opposite. The product is fixed: time covered × frequency per bin = 1.

# Zoomed spectrogram: short FFTs that overlap by 7/8
w = np.hanning(a.fft)
hop = a.fft // 8
starts = np.arange(0, n - a.fft, hop)
S = np.fft.fftshift(np.fft.fft([seg[i:i + a.fft] * w for i in starts], axis=1), axes=1) / w.sum()
P = 20 * np.log10(np.abs(S) + 1e-12)
  • w is a Hann window. It fades each block in and out, so a strong signal does not smear over the whole spectrum.
  • The blocks overlap by 7/8. This adds no information, it only draws the picture with finer steps.
  • Dividing by w.sum() makes a steady tone read its true level in dBFS.
python3 vortarian_detail.py --load cap.npy --channel 1 --at 0.55 --fft 64
python3 vortarian_detail.py --load cap.npy --channel 1 --at 0.55 --fft 1024

The same 700 µs drawn with FFT lengths of 64, 256 and 1024 samples

The same detail with 64, 256 and 1024 samples per FFT (top panels of three runs of the script). With 64 samples the switch-on is sharp in time and the traces are 2 MHz thick. With 1024 samples the lines are thin, the Wi-Fi frame shows its internal structure, and the fast sweep at the end of each pulse fades.

Now the pulses can be read. Each one is a single frequency, a carrier, at 2450.5 MHz. When it switches on, its frequency starts about 5 MHz too high and settles within 3 µs. When it switches off, the frequency runs upwards. A weaker transmitter at 2466 MHz does the same 20 µs earlier.

Step 4: Instantaneous frequency

When one signal dominates, its frequency can be measured without an FFT, sample by sample. Frequency is how fast the phase turns. The phase step from one sample to the next, divided by 2π, is the fraction of a turn per sample; times the sample rate it is the frequency:

# Instantaneous frequency: phase step from one sample to the next, smoothed over 16 samples
step = seg[1:] * np.conj(seg[:-1])
fi = a.rf / 1e6 + np.angle(np.convolve(step, np.ones(16), "same")) * fs / (2 * np.pi) / 1e6

seg[1:] * np.conj(seg[:-1]) is a complex number whose angle is the phase step. Averaging 16 of them before taking the angle reduces the noise; the result still follows changes within 0.13 µs.

The bottom panel of the figure in Step 2 is this curve. It gives the numbers the spectrogram only suggests:

Time in the detailFrequencyLevel
60 to 140 µs2450.5 MHz−46 dBFS
160 µs2455.6 MHz−47 dBFS
170 µs2463.7 MHz−49 dBFS
180 µs2477.6 MHz−55.5 dBFS

The carrier moves 27 MHz in 30 µs while its level falls by 10 dB.

This explains the row of dashes in the first figure. One spectrum there covers 8.19 µs. In that time the carrier crosses up to 12 MHz, about 100 bins, so each bin receives it for a fraction of a microsecond and shows it far below its true level. A display that keeps the maximum of many spectra, as det = 'peak' in the MATLAB waterfall does, turns the same sweep into a band from 2451 to 2485 MHz.

The method has a limit: with two signals of similar level, or with noise only, the phase step is meaningless. The script therefore draws the curve only where the level is above the threshold.

Step 5: Pick one signal and read its bits

The three strong packets in the first figure sit on 2402, 2426 and 2480 MHz, the three advertising channels of Bluetooth Low Energy. To look at one of them alone, three operations take a 2 MHz channel out of the 125 MHz band. From vortarian_ble_packet.py:

lp = signal.firwin(129, 1.0e6, fs=fs)            # low-pass, 1 MHz each side


def channel_filter(x):
    """The advertising channel at 0 Hz, 25 MS/s."""
    lo = np.exp(-2j * np.pi * (a.ble - a.rf) / fs * np.arange(len(x)))
    return signal.lfilter(lp, 1, x * lo)[::D]
OperationCodeEffect
Mixx * lomultiplies by a rotating phase and so shifts all frequencies: 2402 MHz moves to 0 Hz
Filtersignal.lfilter(lp, 1, ...)keeps ±1 MHz around 0 Hz and removes everything else, also most of the noise
Decimate[::D]keeps every fifth sample: 25 MS/s is enough for a 2 MHz channel
python3 vortarian_ble_packet.py --load cap.npy --channel 1
packet at 7.295 ms: on for 400 us, -22.4 dBFS, access address 0x8E89BED6

Level, I and Q, and frequency deviation of a Bluetooth Low Energy advertising packet on RX B, with the decoded preamble and access address bits

The packet at 2402 MHz on RX B. Top: level in the 2 MHz channel. Middle: I and Q of the first 44 µs. Bottom: frequency deviation with the bits the script decided.

Bluetooth Low Energy sends its bits by frequency: for a 1 the carrier is about 250 kHz above its centre, for a 0 about 250 kHz below, and each bit lasts 1 µs. The level stays constant, as the top panel shows. I and Q in the middle panel look irregular, but their phase turns forwards during a 1 and backwards during a 0. The instantaneous frequency of Step 4 makes this visible directly:

    f = np.angle(y[1:] * np.conj(y[:-1])) * (fs / D) / (2 * np.pi)
    centre = np.median(f[i0 + 50:i1 - 50])       # carrier offset of the transmitter
    for s in range(i0 - 5 * spb, i0 + 40 * spb): # bit timing: try until the access address fits
        bits = (f[s + spb // 2: s + spb // 2 + 40 * spb: spb] > centre).astype(int)
        if len(bits) == 40 and sum(int(b) << k for k, b in enumerate(bits[8:])) == AA:

The script samples the frequency once per bit, in the middle of the bit, and compares it with the centre. Every advertising packet starts with the preamble 01010101 and the access address 0x8E89BED6, sent with the lowest bit first. The script shifts its bit timing until these 32 bits appear. That is also the proof that the packet is what we think it is: a random signal does not produce them.

The other two packets of the same advertising event:

python3 vortarian_ble_packet.py --load cap.npy --channel 1 --ble 2426e6    # 7.895 ms, -29.5 dBFS
python3 vortarian_ble_packet.py --load cap.npy --channel 1 --ble 2480e6    # 8.495 ms, -22.9 dBFS

The device sends the same advertisement on the three channels 600 µs apart. On RX A the three packets arrive at −29.4, −29.8 and −30.1 dBFS: the two antennas stand at different places.

Things to try

  • Other places of the capture: --at with a time read from the first figure, or --threshold to jump to the first strong signal.
  • The same detail on --channel 0: levels differ between the antennas, times do not.
  • A longer capture: vortarian_spectrogram.py --ms 100 --save long.npy writes 400 MB and holds several advertising events.

Written by

· Lead RF/FPGA engineer at JSE

Jiří has designed RF and signal-processing hardware and FPGA firmware since 2003, starting with receivers and signal-processing boards for radar systems. He holds a master's degree in radio engineering from the Czech Technical University in Prague.

LinkedInGitHubAbout JSE

Share:
Back to Blog