RTL-SDR Tutorial: Setting up and using the SpyServer Remote Streaming Server with an RTL-SDR

A number of people have asked how to use SDR#'s SpyServer with an RTL-SDR. In this tutorial we will show how to set up SpyServer on both Windows and Linux systems. We try to assume as little knowledge as possible, but we do assume that you have decent experience with computers. Also for the Linux/Raspberry Pi setup we need to assume that you have some basic experience with Linux and setting up Raspberry Pi's.

What is SpyServer?

SpyServer is a free RTL-SDR compatible SDR server that is designed to work with the popular SDR# software. It is actually designed for the Airspy range of products, but the author has also made it compatible with RTL-SDR dongles. Running a SpyServer allows you to connect to and use a remotely positioned RTL-SDR over a network connection (such as a local LAN/WiFi or the Internet). Once connected, using the dongle is the same as if the dongle was directly connected to the users PC.

An example SpyServer Overview (Can use an RTL-SDR instead of the Airspy HF+)

Remote servers are useful as you may want to set up an antenna in a remote location (such as up on your roof or shack), and don't want to run a long lossy coax cable down to the PC. Instead you could run Ethernet cable, or avoid cables by using WiFi. All you'd need is power for a remote computing device like a Raspberry Pi 3. Perhaps you also have a great antenna location at a friends house, or other property and want to access that antenna remotely. Or maybe you want to use your radio while travelling.

SpyServer is similar to another tool that you may already be familiar with called rtl_tcp. However, SpyServer is regarded as superior because it is signficantly more efficient at network usage. Instead of sending the entire raw data like rtl_tcp does, SpyServer only sends the IQ data of the currently tuned in signal. Waterfall data is processed on the server and sent in compressed form. There is one disadvantage to SpyServer in that it requires slightly more powerful computing hardware like a Pi 2 or Pi 3, whereas rtl_tcp can run on the lowest end hardware.

Network usage when streaming with SpyServer will be about 120 KB/s when listening to WFM and about 38 KB/s when listening to narrow band modes for one client being connected. Multiple clients can connect to the SpyServer and share the same currently tuned bandwidth.

Server: Setting up SpyServer on Windows

Setting up a SpyServer server on Windows is extremely simple.

Log on to the Windows PC that you want to be the remote server.

Go to www.airspy.com/download and download the latest version zip file of SDR#. Extract all the files onto a folder on your PC.

Run the install-rtlsdr.bat file to download the RTL-SDR drivers.

In the SDR# folder find the file spyserver.config. Right click it and select 'Open With -> Notepad'.

Edit the 'device_type' line to show 'device_type = RTL-SDR'.

Save and close the spyserver.config text file.

Double click on spyserver.exe to start the server.

Open the start menu and type in 'cmd' and then press enter to open a command prompt.

In the new command prompt type in 'ipconfig'. This will display a list of network adapters on your PC, with their current IP addresses. Find the one actively being used (likely Ethernet or Wireless) and note down the IPv4 Address. This is your server PCs IP address.

Server: Setting up SpyServer on Linux

Log into the Linux device that you are using for the server, and open a terminal window if needed.

First install prerequisites such as the RTL-SDR drivers and librtlsdr.

sudo apt install rtl-sdr librtlsdr-dev

Create a new folder for the spyserver and navigate into it.

mkdir spyserver
cd spyserver

Download the latest SpyServer and extract it using the commands below. NOTE: That you will need to download the correct version for the platform that you are using (e.g. 32 or 64-bit, ARM or x86). Go to airspy.com/download, and find the links for the SpyServer download that matches your platform. Replace the link below with it. The link used in this example is for the 32-bit ARM version which is what Raspberry Pi's and most other single board PCsww like Odroids and Orange Pi's use.

Use a text editor like nano to edit the spyserver.config file. Change the "device_type" to "device_type = RTL-SDR" (without quotes).

If you are unfamiliar with Nano, then note that you cannot use the mouse. You will need to use the arrow keys to move the cursor. Editing is done with the bakspace/del keys and keyboard keys as usual. To save and exit, Press "Ctrl + X", and then the "y" key.

nano spyserver.config

Find your device's IP address using the "ifconfig" command. Note NOT "ipconfig" from windows, notice the "f". Write this IP address down as it is the address you'll use to connect to the SpyServer.

Now you can run SpyServer

./spyserver

Note that if you get the error './spyserver: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./spyserver)', then you'll need to install the newer GCC-5 or GCC-6.

To do this use the following steps:

