Posted tagged ‘RTL-SDR’

Let’s Try RTL-SDR! – Part 1

July 26, 2012

Recently, I received a device that was originally marketed as a USB DAB/DVB/FM receiver, containing a chipset compatible with the utilities from the RTL-SDR project.

It cost £17.50 (roughly €22.42/2159円/US$27.45, according to WolframAlpha) including free shipping from the US.

What’s in the kit?

The receiver that I ordered was supplied with only a remote control, and a stubby antenna with a magnetic base. No CD-ROMs, or user manuals were included.

About the hardware

The eBay listing page claims that it contains an Elonics E4000 tuner IC, and a RealTek RTL2832U DVB-T demodulator IC.

lsusb -v Reports:


Bus 001 Device 002: ID 0bda:2838 Realtek Semiconductor Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0bda Realtek Semiconductor Corp.
idProduct 0x2838
bcdDevice 1.00
iManufacturer 1 Realtek
iProduct 2 RTL2838UHIDIR
iSerial 3 00000088
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 4 USB2.0-Bulk&Iso
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 5 Bulk-In, Interface
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 5 Bulk-In, Interface
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 2
Device Status: 0x0000
(Bus Powered)

view raw

gistfile1.txt

hosted with ❤ by GitHub

Installing RTL-SDR, and associated utilities

Download and run the build-gnuradio script, as recommended by Andrew Back:


tysonkey@ubuntu:~/SoftRadio$ wget http://www.sbrac.org/files/build-gnuradio
–2012-07-19 12:35:19– http://www.sbrac.org/files/build-gnuradio
Resolving http://www.sbrac.org… 174.142.32.20
Connecting to http://www.sbrac.org|174.142.32.20|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 29181 (28K) [text/plain]
Saving to: `build-gnuradio'
100%[======================================================================================================================================================>] 29,181 80.8K/s in 0.4s
2012-07-19 12:35:21 (80.8 KB/s) – `build-gnuradio' saved [29181/29181]
tysonkey@ubuntu:~/SoftRadio$ chmod +x build-gnuradio
tysonkey@ubuntu:~/SoftRadio$ ./build-gnuradio
This script will install Gnu Radio from current GIT sources
You will require Internet access from the computer on which this
script runs. You will also require SUDO access. You will require
approximately 500MB of free disk space to perform the build.
This script will, as a side-effect, remove any existing Gnu Radio
installation that was installed from your Linux distribution packages.
It must do this to prevent problems due to interference between
a linux-distribution-installed Gnu Radio/UHD and one installed from GIT source.
The whole process may take up to two hours to complete, depending on the
capabilities of your system.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
NOTE: if you run into problems while running this script, you can re-run it with
the –verbose option to produce lots of diagnostic output to help debug problems.
This script has been written to anticipate some of the more common problems one might
encounter building ANY large, complex software package. But it is not pefect, and
there are certainly some situations it could encounter that it cannot deal with
gracefully. Altering the system configuration from something reasonably standard,
removing parts of the filesystem, moving system libraries around arbitrarily, etc,
it likely cannot cope with. It is just a script. It isn't intuitive or artificially
intelligent. It tries to make life a little easier for you, but at the end of the day
if it runs into trouble, a certain amount of knowledge on your part about
system configuration and idiosyncrasies will inevitably be necessary.
Proceed?

view raw

gistfile1.txt

hosted with ❤ by GitHub

At this stage, the script will request elevated privileges, in order to search for prerequisite packages using the system package management utilities.

Since the disclaimer warns that the process may take a long time, I’d recommend obtaining one’s favourite beverage; ensuring that the PC used has a sufficient amount of free disk space, and is well-ventilated (if using a laptop), to prevent it from potentially overheating, and unexpectedly shutting down; and searching for something else to do in the meantime…

For some reason, the Checking for package python-gtk2 step seems to take an unusually long time on my laptop; and temporarily stopping the script yielded:


^CFailed to find just-installed command 'guile' after pre-requisite installation.
This very likely indicates that the pre-requisite installation failed
to install one or more critical pre-requisites for Gnu Radio/UHD

view raw

gistfile1.txt

hosted with ❤ by GitHub

It seems that despite my best efforts to prepare things in advance, I ran out of disk space at that stage:


Checking for library libusb …Found library libusb
Checking for library libboost …Found library libboost
Checking for library libcppunit …Found library libcppunit
Checking for library libguile …Found library libguile
Checking for library libfftw …Found library libfftw
Checking for library libgsl …Found library libgsl
Done
Fetching Gnu Radio via GIT…Could not find gnuradio/gnuradio-core after GIT checkout
GIT checkout of Gnu Radio failed!

view raw

gistfile1.txt

hosted with ❤ by GitHub

Eventually, I resorted to running apt-get clean && apt-get autoclean, and moving some large files to an external disk, in order to free 1.5GB of 9.4GB; and re-ran the script, with more successful results:


Starting function uhd_build at: Thu Jul 19 13:43:39 BST 2012
Building UHD…
Done building/installing UHD
Done function uhd_build at: Thu Jul 19 14:00:07 BST 2012
Starting function firmware at: Thu Jul 19 14:00:07 BST 2012
Downloading images from: http://files.ettus.com/binaries/master_images/archive/uhd-images_003.004.001-109-g6ca39ad9.zip
6.94 MB/6.94 MB (100.00%)
Images successfully installed to: /usr/local/share/uhd/images
Done downloading firmware to /usr/local/share/uhd/images
Done function firmware at: Thu Jul 19 14:00:19 BST 2012
Starting function gnuradio_build at: Thu Jul 19 14:00:19 BST 2012
/usr/local/lib already in ld.so.conf.d
Doing ldconfig…
Building Gnu Radio…
…Doing cmake
…Cmaking
…Building
Application asked to unregister timer 0x45000016 which is not registered in this thread. Fix application.
…Installing
Done building and installing Gnu Radio
GRC freedesktop icons install …Done
Done function gnuradio_build at: Thu Jul 19 14:41:05 BST 2012
Starting function rtl_build at: Thu Jul 19 14:41:05 BST 2012
Building rtl-sdr…
Done building/installing rtl-sdr/gr-osmosdr
Done function rtl_build at: Thu Jul 19 14:42:46 BST 2012
Starting function extras at: Thu Jul 19 14:42:46 BST 2012
Doing GIT checkout for extra module gr-baz
Building extra module gr-baz
Doing GIT checkout for extra module grextras
Building extra module grextras
Done function extras at: Thu Jul 19 14:51:02 BST 2012
Starting function mod_groups at: Thu Jul 19 14:51:02 BST 2012
********************************************************************************
This script has just modified /etc/group to place your userid '('$USER')' into group 'usrp'
In order for this change to take effect, you will need to log-out and log back
in again. You will not be able to access your USRP1 device until you do this.
If you wish to allow others on your system to use the USRP1 device, you will need to use:
sudo usermod -a -G usrp userid
For each userid you wish to allow access to the usrp
********************************************************************************
Further
Done function mod_groups at: Thu Jul 19 14:51:03 BST 2012
Starting function mod_udev at: Thu Jul 19 14:51:03 BST 2012
Done function mod_udev at: Thu Jul 19 14:51:03 BST 2012
Starting function mod_sysctl at: Thu Jul 19 14:51:03 BST 2012
Applying updates to /etc/sysctl.conf
Group 'usrp' now has real-time scheduling privileges
You will need to log-out and back in again for this to
take effect
Done function mod_sysctl at: Thu Jul 19 14:51:03 BST 2012
Starting function pythonpath at: Thu Jul 19 14:51:03 BST 2012
************************************************************
You should probably set your PYTHONPATH to:
/usr/local/lib/python2.7/dist-packages
Using:
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages
in your .bashrc or equivalent file prior to attempting to run
any Gnu Radio applications or Gnu Radio Companion.
*************************************************************
Done function pythonpath at: Thu Jul 19 14:51:04 BST 2012
Done all functions at: Thu Jul 19 14:51:04 BST 2012
All Done

view raw

gistfile1.txt

hosted with ❤ by GitHub

It seems that on a 64-bit Ubuntu installation, a full instance of the script’s working directory (containing all source code, and binaries) is about 520MB in size.

Notes on AirProbe installation

For readers wishing to install AirProbe using the instructions on the project’s Website, I recommend running sudo ln -s /usr/local/include/gruel/swig/gruel_common.i /usr/local/include/gnuradio/swig/ && ldconfig, after installing GNURadio, in order to avoid some frustrating bugs in various build scripts related to missing “Gruel”, and “SWIG”-related files.

Testing the result

Since this post is becoming rather long, and I’m unsatisfied with the content that I planned for this section, I’ll follow up with a second post related to testing the software post-installation, soon.