sdr-receiver
Instructions

1. Getting Started


The SDR Receiver application requires a signal server that is not included with the application and must be separately obtained and installed.  The signal server will generally include a radio that is connected by USB to a host computer that runs a server application.  Three types of signal servers are supported: servers with an RTL-SDR type radio running the rtl_tcp server application; servers with an Airspy HF+ radio running the hfp_tcp server application; and servers with an SDRplay radio running the rsp_tcp server application.   



rtl_tcp Installation and Operation


To operate with an RTL-SDR type of radio, the librtlsdr package  must be installed on a host computer.  The package consists of a library and a number of utilities, one of which is the rtl_tcp server application.  The librtlsdr package is developed and maintained on Osmocom.org at rtl-sdr - Software to turn the RTL2832U into a SDR receiver.  Various clones and modifications may be found on GitHub.  Instructions for building the library on various platforms may be found on the Web, for example SDR on Raspberry Pi 3 (software) – Medo's Home Page, April 18, 2016 and How to compile librtlsdr on Windows · One Transistor, December 16, 2017.


The rtl_tcp server application is a wrapper for the librtlsdr library that communicates with the RTL-SDR radio over USB via the library, and receives commands and streams IQ data over the network via TCP.  It is invoked by


rtl_tcp -p <port-number> -a 0.0.0.0


and will indicate that it is connected, and will echo commands as it executes them.  If -p <port-number> is omitted, the server will listen on port 1234 which is the default.  SDR Receiver references the server by IP address or by symbolic name using Bonjour/Avahi on a LAN.  It allows a port number to be specified, and will use a default port number of 1234 otherwise.  



rtl_tcp Installation — macOS 


Pre-built binaries for macOS are available as part of a package prepared for a course at UC Berkeley:


RTL-SDR Installation Instructions - EE123, EECS, UC Berkeley - Spring, 2017


Download the macOS package rtlsdr_osx.zip and extract the archive.  In a terminal window, create two directories (if they do not already exist):


>> sudo mkdir /usr/local/bin

>> sudo mkdir /usr/local/lib


In the directory in which the archive was unpacked, execute the following commands to copy the files to the right place:


>> sudo cp rtl* /usr/local/bin/

>> sudo cp lib* /usr/local/lib/


The rtl_tcp application will be found at 


/usr/local/bin/rtl_tcp


and it can be invoked as rtl_tcp if /usr/local/bin is in the search path, and with the full path name otherwise. 



rtl_tcp Installation — Windows 


Pre-built binaries for Windows are available as part of a package prepared for a course at UC Berkeley:


RTL-SDR Installation Instructions - EE123, EECS, UC Berkeley - Spring, 2017


Download the Windows package from the link on that site: rtlsdr_osx.zipor from the rtl-sdr project on the osmocom.org site where a pre-built Windows version can be found:


http://osmocom.org/attachments/download/2242/RelWithDebInfo.zip


In addition to obtaining the executables from one of the sites above, the Zadig utility must be run to install and configure the driver.  In some installations, this utility might be present and might have been used previously to configure the driver for some other application such as SDR#.  Note that it is possible for the driver to have been configured so that it works properly with an RTL-SDR radio and SDR# but can still give an error when rtl_tcp is executed.  If Zadig has not previously been used to configure the driver, or if it has been installed but an error is reported when rtl_tcp is executed, then Zadig must be used to install or re-install the driver.


