SDRConnect
Modern Python library for SDR connectivity and data collection. Focused exclusively on connecting to SDR devices and collecting raw IQ data.
Features
- SpyServer Support: Connect to SpyServer instances for remote SDR access
- Modern Python: Built with Python 3.8+ and modern packaging standards
- Simple API: Clean, intuitive interface for SDR data collection
- Type Hints: Full type annotation support
- Extensible: Easy to add new SDR backends
Installation
pip install sdrconnect
Quick Start
SpyServer Example
import sdrconnect as sdr
import numpy as np
# Create configuration for SpyServer
config = sdr.SDRConfig(
host="localhost", # Change to your SpyServer host
port=5555, # Change to your SpyServer port
frequency=100_000_000, # 100 MHz
timeout=5.0
)
try:
# Create and connect to SpyServer
print("Connecting to SpyServer...")
client = sdr.SpyServerClient(config)
with client:
# Set up the SDR
client.set_frequency(config.frequency)
client.set_sample_rate(config.sample_rate)
client.set_gain(None) # Auto gain
# Start streaming
print("Starting streaming...")
client.start_streaming()
# Collect data for duration_seconds seconds
duration_seconds = 5.0
print(f"Collecting IQ data for {duration_seconds} seconds...")
iq_data = client.read_samples_timeout(duration_seconds)
# Save data for later processing
np.save("iq_data.npy", iq_data)
print(f"Collected {len(iq_data)} IQ samples")
print(f"Sample rate: {config.sample_rate} Hz")
print(f"Center frequency: {config.frequency / 1e6:.1f} MHz")
# Analyze the data
spectrogram, mean_psd, freq_axis, time_axis, _ = sdr.analyze_signal(
data=iq_data,
sample_rate=config.sample_rate,
fft_size=1024
)
print("Analysis complete!")
except sdr.SDRConnectError as e:
print(f"Connection error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
Configuration
SDRConnect uses configuration objects for easy management:
# Create config
config = sdr.SDRConfig(
host="localhost",
port=5555,
frequency=433_920_000, # 433.92 MHz
gain=20, # Manual gain
iq_format="complex64", # or "uint8"
timeout=30.0
)
# Save config
config.save("my_sdr_config.json")
# Load config
config = sdr.SDRConfig.load("my_sdr_config.json")
Supported SDR Devices
- SpyServer: Remote SDR access via SpyServer protocol
- RTL-SDR: Coming soon
Data Collection Best Practices
- Use Frequency Offset: Avoid DC spikes by offsetting from your target frequency
- Choose Appropriate Sample Rate: Balance between bandwidth and data size
- Monitor Connection: Use context managers or proper exception handling
- Data Format: Use uint8 for bandwidth efficiency, complex64 for precision
API Reference
SpyServerClient
connect(): Connect to SpyServerdisconnect(): Disconnect from SpyServerset_frequency(freq): Set center frequency in Hzset_sample_rate(rate): Set sample rate in Hzset_gain(gain): Set gain (None for auto)start_streaming(): Start IQ streamingstop_streaming(): Stop IQ streamingread_samples(n): Read n samplesread_samples_timeout(duration): Read for duration seconds
SDRConfig
Configuration class with validation and JSON serialization support.
Author
Isak Ruas - isakruas@gmail.com
License
Apache License 2.0 - see LICENSE file for details.
Metadata
Release files for sdrconnect 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sdrconnect-0.1.1.tar.gz | 15.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sdrconnect-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.7 kB
Release files / sdrconnect-0.1.1.tar.gz
| Download URL | sdrconnect-0.1.1.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73d7ae36fbec365fd6e5c2c82fc6d574c2711cd2bb8309ba6c4fbef5f2be387d
|
|
BLAKE2b-256 checksum How to use checksums |
ec3a4753f309af0a3612daea9d9defeb61e3c3c89ca137fd8d238c59cd97c5e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.
Transparency logRelease files / sdrconnect-0.1.1-py3-none-any.whl
| Download URL | sdrconnect-0.1.1-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb7867e32d265ec3a4b154b29cb18a884d580a9f8dad503a6b5d3a70c1819ac1
|
|
BLAKE2b-256 checksum How to use checksums |
65de5688300ae68d017296d18aa291d911082e61070c2d2db6ba0f4c69a4e7c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2025.
Transparency log