Type 'sudo nano /etc/apt/sources.list' and change the word 'jessie' to 'stretch'. Save and close the file (Ctrl+X, Y)

Type 'sudo apt-get update'

Type 'sudo apt-get install gcc-5' or if that is not found 'sudo apt-get install gcc-6'

If you get error 'W: There is no public key available for the following key IDs:EF0F382A1A7B6500' after running 'sudo apt-get update', then first install the following with 'sudo apt-get install debian-keyring debian-archive-keyring'

You'll be asked a few questions during the install and all the defaults are fine. Installation will take about 20 minutes. Once upgraded you should be able to run ./spyserver.

Tip: Setting up a headless Raspberry Pi

If you're setting up a Raspberry Pi as a server then you're probably not going to be connecting it to a monitor. This is called a headless setup. You'll also probably be using WiFi. This tip shows you how to enable SSH and enter the WiFi credentials on a Raspberry Pi without any monitor, keyboard or mouse. If you want you still can of course initially connect a monitor keyboard and mouse and set it up via the Raspbian GUI, or connect a network cable.

After writing the Raspbian image to the SD card, put it into a PC and open the boot drive partition in file explorer.

To enable SSH simply create an empty text file with the name 'SSH' in the root of the partition.

To allow a WiFiconnection create a text file called 'wpa_supplicant.conf' in the root of the partition and fill it with the following text. NOTE: Make sure that it is not wpa_supplicant.conf.txt. You must set Windows to display the full file extension so you can change it to just wpa_supplicant.conf. This will set up a WiFi connection on boot and automatically connect it. (Only good for WPA2 secured systems)

network={
ssid="YOUR SSID"
psk="YOUR PASSWORD"
key_mgmt=WPA-PSK
}

Finally you'll need to look in your routers status page to find the IP address of the Raspberry Pi. Usually the routers access page can be accessed at http://192.168.1.1 or 192.168.1.254, but this address is entirely dependent on your router set up. Consult your router manual or ISP for these details if you do not know them.

Client PC: Connecting to the SpyServer

Once you've set up the server you can now connect to it from a client PC.

Log on to the Windows PC that you want to browse the radio spectrum with (client PC). This PC should be on the same network as your server PC (or see below about port forwarding to use remotely over the internet).

Download and extract the latest SDR# version on the client PC.

Open SDR#.

Under Source select 'Spy Server'.

Enter the IP address of the server in the following format: 'sdr://IP_ADDR:5555' (without quotes).

Press the play button.

You should now be connected to the remote SpyServer and the spectrum should be active.

There are some additional options that you'll see in the Source box. Apart from the standard gain and bandwidth settings there is an IQ format drop down box and a 'use full IQ' checkbox.

Use Full IQ - This essentially reverts SpyServer back into rtl_tcp, sending the entire IQ data over the network. Note that you'll need to press the stop button first or this option will be greyed out.

IQ Format - This enables/disables IQ compression. With an RTL-SDR in most cases you should use PCM 8bit to keep the network data as low as possible. If you experience problems you can try other options.

The limitation with 8-bit mode is that you might loose dynamic range, but for most signals (and the RTL-SDR which is 8-bits anyway) it will be fine. Higher end SDRs like the HF+ may benefit from PCB 16-bit or higher modes in some cases.

SpyServer Options

Tweaking SpyServer

If you're having performance issues on slower hardware or networks like choppy audio then you might want to reduce the frame rate. You can do this in the spyserver.config text file by editing the 'fft_fps' variable. By default it is 15, try lower values to improve performance. Lower the frame rate results in a more pixelated waterfall in SDR#.

You may also want to play with increasing the 'buffer_size_ms' and 'buffer_count' variables if you experience choppiness especially over the internet.

After editing the file restart the server.

Using SpyServer with an Upconverter

This is simple, but you need to know your upconverters offset. For example the ham-it-up upconverter has an offset of 125 MHz (-125,000,000 Hz) and the SpyVerter upconverter has an offset of 120 MHz (-120,000,000 Hz). If you have another upconverter and are unsure of the offset then consult the manufacturer or it's documentation.

To set the offset in SpyServer edit the spyserver.config file with a text editor. Uncomment the 'converter_offset' variable by removing the '#' next to it (do not delete the '#' on the two lines above). You can then set the offset used by your upconverter after the equals sign.

Setting 'converter_offset' to -120,000,000 for a SpyVerter Upconverter. Make sure to uncomment it by deleting the '#' next to it.

Running SpyServer Automatically on Boot (Raspberry Pi)

