Skip to content

dernasherbrezon/sdr-server

Repository files navigation

About CMake Quality Gate Status

design

Key features

  • Share available RF bandwidth between several independent clients:
    • Total bandwidth can be 2016000 samples/sec at 436,600,000 hz
    • One client might request 48000 samples/sec at 436,700,000 hz
    • Another client might request 96000 samples/sec at 435,000,000 hz
  • Several clients can access the same band simultaneously
  • Output saved onto disk or streamed back via TCP socket
  • Output can be gzipped (by default = true)
  • Output will be decimated to the requested bandwidth
  • Clients can request overlapping RF spectrum
  • Rtl-sdr starts only after first client connects (i.e. saves solar power &etc). Stops only when the last client disconnects
  • MacOS and Linux (Debian Raspberrypi)

Design

design

API

  • Defined in the api.h
  • Clients can connect and send request to initiate listening:
    • center_freq - this is required center frequency. For example, 436,700,000 hz
    • sampling_rate - required sampling rate. For example, 48000
    • band_freq - first connected client can select the center of the band. All other clients should request center_freq within the currently selected band
    • destination - "0" - save into file on local disk, "1" - stream back via TCP socket
  • To stop listening, clients can send SHUTDOWN request or disconnect

Queue

design

The data between rtl-sdr worker and the dsp workers is passed via queue. This is bounded queue with pre-allocated memory blocks. It has the following features:

  • Thread-safe
  • If no free blocks (consumer is slow), then the last block will be overriden by the next one
  • there is a special detached block. It is used to minimize synchronization section. All potentially long operations on it are happening outside of synchronization section.
  • Consumer will block and wait until new data produced

Configuration

Sample configuration can be found in tests:

https://github.com/dernasherbrezon/sdr-server/blob/main/test/resources/configuration.config

Performance

Is good. Some numbers in test/perf_xlating.c

Dependencies

sdr-server depends on several libraries:

  • libvolk. It is recommended to use the latest version (Currently it is 2.x). After libvolk installed or built, it needs to detect optimal kernels. Run the command volk_profile to generate and save profile.
  • librtlsdr. Version >=0.5.4 is required.
  • libconfig
  • libz. Should be installed in every operational system
  • libm. Same

All dependencies can be easily installed from leosatdata APT repository:

sudo apt-get install curl lsb-release
curl -fsSL https://leosatdata.com/r2cloud.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/r2cloud.gpg
sudo bash -c "echo 'deb [signed-by=/usr/share/keyrings/r2cloud.gpg] http://apt.leosatdata.com $(lsb_release --codename --short) main' > /etc/apt/sources.list.d/r2cloud.list"
sudo apt-get update
sudo apt-get install libvolk2-dev librtlsdr-dev libconfig-dev

Build

To build the project execute the following commands:

mkdir build
cd build
cmake ..
make

Install

sdr-server can be installed from leosatdata APT repository:

sudo apt-get install sdr-server