RTL-SDR

From HFUnderground

(Difference between revisions)
Jump to: navigation, search
Line 62: Line 62:
Next I wrote a small program to open a connection to the rtl_tcp server, and grab all the received data, count the number of bytes per second, and display it once per second, as a quick and dirty test to see if everything was working OK. I got around 4M bytes per second, which is correctly for a 2 MHz sample rate (the data is 8 bit I/Q, so there are two bytes per sample).
Next I wrote a small program to open a connection to the rtl_tcp server, and grab all the received data, count the number of bytes per second, and display it once per second, as a quick and dirty test to see if everything was working OK. I got around 4M bytes per second, which is correctly for a 2 MHz sample rate (the data is 8 bit I/Q, so there are two bytes per sample).
 +
 +
== Building rtl-sdr on Ubuntu 12.10 64-bit ==
 +
 +
Really not all that much different from the Mac OS X procedure above. I used a fresh install of Ubuntu 12.10.
 +
 +
There's a few packages you'll need installed that probably are not already in a fresh Ubuntu install. So, run this:
 +
 +
<code>
 +
sudo apt-get install git cmake autoconf automake
 +
</code>

Revision as of 01:23, 17 January 2013

An inexpensive Software Defined Radio using the DVB-T dongles based on the Realtek RTL2832U.

Building rtl-sdr on Mac OS X

First I got the code from http://cgit.osmocom.org/cgit/rtl-sdr/

I followed the instructions from http://sdr.osmocom.org/trac/wiki/rtl-sdr

cd rtl-sdr/
autoreconf -i
./configure 
make
sudo make install
sudo ldconfig

The first problem was after ./configure, namely:

configure: error: Package requirements (libusb-1.0 >= 1.0) were not met

Turns out I had an ancient version of libusb.

sudo port install libusb
solved that. 

With the programs built, the next step was running rtl_test:

$ rtl_test -t
Found 1 device(s):
 0:  ezcap USB 2.0 DVB-T/DAB/FM dongle
Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6  
No E4000 tuner found, aborting.

So far so good.


Next I tried running rtl_fm, which lets you demodulate a FM signal. AM is supposedly also supported. I say supposedly because I could not get rtl_fm to work properly. It would run, and write demodulated sound data to a file, but playing it back always produced gibberish. Also, the files were way too large for the specified sample rate and length of time the program was running. The documentation for rtl_fm is sketchy. For example, the list of options includes:

[-s sample_rate (default: 24k)]

which naturally makes you suspect -s sets the sample rate. It does no such thing, it actually sets the IF bandwidth. Again, supposedly.

After several hours of trying to get rtl_fm to work properly, I threw in the towel, and moved on to rtl_tcp, which acts as a little TCP server, sending I/Q data to a connected client. I had much better luck here. Running the program produced the following:

$ ./rtl_tcp
Found 1 device(s).
Found Rafael Micro R820T tuner 
Using ezcap USB 2.0 DVB-T/DAB/FM dongle
Tuned to 100000000 Hz.
listening...
Use the device argument 'rtl_tcp=127.0.0.1:1234' in OsmoSDR (gr-osmosdr) source
to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...).

I then connected to it via telnet in another console window:

$ telnet 127.0.0 1234</code>

And the rtl_tcp server program responded with:

client accepted!

and proceeded to send I/Q data to my telnet session, which spewed it to the window. Mission accomplished.

Next I wrote a small program to open a connection to the rtl_tcp server, and grab all the received data, count the number of bytes per second, and display it once per second, as a quick and dirty test to see if everything was working OK. I got around 4M bytes per second, which is correctly for a 2 MHz sample rate (the data is 8 bit I/Q, so there are two bytes per sample).

Building rtl-sdr on Ubuntu 12.10 64-bit

Really not all that much different from the Mac OS X procedure above. I used a fresh install of Ubuntu 12.10.

There's a few packages you'll need installed that probably are not already in a fresh Ubuntu install. So, run this:

sudo apt-get install git cmake autoconf automake



This site is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Some links may be affiliate links. We may get paid if you buy something or take an action after clicking one of these.