You may wish to set up your server so that it automatically starts on boot. Doing so is simple with crontab.

Port Forwarding

If you want to connect to your SpyServer over the internet then you may need to activate port forwarding on your router. You need to tell your router what IP address or MAC address to forward data coming in from port 5555 which is the default SpyServer port. The data should be forwarded to the IP address or MAC address of the device running the SpyServer. You'll probably also want to ensure that the device running the SpyServer is set to a static IP from within your router.

Port forwarding is slightly out of the scope of this tutorial as the procedure is different for each network router. There are guides for most routers in the world at portforward.com.

You can find your public IP by browsing to whatismyip.com on a PC on your network, or by running 'curl ifconfig.me' at a Linux terminal.

Public SpyServer Servers

If you want to try out some publicly available remote SpyServers over the internet then please check out airspy.com/spy-servers. We've found that streaming over the internet even across the world is fairly smooth and problem free.

38 comments

I have SpyServer running perfectly for a single RTL dongle on Windows 7 for the host PC and client with SDRT# v 1.0.0.1672. However, I have two scenarios that i can’t figure out as follows;

Scenario 1
************
With a single dongle, the tuning range is limited to 2 MHz when a second user connects and also for the original user who had full range of tuning. When the second user disconnects – the original user regains full range tuning. Any ideas?

Scenario 2
************
I would like to run 2 dongles on a single PC and spyserver for each dongle. So far I have 2x SDR# folders (for each dongle) and have changed port numbers (5555 & 6666) in the spyserver.config in each of the SDR# folders. I can connect to 5555 okay but 6666 won’t connect. The spyserver command window for 6666 says;

