the FM receivers - SDR-J DAB

SDR-J-FM 0.98∗
Software for SDR : the FM receivers
Jan van Katwijk
Lazy Chair Computing
The Netherlands
[email protected]
February 17, 2015
∗
©: 2014, Jan van Katwijk, Lazy Chair Computing
1
1
Introduction
The distribution contains two version of an FM receiver, the ”regular” one, with all kinds of
buttons and displays, and a ”mini” version, without displays and with some settings predefined.
Both versions use the same processing engine, the difference is in the GUI.
In the 0.98 version of the SDR-J FM software special attention was payed to obtaining
compatibility with the so-called ”Extio.dll” libraries, a de facto standard for sdr equipment
under Windows.
”Hard-wired” support is built-in for the mirics sdrPlay, the RT2832 based DABsticks, the
airspy and - not for the mini version - a filereader, For the Windows version, an ”extio” option
is built-in with which extioXXX.dll’s can be loaded, for the Linux version a ”plugin” option is
built in. Predefined plugins are available for the Mirics dongle, the elad-s1 and the pmSDR.
2
Installation
The software comes - as with all SDR-J software - in two versions. For Windows there is a
single zipped folder containing the executables of the two versions of the FM receiver, together
with the executables for the SW receiver.
For Linux there are sources and one has to create the executables before running.
2.1
Installation under Windows
Unpacking the zip-file will create a folder named windows32-bin. This folder contains the
executables and a number of dlls1 .
Mirics SDRplay For the FM receiver, selection of the Mirics device is possible through
either a hard-wired choice or through the ExtioXXX.dll.
In either case one has to install the appropriate Mirics driver through a Mirics installer
program, to be obtained from the developers at http://www.sdrplay.com/downloads.html.
DABstick driver For the FM receiver, selection of a DABstick is possible through a predefined selection or through the ExtioRTL.dll.
In either case one has to download and install the appropriate rtlsdr.dll library, and install
another usb driver for the RTL2832 based sticks. Dowloading the ”.dll” file is best done
from the site of the developers http://sdr.osmocom.org/trac/wiki/rtl-sdr. Pls ensure that you
download the 32 bit version. Place the ”.dll” file in the windows32-bin folder or adjust the
searchpath.
The Zadig program is available for installing the required USB library. There are many
examples on the internet how to run Zadig. Basically just run the Zadig program with the
dabstick inserted in one of the USB ports. The Zadig program (should) detect(s) the DABstick,
and will suggest WinUSB as a replacement.
1
It is assumed that common dlls as required for many programs, such as MSVCR100.DLL are available on
the system
2
airspy For the FM receiver, selection of the airspy is possible through a predefined selection
or through the airspy.
The library for accessing the airspy is built-in2 .
2.2
Installation under Linux
For developing executables under Linux, the packed sources are available. A brief description
of building th executable under Linux is given in section 4.
3
Running the FM receiver
The executable of FM receiver is named sdr-j-fmreceiver-098.exe for Windows and sdr-jfmreceiver-098 for Linux. The ”mini” version is named sdr-j-fm-mini.exe resp sdr-j-fm-mini.
Under Windows the executable is found in the folder windows32-bin, under Linux in the
directory linux-bin or any other place where you might have put it.
The GUI of the fm receiver is structured into three parts:
• The top part contains two displays, the top one of which shows the the spectrum of the
incoming data, the second one shows the spectrum of the demodulated signal.
• The middle part contains sliders, selectors and buttons for device and frequency selection;
• The bottom part contains sliders, selectors and buttons for fm specific selections.
Furthermore, for any selected device a small window will be created, separate from the main
window. Through this control window some (a few) settings particular for that device, can be
set.
2
All rights acknowledged
3
3.1
Selectors and buttons for control
Buttons and selectors for control of frequency etc are displayed in the picture below
Device selection The device selector (labeled ”1”), once pressed, will give an option to start
with one of the devices listed on the selector (filereader, dabstick, sdrPlay, airspy (for Linux)),
or to start locating an ”extioXXX.dll” file in case of Windows or a predefined plugin in case of
Linux. The plugins for Linux can be found in input-plugins-fm, a folder within the linux-bin
folder. Under Linux, the pmSDR is usable through the pmSDR plugin. When selected, a
soundcard may be selected, the soundcards needs to be able to handle an inputrate of 192000.
Under Windows, one might select - when pressing the ”extio” selector an ExtioXXX.dll.
Under Windows, the pmSDR is usable through the appropriate ExtioPMSDR.dll.
Selecting a frequency A frequency (in Khz) can be selected3 using the numeric keys in the
GUI (the numeric keypad is labeled ”2”). With the Corr and the Clear button one removes
the last digit resp. the typed frequency. Selection of a frequency using the keypad is activated
by clicking on the ”KHz” button;
Altering a frequency can be done - other than typing in a new frequency - in several ways,
the most common ways are:
• by clicking with the mouse on a position in the top display;
• by clicking on the ”+” and ”-” buttons left and right from the keypad: the selected
frequency will be modified by the number of KHz mentioned on the button;
3
Many external devices interfacing through an ExtioXXX.dll have the possibility of selecting a frequency
through a local GUI. The Extio interface is such that a frequency passed this way will be set on the main GUI
4
• by the mousewheel, 1 Khz per click.
Attenuation and balancing The two sliders labeled ”6” are resp. for attenuating the HF
signal (the top one) and balancing the incoming signal (the second one). Moving the latter
slider to the left will cause a relative amplification of the I component, and an attenuation of
the Q component. Moving the balancing slider to the right will do the inverse.
Switching the I and Q from the signal can be done using the I and Q selector (labeled 7)4 .
Starting, pausing and termination The program will actually start after pressing the
”START” button (labeled ”34”). It will assume, however, a valid input being available and
selected, either through a stick-like device or - for a device where the data is coming through
a sound card - a selected soundcard channel.
Termination of the program is by pressing the ”QUIT” button, while pressing the ”PAUSE”
button (labeled ”5”) will cause the execution of the program being suspended. Pressing the
button for a second time will restart the execution.
Labeled by ”13” are some buttons for shorthand changes in the selected frequency:
• The buttons f- and f+ cause the frequency to be changed by the amount (in Khz) given
in the spinbox below these buttons, As can be expected, the f- decreases the frequency,
while f+ increases the frequency.
• The buttons fc- and fc+, when pressed, cause a timer to start changing the frequency
by the amount (in Khz) given in the spinbox below these buttons. Pressing the fc+
or fc- button a second time will increase the time between changes, i.e. decreasing the
frequency with which changes appear. The fc- and fc+ compensate each other: pressing
fc+ after fc- will stop the timer. The frequency range for this scanning is determined
by the spinboxes below the f- etc buttons. The setting as given in the picture, indicates
the frequency range is 86 Mhz to 108 Mhz, and the step is 100 Khz. Settings for these
spinboxes are recorded in the ”.ini” file.
Input can be dumped into a ”.wav” file by the ”inputDump” button (labeled ”10”), the
audio can be dumped into a ”.wav” file by the ”audioDump” button (labeled ”11”). An output
channel for the audio-out is selected by the selector labeled ”12”.
The three numbers in the LCD displays present resp. the rate of the output, the rate of
the FM processing and the rate of the input.
The combobox labeled ”8” allows making a choice between a spectrum display as shown in
the figure and a spectrum displayed as waterfall. The buttons labeled ”9” (”HF Freeze” and
”LF Freeze”), cause ”freezing” of the spectra in the respective displays.
Typical FM selections The bottom section of the GUI contains a number of sliders, selectors and displays supporting typical functions for the FM signal.
4
Note that some of the high speed devices will just deliver I/Q signals, where this option is not homoured.
5
Five variations of an fm decoding algorithm are implemented. Selection of the variants is
through the selector labeled ”1”. A name for the kind of decoder is displayed in the label to
the right of this selector.
One may choose stereo or mono decoding by the selector labeled ”5”. In case of stereo
decoding, the audio-output is either the full stereo signal, the left or the right channel, the
L+R signal or the L-R signal. This can be selected by the selector labeled ”6”. A good quality
indicator for a stereo signal is the quality of the L-R signal.
Selecting a value with selector ”7” will give one of a variety of components of the decoded
stereo signal. This selector is reminiscent to previous experiments.
The selector labeled ”8” allows selection of the de-emphasis, either nothing, 50 msec or 75
msec.
A lowpass filter is selected using the selector labeled ”9”, in the picture set to 12000 Hz.
Rds decoding may be switched on or off by the selector labeled ”4”. A choice can be made
between two different implementations of the Rds decoding algorithm.
An additional bandfilter5 for the signal can be selected by the selector labeled ”2”, the
spinbox labeled ”3” tells the degree of the (FIR) filter being used.
Values indicating the strength of the pilot signal and the Rds signal can be monitored by
setting the selector labeled ”10” to ”log on”. If set, some relevant values are shown on the
terminal. One may save these values by pressing button labeled ”11”, in which case a file
dialog will ask for a filename to store the data. Data is stored in plain Ascii.
Finally, the slider labeled ”12” is a balance slider between the left and right output channel.
3.2
Selecting devices: the extio/plugin selection
Under Windows, for many sdr devices an ”ExtioXXX.dll” file exists that can be used in
conjunction with the fm receiver.
5
The signal is already filtered during decimation
6
Just select, after pressing the ”extio” selector, an appropriate ExtioXXX.dll file. Control
of the device will be separate from the main GUI, although setting a frequency is possible
through the main GUI.
For linux, there are a few plugins predefined. For the mirics Dongle, the dabstick and the
sdrPlay, as well as for the pmSDR and the elad-s1.
3.3
The fm-mini
Most of the buttons on the GUI of the fm-mini can be found on the GUI of the regular fm
receiver as well. A brief description:
1. the start button, assumed is a selected input device;
2. the Quit button;
3. the selector for the output channel. Obviously depending on the soundcard;
4. the Pause button;
5. the decoder selector. Initial default is 4;
6. the Freq button. Pressing this button will pop up a keypad with which a frequency can
be selected in either KHz or MHz. Pressing the button for a second time will hide the
keypad;
7. the lower bound - in Mhz - for the auto increment and decrement functions;
8. the step size - in Khz - for the increment and decrement functions;
9. the upperbound - in Mhz - for the auto increment and decrement functions;
10. 1 KHz decrement;
11. single step decrement of the amount specified in ”8”.
12. auto decrement function. Decrementing will continue, with a step as given earlier, until
a signal of reasonable strengt is found6 .
13. auto increment function. Incrementing variant of previous function.
14. single step increment;
15. 1 KHz increment;
6
The precise level can be given in the ”.ini” file
7
16. rds selector;
17. stereo/mono selector;
18. output channel selector. See regular FM;
19. de-emphasis selector;
20. lowpass filter;
21. squelch button with next to it a slider setting the level.
3.4
The FM ini file
A (pretty large) number of settings will be stored in an ”.ini” file. This file will be read on start
of the program and the values will be written out on (normal) termination of the program.
The name and location of this file are $(HOME)/.jsdr-fm-dab.ini.
Most of the settings in the ”.ini” file follow from settings on the GUI of the FM receiver.
Few are only settable by editing the ini file:
• displaySize=512. displaySize gives the size of the displays in pixels. The higher, the
more detail, and more performance requirements. Its default is 512.
• averageCount=5. averageCount states the number of frames over which the spectrum
images will be averaged. The higher the value, the quieter the spectrum is.
• repeatRate=10. repeatRate gives the number of new spectrum images that will be generated per second.
• thresHold=20. When scanning, as soon as a signal with a strength of ”thresHold” is met
(where strength is relative to the average signals strength), scanning will stop
Note that the settings for the various devices used also will be stored in the ini file.
3.5
The fm-mini
The main difference between the fm receiver and the fm-mini - apart from the differences in
appearance - is that the number of choices with the mini is limited. The mini will only work
with a dabstick, an sdrPlay or an airspy is input device.
One important difference is that with the mini, the device to be used as SDR device is to
be selected on start-up.
The very first time the program is started one has to pass on a parameter
indicating which device is to be selected. This is done by adding the option -D
XXXX to the command line where the program is started, where XXX is either
”sdrplay”, ”dabstick” or ”airspy”
Note that the program will store the name of the selected device and will use it subsequently,
unless overruled by an option -D XXX on the command line.
The ”.ini” file for the fm-mini is ”.jsdr-fm-mini.ini”, it contains a subset of the settings of
the regular fm receiver. Note further that there is no option of changing the samplerate when
running. A samplerate, other than a well-chosen default, can be set in the ”.ini” file.
8
• dabstick: dabstickRate = XXX, where XXX in Khz and part of the list of supported
rates;
• airspy: airspyRate = XXX, where XXX is either 2500 or 10000;
• sdrplay: sdrplayRate = XXX, where XXX is in Khz and part of the list of supported
rates.
4
Building the executable under Linux
Unpacking the sources of the distribution is in a single directory sdr-j-fmreceiver-0.98 with as
subdirectories:
• src, where the sources of the fm-receiver proper are stored. Subdirectories here are
– fm, where the sources for the fm-handling proper are stored;
– rds, where the sources for the rds-handling are stored;
– scopes-qwt6, for the sources of the scopes;
– output, and
– various, where some remaining sources are stored.
• small-gui, where the GUI sources for the mini are stored. The directory contains a file
”sdr-j-fm-mini.pro”, that can be used to generate a Makefile. Furthermore, it contains a
CMake file to be used in conjunction with cmake.
• large-gui, where the GUI sources for the regular are stored. This directory further contains - next to directories with the sources for the ”hard-wired” devices - a directory
– plugins, where the sources for the plugins are stored. The plugins directory contains
a subdirectory input, which contains:
∗
∗
∗
∗
∗
dabstick,
pmsdr,
mirics-sdrplay,
mirics-dongle, which is unsupported software for the mirics dongle,
mirics-xxx, which contains sources for support of the mirics dongle, using the
library of Miroslav Sugden.
∗ fm-elad-s1, which contains the sources for a Linux plugin for the elad-s1.
The file sdr-j-fmreceiver-098.pro contains directives for the qmake program to create a
Make-file. For use with cmake, a CMakeList.txt file is included. Note that building the
plugins requires a similar building process in each of the required plugin directories.
9
Required packages and Libraries
One needs, next to the GNU compiler suite (g++),
• Qt-4.7 or Qt-4.8 (No effort has been made as yet to use Qt-5)
• Qwt 6.x.x. The sources, developed under Fedora, are based on Qwt 6.1.0. As it turns
out, the recently released Ubuntu 14.04 LTS supports Qwt 6.0.1. There is a slight incompatibility between 6.0.1 and 6.1.0 in that in two lines in scopes-qwt6/scopes.cpp (around
lines 130), the version 6.0.1 insists of using SetMinPen and SetMajPen, while 6.1.x
requires SetMinorPen and SetMajorPen. In recent discussions, it turned out that the
naming in 6.0.0 (used by Debian) is even different: setMajPen and setMinPen.
• libusb-1.0,
• libportaudio. Ubuntu 14.04 LTS still supports libportaudio-1.18, as standard package.
Replace this with 1.19, which is easily done using the standard package handler.
• libsndfile and libsamplerate,
• libfftw3f, we use, different from previous releases, floats rather than doubles and therefore
the libfftw3f,
Ubuntu
For Ubuntu a validity check is given in the shell script below
#!/bin/bash
#
echo "Preparing the environment for Ubuntu"
echo "ensure that the udev rules are adapted for the usb devices
echo " "
echo "install packages"
sudo apt-get install gcc g++ \
libqt4-dev libqwt6-qt4 libqwt6-qt4-dev \
libfftw3-3 libfftw3-dev \
alsa-base libasound2 libasound2-dev alsa-utils libasound2-plugins \
libportaudio2 libportaudio-dev \
libsndfile1 libsndfile1-dev \
libsamplerate0 libsamplerate0-dev \
libusb-1.0-0 libusb-1.0-0-dev
Note that Ubuntu repositories provide for a package librtlsdr, to be loaded if/when one wants
to use the DABstick.
Fedora
For Fedora, depending on the distribution, the following script might help
#!/bin/bash
#
echo "Preparing the environment for Fedora"
echo " "
echo "install packages"
10
sudo yum install gcc gcc-c++ \
qt qt-devel qwt qwt-devel \
fftw fftw-devel \
alsa-lib alsa-lib-devel alsa-tools portaudio portaudio-devel \
libsndfile libsndfile-devel libsamplerate libsamplerate-devel alsa-plugins-samplerate \
libusb1 libusb1-devel
Note that Fedora (at least recent versions) provide for a package librtlsdr in their repositories.
librtlsdr In most cases librtlsdr is indeed available and can be installed through the mechanisms available with the Linux distribution. In case the library is not available, a description
of the library and how to build it is to be found on the osmocom site
http://sdr.osmocom.org/trac/wiki/rtl-sdr
Note that, under Ubuntu 14.04 the kerneldriver dvb usb rtl28xxu needs to be put on the blacklist.
Mirics SDRplay Mirics Ltd provides on its site an installer for a downloadable shared
library, libmirsdrapi-rsp-x86 64-1.1.so. The library will be installed in /usr/local/lib.
Qmake Qmake will use the .pro file as basis. The sdr-j-fmreceiver-097.pro file contains thanks to contributors - lines that have shown to be working on Fedora, Ubuntu systems and
on freeBSD.
Other Linux distributions most likely will provide the full set of packages required for
building, probably on other locations, in which case the .pro file might need to be adapted to
the particularities of the different Linux distributions.
When all libraries (including the corresponding ”include” files) are in place, for use with
QMake, one executes
qmake-qt4
make
The qmake-qt4 will generate a Makefile, running make will generate an executable and put it
in linux-bin.
CMake A CMakeLists.txt file is included with which an executable can be generated. Obviously, the list of required packages does not change.
Building plugins The sources for the device handlers are stored in subdirectories of the
plugins directory. If/when building the fmreceiver itself was successful, all libraries are in place
and one could simply run create-for-linux, a file containing a script to build the device handlers.
These plugins will be stored in linux-bin/input-plugins
USB ports It might be wise to ensure rights for reading and writing usb port and soundcards before running the program. One may use the instructions given on the aforementioned
osmocom page, installation instructions for the Mirics dongle or SDR.
11
5
Final remarks
The SDR-J software uses a number of libraries, made available through (L)GPL style licenses
and parts of the code is based on ideas of others. In all cases attempts are made to indicate
the rightfull owner of the copyrights. The software itself is available as is, under a GPL V2
license.
The SDR-J software is essentially a hobby project. It is - obviously - not finished, after
all it is software and it is most likely that it will never be finished. Many enhancements (and
experiments) are still waiting to be done. Contributions in any form, e.g. by suggestions for
extensions, by contributing to code, or by donations for equipment are welcome.
12