Rtl-sdr on Ubuntu

265,526

73

18

Intro: Rtl-sdr on Ubuntu

It was recently discovered that several cheap DVB-T usb dongles could be configured to be used as cheap ham radio receivers. 
Follow along with the discussions here: http://www.reddit.com/r/rtlsdr or find some of the useful software here: http://sdr.osmocom.org/trac/wiki/rtl-sdr

I
 picked up one of the compatible receivers from ali-express:
http://www.aliexpress.com/snapshot/106450763.html

and will document here the steps I took to set it up with gnuradio on ubuntu 12.04.

There are a few things that I won't cover in this instructable, because they deserve an instructable of their own. These include:

1) using the Ubuntu command line (terminal)
2) cloning a git repository
3) building software from source on Ubuntu (especially with cmake)

If anyone has links to stellar, class A++ quality tutorials on any of these things, please add them to the comment and I will link them here.

Step 1: Install Gnu-radio

It looks like there are two options for installing an up-to-date gnuradio on ubuntu:

1) use an install script
2) install from source

Don't ask me why, but I tried the second option (probably the harder). After a first attempt that failed, I went for the first (and recommended option) to much success! So... lesson learned. Note to self, follow advice of program developers when installing software.

My advice, use the install script. 

Step 2: Install Rtl-sdr Tools

Next, you want to install any missing rtl-sdr specific tools from here:
http://sdr.osmocom.org/trac/wiki/rtl-sdr

Again, rather than duplicating instructions, follow the steps outlined here to install the rtlsdr library & capture tool: git://git.osmocom.org/rtl-sdr.git

