RemoteRF supports the KrakenSDR, a 5-channel phase-coherent software-defined radio receiver manufactured by KrakenRF. Built around five RTL2832U / R820T2 tuners sharing a common reference clock and an internal calibration noise source, it operates from ~24 MHz to 1.766 GHz with sampling rates up to 2.4 MSPS (with 8-bit ADC resolution per channel). This guide covers how to initialize, configure, and capture synchronized multi-channel baseband IQ signals with a reserved KrakenSDR through RemoteRF using Python.
Device Initialization
To interface with a KrakenSDR through RemoteRF, call ensure_driver to make sure the local driver is up to date, import KrakenSDR from remoterf.drivers.krakensdr, and initialize an sdr object with either your reserved device handle (e.g., "KrakenSDR@ucla" while logged in with remoterf --login) or the reservation token issued by resdev:
from remoterf.drivers import ensure_driver
ensure_driver(token="KrakenSDR@ucla")
from remoterf.drivers.krakensdr import KrakenSDR
sdr = KrakenSDR(token="KrakenSDR@ucla") # device handle or reservation tokenOnce initialized, the sdr object coordinates all five receiver channels as a single synchronized instrument. Because each tuner channel is built on librtlsdr / pyrtlsdr, see the upstream KrakenSDR documentation and pyrtlsdr API reference for additional background on the underlying hardware and tuner controls.
Example Script
The Python script below demonstrates how to configure a KrakenSDR and capture synchronized 5-channel baseband signals with it via the RemoteRF platform.
In this example, all five channels are tuned to 100.0 MHz with a 2.048 MSPS sample rate, a synchronized 5-channel IQ block is captured with sdr.read_samples(), and the power spectral density of each channel is plotted.
Note that the device initialization lines described above have already been included in the code below. You should not need to change any of the code below except for the device handle or token for your reservation.
import numpy as np
import matplotlib.pyplot as plt
from remoterf.drivers import ensure_driver
# -------------------------------------------------------
# 1. Connect to Reserved KrakenSDR
# -------------------------------------------------------
TOKEN = "KrakenSDR@ucla"
ensure_driver(token=TOKEN)
from remoterf.drivers.krakensdr import KrakenSDR
sdr = KrakenSDR(token=TOKEN)
print(f"Connected to {sdr.num_channels}-channel KrakenSDR")
print(f"Tuner serials: {sdr.serials}")
# -------------------------------------------------------
# 2. Configure RF Parameters Across All 5 Channels
# -------------------------------------------------------
sample_rate_hz = 2.048e6
center_freq_hz = 100.0e6
num_samples = 16384
sdr.sample_rate = sample_rate_hz
sdr.center_freq = center_freq_hz
sdr.gain = 29.7 # Manual gain in dB (or 'auto')
# -------------------------------------------------------
# 3. Capture Synchronized 5-Channel IQ Samples
# -------------------------------------------------------
iq = np.asarray(sdr.read_samples(num_samples), dtype=np.complex64)
print(f"Captured IQ array shape: {iq.shape}") # (5, num_samples)
# Estimate relative phase offset of each channel vs. Ch 0
ref = iq[0] - np.mean(iq[0])
for ch in range(iq.shape[0]):
sig = iq[ch] - np.mean(iq[ch])
phase_deg = float(np.rad2deg(np.angle(np.vdot(ref, sig))))
power_dbfs = float(10.0 * np.log10(np.mean(np.abs(sig) ** 2) + 1e-12))
print(f" CH{ch}: Power = {power_dbfs:6.2f} dBFS | Phase vs CH0 = {phase_deg:+7.2f} deg")
# -------------------------------------------------------
# 4. Plot 5-Channel Spectrum
# -------------------------------------------------------
fft_size = 2048
window = np.hanning(fft_size)
win_power = np.sum(window ** 2)
freqs_mhz = (np.fft.fftshift(np.fft.fftfreq(fft_size, d=1.0 / sample_rate_hz)) + center_freq_hz) / 1e6
plt.figure(figsize=(10, 5))
for ch in range(iq.shape[0]):
seg = iq[ch, :fft_size] - np.mean(iq[ch, :fft_size])
spec = np.fft.fftshift(np.fft.fft(seg * window))
psd_db = 10.0 * np.log10((np.abs(spec) ** 2) / win_power + 1e-12)
plt.plot(freqs_mhz, psd_db, linewidth=1.1, label=f"Channel {ch}")
plt.title(f"KrakenSDR 5-Channel Spectrum @ {center_freq_hz / 1e6:.3f} MHz")
plt.xlabel("Frequency (MHz)")
plt.ylabel("Magnitude (dBFS)")
plt.grid(True, alpha=0.3)
plt.legend(loc="upper right")
plt.tight_layout()
plt.savefig("kraken_5ch_spectrum.png", dpi=150)
plt.show()
if hasattr(sdr, "close"):
sdr.close()Properties and Methods
Properties
The properties below configure and inspect all five coherent receiver channels on the KrakenSDR instance.
| Property | Type | Access | Description & Range |
|---|---|---|---|
center_freq |
float or int |
R/W | Center frequency in Hz applied synchronously across all 5 channels (~24e6 to 1.766e9 Hz). |
sample_rate |
float or int |
R/W | Baseband ADC sampling rate in Hz across all 5 channels. Recommended: 1.024e6 to 2.4e6 SPS for drop-free coherent operation. |
gain |
float or str |
R/W | Tuner gain in dB (snaps to nearest entry in valid_gains_db, e.g., 0.0 to 49.6 dB) or 'auto'. For phase-coherent array processing, use a fixed numeric gain rather than 'auto'. |
num_channels |
int |
R/O | Number of active coherent receive channels (5). |
serials / tuner_serials |
list[str] |
R/O | Ordered list of USB serial numbers for Channels 0–4 (typically ['1000', '1001', '1002', '1003', '1004']). |
is_running |
bool |
R/O | True when the KrakenSDR is active and streaming samples. |
device_info |
dict |
R/O | Hardware model, vendor, channel count, tuner architecture, active serials, and TCXO/noise source metadata. |
stream_stats |
dict |
R/O | Streaming throughput metrics including total_frames, total_samples, dropped_frames, current_fps, and noise_source_active. |
noise_source_active |
bool |
R/W | Controls the internal broadband calibration noise source and RF switch via Channel 0 GPIO 0 (True = ON, False = OFF). |
Methods
The methods below handle synchronized multi-channel IQ acquisition, FFT spectrum computation, internal noise-source calibration, and device cleanup.
| Method | Returns | Description |
|---|---|---|
capture_samples(num_samples=16384, parallel=True) |
np.ndarray (complex64) |
Captures num_samples synchronized complex IQ samples across all 5 channels, returning an array of shape (5, num_samples) (also callable via read_samples()). |
capture_spectrum(fft_size=4096, decay=0.0) |
dict |
Computes server-side windowed FFT spectra for all 5 channels, returning {'frequencies_mhz': ..., 'psd_dbfs': ..., 'powers_dbfs': ...}. |
capture_powers() |
np.ndarray (float32) |
Returns a 1D array of instantaneous average channel power in dBFS for all 5 channels. |
calibrate(num_samples=65536) |
dict |
Runs an automated phase and integer-sample delay calibration sequence using the internal noise source. Returns {'delays': ..., 'phase_offsets_deg': ..., 'correlation_peaks': ..., 'sample_rate_hz': ...} relative to Channel 0. |
set_noise_source(enable=True) |
bool |
Explicitly enables (True) or disables (False) the internal broadband calibration noise source on Channel 0 GPIO 0. |
configure(freq=None, rate=None, gain=None) |
dict |
Updates center_freq, sample_rate, and/or gain in a single call and returns the active RF settings dict. |
read_frame(num_samples=8192) |
dict |
Reads a synchronized multi-channel frame metadata dictionary including frame count, timestamp, RF settings, and per-channel power in dBFS. |
start() / stop() |
bool |
Starts or stops SDR acquisition (stopping also ensures the calibration noise source is turned off). |
close() |
None |
Releases the client session and disables the internal calibration noise source if active. |
Tips and Tricks
1. Phase & Sample-Delay Alignment
Even though all five R820T2 tuners on a KrakenSDR share a single master clock, each USB data stream starts with an arbitrary integer-sample offset and fractional-wavelength phase offset when initialized. Before running direction-finding algorithms (such as Bartlett beamforming or MUSIC), calibrate the array against the internal noise source and apply the corrections in Python:
# Run hardware noise-source calibration (if supported by deployment schema)
cal = sdr.calibrate(num_samples=65536)
delays = cal["delays"] # Integer sample lags [0, d1, d2, d3, d4]
phases_deg = cal["phase_offsets_deg"] # Phase offsets [0.0, p1, p2, p3, p4]
# Capture live antenna data
raw_iq = np.asarray(sdr.read_samples(16384), dtype=np.complex64)
# Apply integer delay shift and phase rotation to align with Channel 0
aligned_iq = np.zeros_like(raw_iq)
for ch in range(5):
shifted = np.roll(raw_iq[ch], -int(delays[ch]))
aligned_iq[ch] = shifted * np.exp(-1j * np.deg2rad(phases_deg[ch]))2. Use Fixed Manual Gain for Array Processing
Never leave sdr.gain = 'auto' when performing beamforming, interferometry, or MUSIC/ESPRIT direction finding. Independent automatic gain control (AGC) loops on the five tuners can cause time-varying amplitude and phase jumps between channels. Always set a fixed numeric gain (for example, sdr.gain = 29.7 or 32.8).
3. Sample Rate Selection for 5 Concurrent USB Streams
Because KrakenSDR streams five RTL2832U USB interfaces concurrently through an internal USB hub, sample rates above 2.4 MSPS can cause USB FIFO drops that break inter-channel phase coherence. Stick to 1.024 MSPS, 2.048 MSPS, or 2.4 MSPS for reliable phase-locked operation.