Looking up the change log r144 was never released and if it was it would have been back in January 2012 (~1,528 releases since then, it would be the caveman version of SDR#). If I assumed that you made a typo and left out a 4 and actually meant r1444 that is still pretty old April 2016 (there have been 228 releases since than).

Maybe contact their support (” create a support ticket” at the bottom of this page https://www.globaltuners.com/wiki/receiver_setup ) and ask them to re-build the plugin for the current version (one that is not +2 years old).. Although that page does not explicitly say that the plugin will not work with later versions of SDR#, just that it may not, have you tried.

My two suggestions would be to:
1 check that you are trying to run 32 bit binary on a 32 bit OS, check that your OS is 32 bit (or 64 bit) with “getconf LONG_BIT”
2 check that all required dependencies are installed “ldd spyserver” if they are not and you are running a 64 bit OS then you will need to install the 32-bit dependencies “armhf”.
I do not own any RPi hardware so can not tell you what the exact commands would be, but I would guess the following or something similar:
$ sudo dpkg –add-architecture armhf
$ sudo apt-get update
$ sudo apt-get install libc6:armhf

Whatever dependency is missing use a command like “sudo apt-get install *:armhf” where you replace the * with the missing 32-bit dependency.

First of all, thanks for this beautifull piece of software! I tried to put in on a Raspberry Pi2 and got “Segmentation Fault” when i tried to start the spyserver. Then, the same installation moved to a Raspberry Pi 3 Model B with 1 Gb RAM. Works flawlessly! Tried to run it on a Raspberry ZeroW with 512 Mb RAM, got the same “Segmentation Fault”. I believe the Spyserver is tied to a 1GB RAM. Can the software be compiled to run on a 512 Mb RAM version of Raspberry? Thank you, 73 de Adrian YO3HJV

I’m trying to set up running two server instances running on Ubuntu Linux 16.04. Have each instance running separately but only works with the “wildcard” value (0 or unspecified) for device_serial. As soon as I change the config to specify the serial number, it fails when I try to connect to the server. I’ve tried with two dongles, one of which has the factory default serial number of 1, and the other I changed it to 3 using RtlTool.

I’m specifying it in the config file like this:

# Device Serial Number as 64bit Hex
# A value of 0 will acquire the first available device
#
device_serial = 3

I concluded that the value required for device_serial is specifically a serial number for an AirSpy hardware device. Doesn’t look like SpyServer supports multiple generic RTL-SDR devices. Posted a question to the AirSpy support forums but never got a reply.

I double click the spyserver.exe and the prompt window opens then closes right away, no connection. I run the exe from the prompt and I get this:
SPY Server v2.0.1617 – http://airspy.com
Reading the configuration file: spyserver.config
Unable to load user mode driver for ‘RTL-SDR’

RPi is cheap, for a reason, when it comes to shoving large amounts of data around fast, it is at or very near the bottom of all devices I can think of. All RPi devices have one real USB 2.0 High Speed port, the B and 3 have a USB hub hardwired into that which is shared by the NIC and four ports are exposed to the world. So if there is lots of network traffic other USB devices have less available bandwidth. And if there is major USB traffic then the network starts to drop packets. It is a bit like sticking 5 funnels in a funnel, and expecting to be able to fill a bottle up faster.

But lets do the numbers
100Mbit/sec is ~11.9MB/sec (data throughput after you remove the TCP/IP packet headers)
A RTL-SDR running at the maximum rate with no drops is 2.4MSPS (I+Q) so 4.8MB/sec
Two of them would be ~9.6MB/sec
9.6MB/sec is less than 11.9MB/sec, so it should which is good. The only question now is, are the two FFT displays streaming for each device going to fit into the remaining 2.3MB/sec (or 1.15MB/sec per device) I don’t know.
Oh and with 3 devices running at once (RTL+RTL+NIC) sharing a single USB 2.0 HS port you will probably not get the maximum through put you will loose at a guess 10% to 30%, but even then there should still be enough room, unless you have other USB devices connected.

For shoving data around (not processing power) the BPI-M1 with an actual SATA-2 interface 300MB/sec (not a sata-2-usb chip 40MB/sec) and gigabit Ethernet is not bad.. But the dual core ARM Cortex-A7 (depending on the governor setting can be clocked anywhere from 30MHz up to 1.49GHz with no stability issues that I’ve seen) is about the same level of CPU number crunching as a RPI-2B with 4 ARM Cortel-A7 cores running at 700 MHz (if you ignore the GPU’s which are not usable for data processing in the BPI-M1) . There are later BPI models but they use crappy sata-2-usb chips and the same internal USB hub junk that the RPI do. So it like the RPi-2B looking at the CPU in isolation has about 50% of the number crunching ability of a RPi-3, but for moving data about it is good.

My current favourite board is the Odroid-XU4 with 4 small A7 CPUs (200MHz to 1.4GHz) and 4 big A15 CPUs (200MHz to 2GHz) which is approximately 2.5x the number crunching of the RPi3 quad core A53 @ 1.2 GHz (CPU’s only), Gigabit Ethernet, 1 USB 3.0 port (with an internal 2 port USB 3.0 hub chip connected to it) and 1 USB 2.0 HS port. Oh and an optional replaceable/upgradable eMMC which is ~140MB/sec read and ~39.3 MB/sec write (~7x/2x that of most default RPi microSD configurations http://www.pidramble.com/wiki/benchmarks/microsd-cards ) or you can use a UHS-1 MicroSD and have ~ 2x/1x the performance of the older SD-class10

There is the UP or Tinker board if Intel chips are preferred but they are a bit pricey. If you really do need GPU number crunching there is always the Jetson. I’m just amazed that people think that the whole RPi line is the bees-knees.

I should probably add that if you run a XU4 at maximum CPU load, it does get hot, and if the temperature gets too high it throttles down performance. If you plan on using it at the limits of performance, the default cooling system is a bit underwhelming and noisy, or at least it was with my revision of the board which was a while ago, they now have a XU4Q version with passive cooling. I suppose what I am saying is that I love the board, but the cooling system is bit anaemic if you are a performance junky.

I’m really impressed with AirSpy’s stuff, but I think it’s a little strange that they offer the SpyServer app for linux, but it’s nearly impossible to receive (or find documentation on how to receive) the signal with a linux computer.

The new SDR# runs in Mono, also, I’d wager there’s a way (or may be at some point) to rx the IQ stream in GNURadio -> GQRX.

Ignoring the technical advantages, I imagine the whole point of compiling Spyserver for linux is so we can use our SBC’s up the tower or at a satellite dish install instead of using a desktop or rack server, not to mention not having to pay for another windows license.

Thomas { No, you can see it here https://twitter .com/usa_satcom /following favorites stuff all the time that is conspiracy theories and such. That's fine for personal accounts but if ... } – Feb 21, 6:57 PM

Ernst Vondelaar { This antenna works like a charm on NOAA, Meteor-M2 and ISS. It works even better if you add reflectors below the V-dipole: six of the ... } – Feb 21, 10:28 AM

Submit a Story/Contact

Meta

What is RTL-SDR

The RTL-SDR is an ultra cheap software defined radio based on DVB-T TV tuners with RTL2832U chips. The RTL-SDR can be used as a wide band radio scanner. It may interest ham radio enthusiasts, hardware hackers, tinkerers and anyone interested in RF.