Raspberry Pi as Remote Server for RTL2832u SDR

rtlservslide

Introduction
Note:
Since this project was posted it has been brought to our attention that RTL2832U / R820T sticks may not be fully supported in the RTL drivers used here. The RTL2832U / E4000 sticks work fine.

One of the often overlooked features of the RTL drivers for the RTL2832U SDR sticks is the TCP server. The TCP server allows you to send data from the RTL2832U stick across your home network to a remote PC running a program to process the data back into SDR information such as SDR Sharp. While the Raspberry Pi is not quite powerful enough to run current programs to decode and process the SDR data from the RTL2832U stick, it can do a very good job of running the rtl_tcp server. This means that you can plug the RTL2832U stick directly into the Raspberry Pi and wind up with a very small and portable SDR radio server. You can either plug the Raspberry Pi directly to your router or use Wifi for more flexibility in placement. If you decide to go the wifi route, I would suggest you use wireless N since bandwidth can be an issue. You can use either a WiFi dongle on the Raspberry Pi’s USB port or a WiFi gateway interface. The nice thing about the WiFi gateway is that it needs no drivers to connect to the Raspberry Pi since it converts WiFi date to ethernet. If you decide to go the dongle route, be sure to do a little research on what dongles work well on the Pi.

Demonstration Video

Why would you want to do this?

 There are several reasons you might want to do this. Here are a few:

1. One of the biggest reasons would be to cut down on the amount of antenna cable you have to use. The less cable you use the less signal loss you will have. The Raspberry Pi  and rtl_tcp combination will let you mount the RTL2832U closer to your antenna connection point. Let’s say  for example that your antenna is mounted in the attic, but your monitoring station is downstairs. Rather than run 150 feet of cable to the monitoring station, mount the RTL2832U and the Raspberry Pi close to the antenna and use WiFi to send the SDR data downstairs.

2. Set up the Raspberry Pi / RTL2832U SDR server in one location and use your laptop running SDR Sharp to monitor your RTL-2832U SDR radio anywhere in the house.

3. Make  the Raspberry Pi / RTL2832U server  accessible from outside of your home network and listen to your SDR radio while you travel.

4. Set up a remote monitoring location in another part of the country.

5. Mount the whole thing in a weatherproof enclosure powered by solar cells and put it at the top of your antenna tower.

6. Tie it all to a helium balloon and have a 500ft antenna.

I am sure you could think of other uses for such a small portable SDR server.

Geting it Going

1. Install the latest Debian release on your Pi and update it.
2. Before you install the RTL drivers, you will have to install the following dependencies if they are not already installed by typing the following commands in terminal window at the prompt.

sudo apt-get install git 
sudo apt-get install cmake
sudo apt-get install libusb-1.0-0.dev
sudo apt-get install build-essential

3. Now we are ready to install the RTL drivers using the following commands:

git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../
make
sudo make install
sudo ldconfig

4. Before this will work you will need to locate your RTL directory using the file manger where the drivers where downloaded and copy the rules file into  the etc/udev/rules.d directory.
5. Plug in the RTL-2832U stick and issue the rtl_test -t command to make sure the Raspberry Pi sees your stick.
6. Be sure that port 1234 is open on your router
7. To start the rtl server type rtl_tcp -a  plus the ip address of your Pi. For example rtl_tcp -a 10.0.1.50
8. On your PC download the latest Dev version and configure it according to these instructions. Go to the interface section and and select RTL TCP and enter the IP address of your Raspberry Pi. Start SDR Sharp processing and it should be getting the data form the Pi and the RTL2832U.
9. You can now remove unnecessary peripherals like keyboard, monitor, and mouse.

Potential Problems

I have noticed that the server will stop working under the following circumstances, there may be more but these have been fairly consistent.

  1. If you exit SDR Sharp without stopping it’s processing of the remote data from the server.
  2. If the bandwidth gets to narrow to handle the data properly. This can be more of a problem with WiFi as the distance gets further between the Raspberry Pi and the router. A work around is to lower the sample rate on SDR Sharp.
  3. Tuning to an unsupported frequency area of your RTL-2832U stick.

For these reasons, if you are going to run the SDR server headless or locate the Raspberry Pi in an area where it cannot be accessed easily, you will need to get SSH going on the Pi and install Putty on your PC. By default SSH is usually already active on the Pi. Just install Putty on your PC and open a session using the IP address of your Pi. The default user name is usually Pi and the password is Raspberry. This will allow you to access the Raspberry Pi remotely to start the SDR server.