Although this page also mentions a gnu radio module (git://git.osmocom.org/gr-osmosdr) I was unable to get it to work. Instead, I installed:
https://github.com/balint256/gr-baz

as recommended from here: http://2h2o.tumblr.com/

the basic steps are:

git clone https://github.com/balint256/gr-baz
cd gr-baz
sh bootstrap
./configure
make
sudo make install
sudo ldconfig

Now you should have all the necessary software to communicate with the DVB-T dongle using gnuradio.

Step 3: Setup Udev Rules

Next, you need to add some udev rules to make the dongle available for the non-root users. First you want to find the vendor id and product id for your dongle.

The way I did this was to run:

lsusb

The last line was the Realtek dongle:
Bus 001 Device 008: ID 0bda:2838 Realtek Semiconductor Corp.

The important parts are "0bda" (the vendor id) and "2838" (the product id).

Create a new file as root named /etc/udev/rules.d/20.rtlsdr.rules that contains the following line:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

With the vendor and product ids for your particular dongle. This should make the dongle accessible to any user in the adm group. and add a /dev/rtl_sdr symlink when the dongle is attached.

It's probably a good idea to unplug the dongle, restart udev (sudo restart udev) and re-plug in the dongle at this point.

Step 4: Test It Out

Now, plug in the dongle and run the following command to test out rtl-sdr:

rtl_sdr capture.bin -s 1.8e6 -f 392e6

Ctrl-C the program after a second or so. If you saw no errors, you should see a file named capture.bin in your current directory. If the program complains about not being able to open the device, try sudo-ing the command. If that helps, the udev rules are probably incorrect.

If all is still going well, try out the attached rtl.grc gnu-radio graph by downloading it and opening it with:

gnuradio-companion ~/Downloads/rtl.grc

It is a modification of the graph from http://2h2o.tumblr.com/ to use a pulse audio (Ubuntu default) rather than an ALSA audio sink.

If you've reached this point with no errors, you are now as far as I am :)

Enjoy! and please add any resources you have on using gnuradio to the comments.

Share

Recommendations

  • Optics Contest

    Optics Contest
  • Plastics Contest

    Plastics Contest
  • Electronics Tips & Tricks Challenge

    Electronics Tips & Tricks Challenge

18 Discussions

0
None
aecs

2 months ago on Step 4


Good afternoon everyone.

I write here to see if any of you know that installation errors I may have had to use the r820t2 in gnu radio companion.

I'm trying to make an FM receiver and other analog TV receiver but when running the program does not receive any type of signal and the view errors, I have: devices not supported. I believe that this is some driver to be installed but I don't know where or how.

The steps that I have followed for installation (Ubuntu 16.04 LTS) have been:

  1. Install gnuradio.
  2. Install Xenial Xerius specifications (it is supposed to do I need for my version of Ubuntu).
  3. Install specifications of gr-osmosdr to enable some features of the chip.

The Stick comes with a CD but i do not know how to install it since, according to the specifications only works for WXP, 2000, Vista, 7 and 8; and it is something that it seems strange to me since I have seen videos where they use this same model of stick to carry out projects in Gnuradio on Ubuntu.

Please, if any of you know that i need to install It would serve as much help as I am a novice programmer and i need to resolve this problem for my project.

0
None
Neal W

1 year ago

Oh, now I have tried a lower case 'L' instead of an uppercase 'I'. Great! I'm referring to you saying run lsusb. Thanks.

0
None
Neal W

1 year ago

On my Raspberry Pi the terminal says,

.....Found 1 device(s):

0: , , SH: ???vI

Using device 0: Generic RTL2832U OEM

usb_open error -3

Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules

Failed to open rtl-sdr device 0#.

aplay: playback:2715: read error

0
None
AlexanderG140

1 year ago

hi, I followed your steps successfully until the last step. Unfortunately when open rtl.grc it says

Source - ?(0):
Port is not connected.
Sink - ?(0):
Port is not connected.

0
None
mulmer

2 years ago

As of Ubuntu xenial (16.04LTS) gnuradio has made it in to the APT repositories. This makes it a little easier to install in Ubuntu. Use the following command line: sudo apt-get install gnuradio

0
None
nehak22

2 years ago

While installing the GNU radio from the script it does not go ahead of "Done checking packages" message. what can I do about this?

0
None
doubledown66

3 years ago

There's a nice Ubuntu remaster called "Skywave Linux" with plug and play RTL-SDR support.

http://skywavelinux.com

It has some other apps as well, but CubicSDR runs right out of the box, and the dreaded kernel driver dvb_usb_rtl28xxu is blacklisted by default.

when i run the command sh bootstrap i get an error sh: 0: Can't open bootstrap. pls suggest me a solution?

0
None
Machine

6 years ago on Step 4

I'm new to SDR radio (Software Defined Radio) and have no idea what "RTL" is and have no idea what "gnuradio" is too.

OK, I went digging and found this:
http://en.wikipedia.org/wiki/GNU_Radio

Is RTL a reference to the Realtex USB DVB-T receiver?

3 replies
0
None
PayeroMachine

Reply 3 years ago on Step 4

Yes, that is the one. Is just a cheap receiver up to 2.1 GHz.

0
None
braingramMachine

Reply 6 years ago on Introduction

Correct!

It comes from the part name. See here:
http://sdr.osmocom.org/trac/wiki/rtl-sdr

0
None
Machinebraingram

Reply 6 years ago on Introduction

Thanks for that website, it is packed with information. I found a Realek DVB-T for only $20 and I've got the software now. Thanks for your assistance.

0
None
RolfV

5 years ago on Step 4

Great instruction I'we allmost made it,

I was able to come to step four in braingram's instruction and with success test out the rtl-sdr with “ rtl_sdr capture.bin -s 1.8e6 -f 392e6 “ . Continuing stresses my limited Linux capabilities.

The instruction is : “ If all is still going well, try out the attached rtl.grc gnu-radio graph by downloading it and opening it with: gnuradio-companion ~/Downloads/rtl.grc “

I have three problems:
1) Downloading. I can see the attachment (rtl.grc 9KB) but trying to copy/paste it into downloads gives no result.
2) Opening. I can open the attachment by clicking it but it opens as a text file.
3) Finding. Searched the file system but cannot find anything that resembles “gnu-radio-companion ~/Downloads/rtl.grc”.

Would greatly appreciate if someone knowledgeable could give me a friendly push in the right direction.

RolfV

0
None
surfersurfer

5 years ago on Step 2

On Ubuntu 12.10 64-bit, I get the error below, but gnuradio-core seems to be not available for 12.10.

Tips?



checking for GNURADIO_CORE... configure: error: Package requirements (gnuradio-core >= 3) were not met:

No package 'gnuradio-core' found

0
None
jago25_98

6 years ago on Step 4

Thanks for these instructions. The auto build script didn't work for me. I think I might have confused the git checkout with some other directories in the same dir.

I have to say, setting up sdrsharp (sdr#) on win32 was a lot easier, though it did involve copying over the rtl-sdr library as well.

Now I'm searching for a scanner than can go through all the frequencies automatically,
or an interface for linux as simple as sdr#, which I think might be linrad.

Note that ettus has binaries of just the gnuradio bit dev version and I think now those will support rtl-sdr too if you want to speed up the process.

0
None
dildozer

6 years ago on Introduction

If you need a real guide for setting this up... http://www.thepowerbase.com/2012/06/getting-started-with-rtl-sdr/

0
None
mrklaw

6 years ago on Introduction

Thanks for sharing this. I have been having the build-gnuradio script barf with the error "you do not appear to have the 'rtl-sdr' directory.

Do I just move on to step 2 of your instructions since that also appears to involve rtl-sdr tools?