Download Zadig from https://zadig.akeo.ie Then:

  • Make sure that an RTL-SDR radio is plugged into a USB port.  Note that the driver configuration is for a particular USB port (socket).  After configuration, the driver should work with the RTL-SDR radio plugged into the port for which it was configured, but might not work if the RTL-SDR radio is plugged into a different port.  
  • Make sure that SDR# or any other program that might use the USB interface is not running.  Running programs are shown under the Windows Task Manager.
  • Run the zadig.exe utility as administrator (right click and select "Run as administrator”).
  • Under the Zadig Options  drop-down menu, check the first line "List All Devices", and un-check the second line "Ignore Hubs or Composite Parents”.
  • On the main window drop-down menu select "RTL2838UHIDIR".  Then to the right of the green arrow there should be a selection beginning "WinUSB ..." - choose this one if it is not shown already.  Hover the cursor over the numbers to the right of USB ID and it should show "Realtek ..." indicating that it is the USB ID of a Realtek device which is the RTL-SDR dongle.   
  • Make sure "Reinstall Driver" is shown on the large button, and select it.  The driver should then be installed, and Zadig should report that it completed successfully

Now change to the directory that contains the utilities downloaded from UCB or from osmocom.org.  Run rtl_test -t to check the status of the interface.  It should show the RTL-SDR dongle.  Then rtl_tcp -a 0.0.0.0 should start the server.   In this configuration, both SDR# and rtl_tcp -a 0.0.0.0 will run.  However, they can not both be run at the same time.  Find the IP address of the PC under Settings → Network & Internet → Wi-Fi → Hardware Properties.  Note the IPv4 address and enter that in the Settings → Host panel on SDR Receiver.


The procedure above has been tested and works properly on Windows 10.  A similar procedure should work on other recent versions of Windows.



hfp_tcp Installation and Operation


The hfp_tcp server application is required to operate SDR Receiver with an Airspy HF+ radio.  This open source application is available as source code that must be compiled, installed and executed on the host computer.  It consists of a single source file and a Makefile which require two header files and a dynamic library that are part of the Airspy HF+ Library package. 


Building hfp_tcp will generally consist of two steps:


Step 1: Download and build the Airspy HF+ Library.

Step 2: Download and build hfp_tcp.


The first step will place the dynamic library and header files in standard system locations.  In the second step, the compile and link process will look in these standard locations to locate the header files and dynamic library that are required to build and run hfp_tcp.


If the Airspy SPY Server application has been successfully installed on the Raspberry Pi, Step 1 below will have already been completed and it does not need to repeated.  In this case, skip Step 1 and just follow the directions under Step 2.



Step 1: Download and Build the Airspy HF+ Library


The Airspy HF+ Library is an open source  package that includes a library and user mode driver for the Airspy HF+ radio.  The source code and directions for building the package are in the Airspy airspyhf GitHub repository at:


airspy/airspyhf: Code repository for AirspyHF+


To build the library on Raspberry Pi Raspbian, follow the directions under “How to build the host software on Linux” in the README on the airspyhf GitHub repository.


To build the library on macOS, the first step of the Airspy directions for Linux (the command beginning “sudo apt-get install …”) must be replaced by a series of steps which install utilities and libraries that are required to build libairspyhf.  These utilities and libraries are: brew, libusb, cmake, wget and pkg-config.  The initial step of installing brew will also install some other packages including the Xcode Command Line Tools.  The complete sequence is as follows:


Install Homebrew


Homebrew — The missing package manager for macOS

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


Install libusb


http://macappstore.org/libusb/

https://stackoverflow.com/questions/3853634/how-to-set-up-libusb-on-mac-os-x

brew install libusb

brew link libusb

The link step will attempt to create symbolic links in /usr/local/lib for libusb-1.0.0.dylib and libusb-1.0.dylib and some other files, and will fail if any of these exist.  If that happens, move or remove the files that are reported as already existing.


Install CMake


https://cmake.org/download/

homebrew - Installing cmake with home-brew - Stack Overflow

brew install cmake


Install wget


brew install wget


Install pkg-config


brew install pkg-config

 

Download and Build libairspyhf


GitHub - airspy/airspyhf: Code repository for AirspyHF+

Clone libairspyhf

~/Local/SDR $ git clone https://github.com/airspy/airspyhf.git

cd airspyhf

mkdir build

cd build

cmake ../ -DINSTALL_UDEV_RULES=ON

make

sudo make install




Step 2: Download and Build hfp_tcp


The hfp_tcp application is a single source file.  It can be built with the included Makefile which requires header files and a dynamic library that were installed in Step 1 above.  The process is the same for both macOS and Raspberry Pi Raspbian.  The hfp_tcp application is on GitHub at:


WB2ISS/hfp_tcp: An rtl_tcp-"like" server for the Airspy HF+ SDR


The following commands should be executed in a terminal window.  These commands will clone the hfp_tcp repository from GitHub into a local directory and will then build and install the executable:


git clone https://github.com/WB2ISS/hfp_tcp.git

cd hfp_tcp

make

sudo make install


The target operating system will be detected and applied to obtain the correct compile and link command for the target system.  The detected OS will be displayed as Darwin for macOS and Linux for Raspberry Pi Raspbian, and the build command that is being executed will be shown.   The sudo make install step will copy the executable into /usr/local/lib where it will be found as part of the standard execution path.


Compilation requires the header files airspyhf.h and airspyhf_commands.h and the executable requires the libairspyhf driver. If the Airspy HF+ Library has been installed as described in Step 1, these dependencies will have been placed in standard system locations and will be located by the compile and link process.  


By cloning the hfp_tcp repository it becomes very easy to obtain updates.  First cd to the the hfp_tcp repository. Then the steps are:


git pull

make

sudo make install


The git pull will obtain updates to the repository if there are any.  Then, if there was an update, the make step will detect that, and if the source code was updated it will build a new executable.  The sudo make install step will install the new executable in /usr/local/bin.


To run the hfp_tcp application, connect an Airspy HF+ radio to the system via USB.  The hfp_tcp application can then be executed with the command hfp_tcp.  By default, the application will listen for an incoming TCP/IP connection on port 1234.  An alternate port can be specified with the -p flag.  For example, to start the application listening on port 1024, the command is:  hfp_tcp -p 1024.


By default, for compatibility with the rtl_tcp protocol, hfp_tcp streams data consisting of 8-bit samples.  In order to take advantage of the additional resolution of the analog to digital converter in the Airspy HF+ radio, hfp_tcp can also stream data consisting of 16-bit samples to SDR Receiver.  To stream 16-bit samples, start hfp_tcp with the -b 16 flag and in SDR Receiver, on the Settings tab, select Sampling and set Sample Size to 16-bits.



rsp_tcp Installation and Operation


The rsp_tcp server application is required to operate SDR Receiver with an SDRplay radio.   This application is provided by SDRplay in source and in executable form for Mac, PC and RaspberryPi.  The source code is available on GitHub.   Information on the release and links to the binaries and the RSP_TCP Server User Guide can be found at:


Updated version of the RSP TCP Server - SDRplay Community Forum, February 17, 2019.


There is a user guide for rsp_tcp: RSP_TCP Server User Guide  and binaries can be found on the SDRplay Downloads Page: Downloads – SDRplay


The source code and directions for building the application can be found on GitHub at:


rsp_tcp - SDRplay/RSPTCPServer: RSP TCP Server - GitHub.com


Note that SDRplay API 2.13 must be installed before source can be built or binaries run.  The API can also be found on the SDRplay Downloads page: Downloads – SDRplay


Also, when running rsp_tcp, it is necessary to provide the full IP address of the host computer rather than the -a 0.0.0.0 shorthand which works with rtl_tcp and hfp_tcp.


By default, for compatibility with the rtl_tcp protocol, rsp_tcp streams data consisting of 8-bit samples.  In order to take advantage of the full resolution of the analog to digital converter in the SDRplay radios, rsp_tcp can also stream data consisting of 16-bit samples to SDR Receiver.  To stream 16-bit samples, start rsp_tcp with the -b 16 flag and in SDR Receiver, on the Settings tab, select Sampling and set Sample Size to 16-bits.


2. Using the Application


After a signal server has been configured and started, determine the IP address of the server or the symbolic name at which the server can be found on the LAN.   The IP address may be an IPv4 address or an IPv6 address.   A symbolic name on a LAN may be a name that is resolved through the Bonjour or Avahi protocol.    The servers all use port 1234 as the default, but an alternate port can be specified with the -p flag when the server is started.  


The functions of SDR Receiver are divided into three tabs: Stations, Lists and Settings.  The Stations tab controls the frequency, modulation type and gain applied to the signal that is being demodulated and played.  The Lists tab provides methods for creating and managing lists of stations.  The Settings tab provides controls related to the network, signal server and operating parameter of the application.



Stations Tab


The Stations tab has controls for frequency, modulation type, LNA gain, volume, and an On/Off switch that starts and stops the stream of data from the server.  The application manages lists of stations.  One list of stations is active and is displayed on the Stations tab from which individual stations can be entered, edited, reordered and deleted.  When a signal is being streamed, the magnitude of the energy in the signal passband will be displayed as the height of a green signal strength bar in the center of the upper portion of the display.


Selecting a Station

In SDR Receiver, a station is specified by a frequency in MHz, a modulation type of narrowband FM (NFM), wideband FM (WFM) or amplitude modulation (AM), and a description.  A station may be selected from the active list of stations that are displayed.  The selected station will be highlighted in blue.  A frequency and modulation type may also be entered directly with the controls at the top of the screen.    


Frequency Display

The current frequency is displayed at the top of the Stations tab screen.  The frequency may be increased by tapping or holding the up arrow, and decreased by tapping or holding the down arrow.  Holding the up or down arrow is equivalent to a continuous sequence of taps.  The increment by which the frequency changes with each tap of the up or down arrows may be set for each modulation type by selecting Tuning on the Settings tab.


Modulation Type

AM, NFM or WFM modulation may be selected.


Streaming

The On/Off switch starts and stops the streaming and processing of data from the signal server.  When the switch is set to On, a connection to the signal server is initiated and the connection state will be displayed below the Modulation Type control.  When the switch is set to Off, the connection is closed and streaming stops.


LNA Gain

For radios that support this function, SDR Receiver allows enabling or disabling AGC,  and controlling LNA gain when AGC is disabled.  When the AGC/Man control is set to AGC, the tuner AGC function is enabled and manual LNA Gain control is disabled.  When the AGC/Man control is set to Man, the tuner AGC function is disabled and the LNA gain is set by the LNA Gain control. With RTL-SDR type radios, operating with AGC on often leads to distortion in the presence of strong signals, and better results are generally obtained with AGC off (Man) and LNA Gain set manually to around 30.2 dB.  This is the default configuration for the application.


Volume

The volume control sets the audio amplitude level of the audio signal generated by the application.


New Station

The + button brings up the New Station entry screen.  There are fields for entering a frequency and description, and a control for selecting the modulation type.  The frequency is specified in MHz with three or four digits to the right of the decimal separator.   The fields and modulation type are initialized with the current frequency and modulation type and the description of the last selected station.  When a new station is saved, it is added at the bottom of the active list on the Stations tab, but the current frequency and modulation type are not changed.  To set the frequency and modulation to that of the new station, it must be selected from the list.


Managing the Active List

Stations in the active list may be deleted, updated and reordered via the Edit button or by swiping left on a station.  When the Edit button is tapped, controls will appear on the left and right of each station in the list.  The control on the right allows reordering stations in the list.  The control on the left allows selecting a station which will then show buttons for Update and Delete.  Selecting Update will bring up a screen that provides fields for entering or updating the frequency, description and modulation type of the selected station.   Selecting Delete will delete the station from the list.  Instead of tapping the Edit button, a swipe left on a station in the list will also bring up Update and Delete controls for that station.



Lists Tab


The Lists tab provides a set of Preset lists, and the ability to create, rename and manage Custom lists.  The active list is selected from the Custom lists and highlighted in blue.   A new empty Custom list can be created by tapping the + button.  A new Custom list with the name and contents of a Preset list can be created by selecting a Preset list.   A Custom list may be renamed, deleted or moved via Edit or by swipe left on the name of the Custom list. 


Preset Lists

The application comes with certain lists built in as examples and for use in areas where they apply.   To use a Preset list, go to the Lists tab and select the list.  This will create a new Custom list with the name and contents of the selected Preset list, and this new list will become the active list and will be highlighted in blue.  The Preset section may be collapsed or expanded by tapping the Preset section header.  


Custom Lists

Selecting a Preset list creates a new custom list containing stations.   A new empty custom list is created by tapping the + button which brings up a screen on which a name for the new list can be entered.   When the Save button is tapped, a new empty list with the specified name is created and it becomes the active list.  Tapping the Edit button allows rearranging the order of the custom lists, deleting a list, and updating the name of a list.   A swipe left on a custom list will show buttons for Update and Delete.  Selecting Update will bring up a screen with which the list name can be updated.  Selecting Delete will delete the list.   Note that the active Custom list, which is highlighted in blue, can not be updated or deleted.  To update or delete the active list, first select another Custom list so that it becomes the active list, then update or delete the first list.   Also note that this restriction means that there will always be at least one Custom list, and if there is only one Custom list it will be the active list, it will be highlighted in blue, and it will not be possible to update or delete this list while it is the only Custom list.  


Settings Tab


The Settings tab provides controls related to selecting the network address of the signal server, configuring the operating parameters of the signal server and radio including the server type and sampling rate, and settings related to the operation of SDR Receiver including audio filters and squelch.


Network Settings: Host

The host is specified by an IPv4 address, an IPv6 address or a symbolic host name.  The IP address or host name should specify a host at which a signal server application is listening for TCP/IP connections.  After an IP address is entered, tap Save to set it as the current IP address.  Previously saved IP addresses and host names are shown in a drop-down list that is displayed when the IP address field is selected.  This enables previously entered IP addresses and host names to be easily re-used.  Entries in the drop-down list may be deleted by swiping left.  Tapping Reset at the bottom of the drop-down list will delete all previously entered IP addresses and host names and reset the list to preset entries.


Network Settings: Port

The port is specified by a port number in the range 0-65,535.  The port number is initially set to the default value of 1234.  After a port number is entered, tap Save to set it as the port number.  Previously saved port numbers are shown in a drop-down list that is displayed when the port number field is selected.  This enables previously entered port numbers and host names to be easily reused.   Entries in the drop-down list may be deleted by swiping left.  Tapping Reset at the bottom of the drop-down list will delete all previously entered port numbers and reset the list to preset entries.  


Server Settings: Server Type

Select RTL-SDR , Airspy HF+ or SDRplay.    


Server Settings: Sampling

For RTL-SDR type radios and signal servers, the application supports sampling rates of 240 ksps, 960 ksps, 1,440 ksps and 1,920 ksps.  For Airspy HF+ only one sampling rate is supported, 768 ksps, and this sampling rate is automatically set when Airspy HF+ is chosen as the Server Type.   SDRplay radios will work with any of the available sampling rates.   For streaming to be successful, the computers and network connections must be able to sustain streams at the corresponding data rates.  Certain RTL-SDR radios support a Direct Sampling mode that allows operation at lower frequencies.  This is supported by the Direct Sampling controls that allow choosing I Channel or Q Channel modes.   For Direct Sampling with the RTL-SDR V3 radios, select Q Channel.  RTL-SDR radios deliver 8-bit samples.  Airspy HF+ and SDRplay radios have analog to digital converters with resolution greater than 8-bits and to take advantage of that increased amplitude resolution, when Airspy HF+ or SDRplay has been selected as the Server Type, a 16-bit Sample Size option is enabled and may be selected.  Note that selecting a Sample Size of 16-bits will double the streaming bandwidth.  To stream 16-bit samples, the hfp_tcp or rsp_tcp application should be started with the -b 16 option. 


SDR Settings: Audio Filter

The application provides a large set of audio high pass and low pass filters.  Each modulation type has its own set of filter values and default values.   Initially the filters are set to default values.  For each filter type—Low Pass and High Pass—there is a control that can be set to Default or to a numeric value.  Tapping Default will choose the default value which will be shown on the right segment of the control.  Tapping the numeric value will bring up a list from which other values may be selected.  Tapping any numeric value—either a displayed value from the list or the value shown on the control—will cause that value to be selected and shown on the control, and will cause the list to be hidden.  A selected default or numeric value will become active in the audio filter immediately when it is selected, and if a station is streaming the effect of that filter will be heard.  This allows different audio filter values to be quickly selected and evaluated.  Tapping Save will cause the selected filter value to be saved and the Audio Filter panel to be dismissed.  Tapping Cancel will cause any selected filter values to be discarded, the audio filters will be reset to the values that they had when the Audio Filter panel was first selected, and the Audio Filter panel will be dismissed.  This allows experimentation with new filter settings and then returning to previously chosen values.


SDR Settings: Squelch

A Squelch Enable and Squelch Threshold value may be set for each modulation type.  When Squelch Enable is set to Off, audio will always play with no squelch.  With Squelch Enable set to On, the squelch will operate with a threshold set according to the Squelch Threshold control.  When this control is set to the extreme left side (Low) the squelch function is off (equivalent to Squelch Enable Off).   As the squelch control is moved to the right, a stronger signal is required to break squelch.  There are two different squelch algorithms depending upon modulation type.  For FM signals the squelch is based on quieting at the higher audio frequencies in the demodulated audio signal.  This quieting is largely independent of received signal amplitude, and a squelch threshold setting in the middle of the range should work for all but the very weakest signals.  To hear very weak signals, the squelch function should be disabled.  For AM signals the squelch is based on energy in the signal passband before the demodulator.  In general, this level should be set by listening when no signal is present, moving the Squelch Threshold control from left to right to just past the point at which squelch quieting begins.  Moving the control further to the right will result in a stronger signal being required to break squelch.  The proper Squelch Threshold setting will generally depend upon the conditions of the band.


SDR Settings: Tuning

The frequency may be changed by tapping or holding down the up and down arrows on either side of the frequency display at the top of the Stations tab.  The Tuning Step Size is the increment by which the frequency changes with each tap.  For each modulation type, a different step size may be set from the Tuning selection on the Settings tab.  There is a drop-down list from the right size of the Tuning Step Size selector that provides a range of step size choices from 100 Hz up to 200 kHz.  There is also a Default option on the left side of the selector.  When the Default is chosen, the corresponding Default step size is shown on the right side of the selector.


Help.v11