Discuss in our Forum

60 Responses to Raspberry Pi as Remote Server for RTL2832u SDR

  1. Richard says:

    Hi thanks for you work writing this up. I went through the installation steps using the Debian Wheezy build after upgrading but I have a problem. rtl_test detects the device then reports it cannot be opened. In my distro I did not have a “etc/dev/rules.d” folder so created it and copied the rules file into it, do I need to chmod the rights on the folder of file, I did sudo su before creating the folder?

  2. Risto says:

    Hi,
    Thank You for the very easy and straight forward instructions! It worked right away! tested only with wired ethernet and no lockups!
    /Risto

  3. Greg says:

    Works great on my 256mb PI and allows a full bandwidth transfer of the usb stick to sdr#.

    • Yo9hzn says:

      Can you tell us what kind of usb stick you use? Especialy if it use E4000 or R820T on tuner… I am about to buy one and i’m not sure which one would be better (offcourse, to work with my 256M RaspberryPi). Thanks!

      • HRS Staff says:

        I used the E4000 chipset. There appears to be some issues right now getting the R820T working on the Pi.

  4. Roman says:

    Hi! I am trying this using an R820T tuner. Using the rtl_test, rpi successfully recognizes the device as well as the tuner, however it gives out this error:
    rtlsdr_demod_write_reg failed with -1
    rtlsdr_demod_read_reg failed with -1
    rtlsdr_demod_write_reg failed with -1.

    Any insights on this? Help would be very much appreciated, thanks!

  5. SV5BYR Mike says:

    Hello, and thanks for tutorial…
    I manage to runmy Raspi and 2832/E4000 but trying the RTL 2832 / R820t i get the message:

    pi@raspberrypi ~ $ rtl_tcp -a 192.168.178.60 -p 1234
    Found 1 device(s).
    usb_open error -3
    Failed to open rtlsdr device #0.

    Any idea ???

    Tnx in advance and keep the nice work.

    SV5BYR Mike
    Rhodes island Greece.

    • HRS Staff says:

      There is an issue with the RTL820T working correctly. Even though the R820T driver looks to be available, it looks like that the R820T is missing from the provided Rules file. That will cause the stick not to be found. Maybe, someone will come up with the proper rule entry for the R820T

    • Roman says:

      I found the solution to the problem. The issue is not with the Rules file. The issue is power. A standard 5V-1A power source seem to be insufficient to power up rpi as well as the dongle. To solve this, I used an external powered usb hub. This solved the problem! Hope this solves yours too!

      • Ben says:

        Hi, I did run into the same error messages on my Pi and my solution was to “wirebridge” the SMD fuses on the board at the output USB ports. At a current of 200 mAmps they have a drop of about 300 mV which makes the power voltage to low for the dongles.

    • HRS Staff says:

      Thanks for the info Roman, I will have to give that a try!

  6. aerostar says:

    Re e4000 and R820
    I would say that there is a problem with the driver(s), I have tried using a 2 different powered hubs (3amp PSUs) for 820 and the dongle still is not fully recognised, it recognises the RTL chip and then says E400 not found, (does the sam even when not using powered hub) plus at one time using a hub I received the rtlsdr_demod_write_reg failed with -1
    message for the E4000.

    Using the dongles in PCs (various) no problem. On the PI I have bridged out the USB and power current limiting resistors so that full current can be applied (this has now been done on the new PI boards at manufacture)

    It would be nice to get the 820 running as that is more sensitive than the E4000 chip

    • Anonymous says:

      Yes, the rtl_test says that e4000 tuner is not found, however, you could now run rtl_fm and rtl_tcp successfully after using an external powered hub. or at least that is happening in my case.

  7. Andre says:

    You state that the “Raspberry Pi is not quite powerful enough to run current programs to decode and process the SDR data from the RTL2832U stick”. What are the limitations that you are seeing that would need to be improved on (memory, processor speed, etc)?

    • HRS Editor says:

      All the ones you listed, but mainly CPU resources with the current SDR software available. I suspect someone might come up with a light weight SDR program for it eventually. The Pi will run some SDR type programs now with some tweaking, but usually only for a dedicated application like ADS-B.

  8. Ken says:

    Hi, Works great with ezCap.

    How do I start rtl_tcp as a service, this so it autostart and I don’t need to have my terminal window open all the time..?

    Thanks!

  9. Yo9hzn says:

    Works perfect!
    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=192.168.1.101:1234′ in OsmoSDR (gr-osmosdr) source
    to receive samples in GRC and control rtl_tcp parameters (frequency, gain, …).

  10. Chris says:

    Hello

    I have problems with step 4. Maybe you can explain how I can get the rules into rules.d.

    • HRS Staff says:

      Hi Chris,

      As step 4 says, you pretty much have to locate where you installed the original RTL driver folder on your Pi. In that folder should be a file labeled rules. You need to copy and paste that file into the etc/udev/rules.d directory on your Pi. It should work fine if your are using the recommended Wheezy version of Linux for your Pi.

  11. earwig says:

    Hi all, Im new to sdr and would like to have a go @ HF sdr using rasperry pi as server.Can anyone please tell me if R820t is supported by RPI os or am i best to go e4000/fcxxxx etc ? So many sticks !

  12. Santi says:

    Very good tutorial. I have a RTL2832U/FC0013, Conceptronic C08-096(CTVDIGUSB2) and it works perfect with my Raspberry Pi. Thanks!

  13. MarkB says:

    I finally got mine up and running. Works fine at home on the local network, but when I try to access from a location outside the home network, the audio is very choppy. Away from home, I’m using Putty to start the Pi. I enter rtl_tcp -a 192.168.x.xxx and it starts fine.

    I then go to SDR# and input my external ip addy in along with the port number, which has been forwarded and I get the choppy audio. This is with the sample rate in SDR# set all the way down to 0.25 MSPS.
    I tried different sample rates in rtl_tcp and not much change.
    Any ideas?
    Thanks!

  14. Arie says:

    You can start rtl sdr with the & on the end on the command:
    sudo rtl_tcp -a 192.168.1.101 &

    When you shutdown your ssh de server keeps running, so you don’t use bandwith of for ssh.
    Gr. Arie

  15. Mike Simpson says:

    Many thanks for the tutorial, but I have had no luck in getting the cmake ../ command to work. I am new to Linux and would appreciate any help.

    On entering cmake ../ I get the following response
    – Build tpe not specified: defaulting to release.
    – Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON
    etc.
    I copied the rules as specified into the rules.d directory.

    Thanks – Mike

  16. Vincent says:

    If used remotely by lets say an internet connection, how high should the upload speed be to have a good stream ?
    has anyone tried this ?

  17. kf7vop says:

    How can I make rtl_tcp run automatically at boot?

  18. matt says:

    Hi,

    i just tried to setup the sdr server. But i got the message “Failed to open rtlsdr device #0″. The power supplys maximum current is 3A, so this should be enough. The Noxon DAB stick is pulged into the powered USB hub.

    Any ideas?

    Thanks.

  19. Richard Matthews says:

    Great article! I have been using the tuner stick directly connected to my laptop but I will have a go at using the SDR tuning system connected to my Raspberry Pi and connecting it to my home network. Is it also possible to use the USB dongle as a DAB tuner so you can have a network based DAB radio?

  20. Nicola says:

    Hi,

    I using two DVB-T devices and this running.
    Device #0 on port 1234 and device #1 on port 1235.
    In SDRsharp can i change the dongle with port change.
    If i open SDRsharp twice it running to, but i stopping one crashes service on the Raspberry Pi.
    The kill command takes no effect i must restart the Raspberry.
    I want plug more DVB-T devices in future.
    Have any idea for simultan use, if do not crash the service?

  21. Elvis says:

    I used my old 12w iPad 2 power adapter for my RPi, a NooElec TV28T v2 RTL2832U amp; R820T Tuner, and SDRSharp running on a Windows VirtualBox Guest on my Mac OS X machine. Works awesome! Now I just need to figure out what all the controls are for. I’ll have to ask some on my licensed HAM friends.

  22. Seaton says:

    *** Warning – do not update Raspberry Pi ‘Firmware’ ***

    Great project, and I’ve been using this for the last 9 months with no problems, but I just made the mistake of updating the ‘Firmware’ on the Raspberry Pi. The new ‘Firmware’ includes DVB drivers and subsequently takes over the DVB stick, causing this server to fail. I presume this would be the case with any future (post 25/9/13 Raspian image) install as well. Luckily I had a backup image which has got my setup working again, but I think a solution is needed to block the DVB drivers in the new ‘Firmware’. I know a bit about Linux, but not quite enough yet to remove the new unwanted drivers – any suggestions welcome.

    • Seaton says:

      Having just run an update/upgrade/dist-upgrade on my raspberry pi this problem has re-occurred. I therefore decided to fix the problem for good by finding a way to block the new DVB drivers from conflicting with the SDR driver.
      My solution which fixed the problem:

      Add the following lines to the file ‘/etc/modprobe.d/raspi-blacklist.conf’ and then reboot.

      # blacklist the DVB drivers to avoid conflict with the SDR driver
      blacklist dvb_usb_rtl28xxu
      blacklist rtl2830
      blacklist dvb_usb_v2
      blacklist dvb_core

      This should remove the conflict as it has done in my case.

  23. Jelmer(PD4VOS) says:

    Thanks for this tutorial! It worked fine for me.
    I used Raspberry PI B and Raspberian OS.
    the only thing what didn’t work for me was copying the rules file. This was because I didn’t have Root access.
    I Enabled the root account and then log in as root user to copy the file to the rule folder.
    Then everything worked fine for me! Thanks again for this good tutorial!

    73′

  24. kevin says:

    Hi,
    I have a strange prob.
    everythings works,but only if i use a low sample rate on SDR Sharp. If i go higher than 4200 my watherfall starts to hang and audio allsow.
    Pi and pc are connacten trouh an 1 Gbit cabled network.

    Annyone an solutions for this prob?
    Grz Kevin.

  25. Andrea says:

    Hi all.

    I’m waiting my hardware to setup my sdr server in a second house… Do you think 1.5 Mbps upload is enought to transmit packets to the client over the big internet?

    Thanks

  26. PD2TAZ says:

    I didnt get copied the file .rules to the dir.
    i needed the following command:
    cd ~
    sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
    sudo reboot
    Grx RL PD2TAZ

  27. ted says:

    I have gone through all of the installation steps. I am this point:

    4. Before this will work you will need to locate your RTL directory using the file manger where the drivers where downloaded and copy the rules file into the etc/udev/rules.d directory.

    I have found the rules file and I am trying to copy it to the target directory speciafied in the instructions. Each time I try I receive a “permission denied” message.

    Does anyone have a viable workaround procedure or solution? Has anyone encountered the same problem. I am so close, but I cannot get over the last hurdle.

    • Michal says:

      I guess you must have root rights to write to that directory. Just check it by ls -l /etc/udev/rules.d so you can see your rights and act accordingly. Either by using sudo/su command or by changing your privileges.

  28. Alan S says:

    This went well except for one thing, I got an error:

    With the new Dongles and updated raspberry OS you mite get an error like this.
    Found 1 device(s):
    0: Generic RTL2832U OEM
    Using device 0: Generic RTL2832U OEM
    Kernel driver is active, or device is claimed by second instance of librtlsdr.
    In the first case, please either detach or blacklist the kernel module
    (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.
    usb_claim_interface error -6
    Failed to open rtlsdr device #0.

    If you did get this error then edit add the following blacklist text to solve the problem.

    Edit the following file /etc/modprobe.d/raspi-blacklist.conf

    use your favourite editor like nano or vi

    sudo vi /etc/modprobe.d/raspi-blacklist.conf

    add the following lines in the file.

    blacklist dvb_usb_rtl28xxu
    blacklist rtl2832
    blacklist rtl2830

  29. Tim Colley says:

    Just a heads up guys.

    If you have permission issues after copying the rules file, you’ll need to change the ownership of the file by typing

    sudo chown root /etc/udev/rules.d/rtl_sdr.rules

    Just in case you get any permission errors like I did.

  30. Tim Colley says:

    Sorry about the duplicates. Your Mobile page doesn’t seem to like chrome for android

  31. Ivan says:

    I am trying this out and am getting the following result from

    rtl_test -t

    root@PI-51:~/rtl-sdr/build# rtl_test -t
    Found 1 device(s):
    0: Realtek, RTL2838UHIDIR, SN: 00000001

    Using device 0: Generic RTL2832U OEM
    Found Rafael Micro R820T tuner
    r82xx_write: i2c wr failed=-9 reg=0c len=1
    r82xx_init: failed=-9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    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
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    WARNING: Failed to set sample rate.
    No E4000 tuner found, aborting.
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_demod_write_reg failed with -9
    rtlsdr_demod_read_reg failed with -9
    rtlsdr_write_reg failed with -9
    root@PI-51:~/rtl-sdr/build#

    Has someone come across this or can somone explin me whta is going wrong?

    • Seaton says:

      Ivan

      For my working R820T device I get the following:

      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.

      Your device seems to fail at the line:
      r82xx_write: i2c wr failed=-9 reg=0c len=1

      which seems to imply the USB dongle’s i2c communication is failing to read or write to certain registers. I think that the dongle you are using may not be compatible with this project, but that is only a guess.

      Does the dongle work when directly connected to a PC when using the SDR driver which can be downloaded with SDR# etc?

    • Tim Colley says:

      Yes. Remove the -t from the command. This specifies an e4000 tuner which you don’t have.

  32. Ivan says:

    Thanks, this was very helpfull, now I don’t get the I2C error any more. I do get some lost bytes. You suggest to lower the sampling speed, which makes sense.
    Question # 1: How do we configure the sampling speed?
    Question # 2: Where are the executables located? When I try to run rtl-tcp, all I get is command not found.

  33. Tim_L says:

    Thanks!!!

    10 min after reading your article :

    pi@raspberrypi ~ $ rtl_test -t
    Found 1 device(s):
    0: Realtek, DVB-T Dongle, SN: 00000991

    Using device 0: Dexatek DK DVB-T Dongle (Logilink VG0002A)
    Found Fitipower FC0013 tuner
    Supported gain values (23): -9.9 -7.3 -6.5 -6.3 -6.0 -5.8 -5.4 5.8 6.1 6.3 6.5 6.7 6.8 7.0 7.1 17.9 18.1 18.2 18.4 18.6 18.8 19.1 19.7
    Sampling at 2048000 S/s.
    No E4000 tuner found, aborting.
    pi@raspberrypi ~ $ rtl_tcp -a 192.168.0.254
    Found 1 device(s):
    0: Realtek, DVB-T Dongle, SN: 00000991

    Using device 0: Dexatek DK DVB-T Dongle (Logilink VG0002A)
    Found Fitipower FC0013 tuner
    Tuned to 100000000 Hz.
    listening…
    Use the device argument ‘rtl_tcp=192.168.0.254:1234′ in OsmoSDR (gr-osmosdr) source
    to receive samples in GRC and control rtl_tcp parameters (frequency, gain, …).
    client accepted!
    set sample rate 2048000
    set freq correction 0
    set freq 100000000
    set agc mode 0
    set gain mode 1
    set tuner gain by index 0
    set freq 100900000
    set tuner gain by index 5
    set tuner gain by index 10
    set tuner gain by index 15
    set tuner gain by index 20
    set tuner gain by index 23
    set gain mode 0

  34. John says:

    When i run rtl_test -t this is what i get ?

    usb_claim_interface error -6
    Failed to open rtlsdr device #0.

    The Dongle i am using is a RTL2832U/R820T type so maybe i need a particular driver for this device ?

    • Tim Colley says:

      Not 100 percent sure but it sounds like your device has been locked by some other software. Check your device drivers and make sure there are no dvr software’s like xbmc running in the background.

      • John says:

        I did a fresh install of Wheezy Raspian dated 20th June 2014 (which is meant to have drivers for the RTL2832U/R820T included) and followed the above to the letter and am using a powered external USB hub.

        # Found 1 device(s):
        0: Generic, RTL2832U, SN: 7777************

        Using device 0: Generic RTL2832U

        Kernel driver is active, or device is claimed by second instance of librtlsdr.
        In the first case, please either detach or blacklist the kernel module
        (dvb_usb_rtl28xxu), or enable automatic detaching at compile time.

        usb_claim_interface error -6
        Failed to open rtlsdr device #0.

      • Tim Colley says:

        Ok. If you haven’t already done so. Scroll back up the comments here and follow the instructions for blacklisting the built in drivers. Also remove the -t switch. You don’t have an ES4000 tuner. This should solve the problem :-D

  35. John says:

    All sorted apart from getting SDR# to store the ip address of my Pi on the home network, the error i am getting there when i type in the ip close the box and hit the play button is “No connection could be made because the target machine actively refused it” ?
    I opened port 1234 on my router and assigned it to the Raspberry Pi ip address so what am i doing wrong now ?

  36. Andyj says:

    John. I’m another blind man about to tell you what I feel is standing in the room.

    Your target machine is blocking port 1234?
    Or it’s internal IP address is wrong.
    Or maybe you are not running a program that is listening to port 1234?
    Running a firewall?

    I’m happy to be wrong here but this is where I would look.
    If all fails, try port 80 (both sides).

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>