Stream RTL-SDR IQ data over a network using a Raspberry Pi & RTL_TCP

Stream RTL-SDR IQ data over a network using a Raspberry Pi & RTL_TCP

Over the weekend I had some time to try and see if I could get the cheap DVB-T usb dongle to work as a remote SDR using the Raspberry Pi as the server, using the tools from RTL-SDR it really isn’t that hard. On the Raspberry Pi I was using the latest version of Raspbain and also had turbo mode switched on.

Installing RTL SDR Software

You’ll need to install git which is simple “sudo apt-get install git” then clone the source code repo using the information from the RTL-SDR website. Before building RTL-SDR you need to install a few packages to make it work by doing “sudo apt-get install cmake, pkg-config, libusb-1.0″ then follow the build steps

  • cd rtl-sdr/
  • mkdir build
  • cd build
  • cmake ../ -DINSTALL_UDEV_RULES=ON
  • make
  • sudo make install
  • sudo ldconfig
Example of command line output seen from RTL_TCP

Once its completed and you’ve restarted the Raspberry Pi if you do “rtl_tcp -a 192.168.1.88″ the IP address should be the one assigned to your Raspberry Pi so you’ll probably need to change it!  as long as you get no errors your now ready to connect to the RTL_TCP server from another application I’m going to use SDR# but they are other applications available for Linux.

SDR# is easy to use I’d recommend you download the nightly build as it has all the latest features, then its just a matter of selecting RTL-SDR / TCP and filling out the IP information to match the Raspberry Pi and clicking Play! you can now use SDR# normally.

Screenshot of the FM Broadcast band using SDR Sharp

SDR# Screenshot

Between my Desktop and Laptop I’ve been listening a lot to broadcast FM (mostly Radio 1) and Airband for Oxford London Airport and Heathrow without any issues whats so ever.

Raspberry Pi with a RTL SDR usb stick connected

Raspberry Pi with a RTL SDR usb stick connected

47 Comments

  1. How does the audio get into the RPi

    Reply
    • DVB-T into the Pi, Then streamed across using TCP to a suitable application raspberry pi which plays the audio aka SDR#

      Reply
      • hi! we build a new wiki on our noncommercial site for rtl-sdr. would it be ok for you that we use your manual about in our wiki ?

        Reply
        • Feel free to use it Mike

          Reply
          • ok, many thx !!

  2. Nice, did you also try this with a FUNcube dongle?

    Reply
    • I haven’t yet but I believe it should work OK.

      Reply
      • Hi Peter

        It would be interesting to know if you have a FunCube Dongle and can make it work with the R-Pi. I have tried and qthid-fcd-controller 3.1.6 crashes with the dongle plugged in. It works OK with Xubuntu on a PC, but doing an strace on the R-Pi shows a segmentation error on a call:
        clock_gettime(CLOCK_MONOTONIC, {3311, 222529764}) = 0
        — SIGSEGV (Segmentation fault) @ 0 (0) —
        +++ killed by SIGSEGV +++
        Various requests to the FunCube Dongle group have not found an answer to this yet.
        I guess the code needs changing to avoid this call which might be compromised because the R-Pi doesnt have an RTC.
        ps was at you talk at the RSGB symposium yesterday on the floor at the front asking you about backups!

        Tony

        Reply
  3. Hi
    New to Linux but following your instructions to see if I can get this working..

    I’ve got as far as cd build but when I enter
    “cmake ../ -DINSTALL_UDEV_RULES=ON”
    I get bash: cmake: command not found..

    Have I missed something obvious?

    Philip

    Reply
    • Did you run the command

      sudo apt-get install cmake, pkg-config, libusb1.0

      as its moaning that cmake isn’t installed.

      Reply
      • Hi
        Yes I did but looking back through the process, that command failed with errors…
        Will start again and see what happens…
        Total newb with all this…

        Thanks
        Philip

        Reply
        • No problem Philip, what sort of errors you getting? will try help best I can.

          Reply
          • Hi
            I’m going to start again tomorrow with a new Raspbien image incase I broke something..
            Would love to get this working but I’m a million miles out of my comfort zone…

            I’ll shout if it goes wrong again and many thanks

            Philip

          • Always a good thing todo Philip, shout if you do need some help though.

          • Not had chance to start again today but before I do, can I just double check with you a couple of things..
            I presume I’m good to go with the latest Raspbien image and don’t need any other software than that pointed to on your site…

            Also, do I need to have the RTL dongle plugged in during the install?
            I didn’t have it plugged in yesterday…

            Any other gotchas you can think of…

            Fingers crossed

            Philip G4JVF

          • Shouldn’t need anything else installed bar what I said on the post, would recommend not having the RTL plugged in till you’ve finished everything.

  4. Nice is there an image somewhere with evertthing already set up?
    Mike

    Reply
    • Mike, I do have a img I just need somewhere to put a 8GB file :)

      Reply
      • Seeding a torrent of this should be appreciated!

        Reply
  5. Hi
    Finaly got it going and thanks for your instructions and patience..

    I was getting some install problems whilst using the GUI after Startx but went through the procedure again from just the startup command prompt and all went like clock work..

    Always a problem when you don’t know what your doing but got there in the end..

    Philip G4JVF

    Reply
    • Philip,

      Excellent, pleased you got it working have fun playing :)

      Peter

      Reply
  6. Excellent tutorial. I just follows the step from a remote shell. I can not wait to connect my new dongle..
    Thank you for the guide.

    Reply
    • Thanks Enrico, pleased you found the guide useful!

      Reply
  7. Hi Pete, Got a R-Pi for Christmas, now looking for an application – probably radio oriented.
    Hope you’re well.
    73
    Ken M1SLH
    HNY

    Reply
    • They are great for radio, let me know if you need any help.

      Reply
  8. Hello, and thanks for tutorial…
    I manage to run my 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.

    Reply
    • Same here, it works on the PC no problem, with Zadigs driver, sdr# adsb#, virtual radar etc. I am at ease with anything windows, but linux is new to me.
      G6HOQ – Steve

      Reply
  9. Where do you get the DVB-T dongles and which one would you recommend?

    Reply
    • Bought mine from ebay

      Reply
  10. Hi Pete,

    At the risk of asking a silly question, any chance you think I might be able to use your install procedure to use my RPi with my Ensemble RXTX SDR? I do not have a DVB-T usb dongle. I have the Ensemble and a Soundblaster MP3 external sound card. Might I somehow adapt SDR# to speak to the Ensemble? Thoughts?

    Thanks for a great post and thread. Very helpful.

    73. de KK7PW

    Reply
  11. If you are looking for 8GB worth of WEB space, if you contact me I can provide you with an account to upload to and I’ll give you the URL to publicise where the image can be down loaded from on one of our high speed WEB servers.
    You’ll find an email address if you look my call sign up on QRZ.COM.

    I would love to give this a try on my Pi, but I’m far from a Linux expert and the idea of an image of your already setup and working SD card would help me (and I am sure others too) enormously!

    Regards,
    Keith
    G4MSF

    Reply
    • Hi Keith,

      Thanks for the offer. Since writing the blog post I bought online another server for work that can cope with the SD images, I’ve just been lacking time to actually sort it out! I’ll try to get it done over the weekend if possible, I might be able to redo them on the standard 2gb iso which would make downloading a lot quicker.

      Pete.

      Reply
  12. libusb1.0 should be libusb-1.0 ;( Nevertheless thank you for your work. :)

    Reply
    • Thanks Adjusted.

      Reply
  13. Peter, thanks for your instructions on using Rpi as an RTL_TCP webserver. Works great over home network but I cannot get it to work over public network.

    Error is “unable to connect”. I have opened ports through the router and the Windows Firewall but to now avail.
    Anybody has any suggestion what to look for, or maybe step by step steps? I use a static IP address. thanks Jan

    Reply
    • Jan, interesting my only guess is that its networking related with the router but there should be no reason for it not to work.

      Reply
    • Hello Jan,

      If you have a network address translation from outside to inside configured, this is going to work. You should keep in mind that you need an internet bandwidth of 40Mb upload and if you want to use the full 2Mb sample rate.

      NAT on router (from out to in):

      source – dest :port – source – dest :port

      A ssh tunnel wil also work, so if you have a ssh connection to you internal network you can configure a ssh tunnel to connect to the rtl_tcp session. But again, do you have enough upload bandwidth.

      73 Jan PE0SAT

      Reply
  14. Have you considered adding a Ham It Up v1.0 – RF Upconverter for HF bands? Also, that add-on will reverse the process and convert an input between 100-150MHz to a HF signal for a transmit side on HF – perhaps the making of a HF/VHF/UHF transceiver? Not sure what Linux app could manage it.

    Reply
    • Hi David,

      No I haven’t main reason being that I’ve the Funcube Dongle Pro Plus that includes HF, so never really required the function.

      Peter.

      Reply
  15. Peter, Jan, Thanks for your advice… Have done some more experimenting but still unable to connect tio RPI via Internet. I have set samplerate to 128000 bps which my 10mbps ethernet connection should be able to support. The message I am getting is “No connection could be made because the Target Machine actively refused this ip 78.105.12x.xx:1234
    I have disabled the firewall on the router and reset the router. There should be no blocking o whatsover but no luck
    Earlier on I configured port 1234 to port 1234 on LAN. SSH over the internet to RPI works fine.
    RTL_TCP -a is set to my static IP address. RCP
    Netstat on RPI shows that no connection to port 1234 on RPI. SDR# is set to my static IP address as well.. bit of a mystery… Are there any firewalls in the RPI that could block traffic?
    Thanks for advice

    Reply
  16. Hi there,

    i am a Linux Newbee and looking for a solution that makes rtl_tcp starts automatic when the Raspberry is starting up.
    Any ideas ?

    Reply
  17. Successfully installed everything and my RasPi started receiving with the USB SDR.
    Note: Before you do anything remember to sudo apt-get update.
    My install for git failed because I didnt do the above step.
    I also found that cmake, pkg-config, libusb1.0 worked best by doing separate installs.
    I connected to my RasPi through my local network with my Samsung GII with SDR Touch installed and worked brilliantly.
    Thanks for the great How-To.

    Reply
  18. For the records – to those who might encounter problems “Kernel driver is active, or device is claimed by second instance of librtlsdr […] Failed to open rtlsdr device #0″ needs to recompile using this syntax:

    cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON

    (honesly, my very first working “make” :) :)

    Cheers.

    Reply
    • ahhhh that can also be actually due to something else using the card… didn’t notice any mention of blacklisting DVB modules, which tbh in the version of the RPI’s software used probably wasn’t needed…

      but anyway…
      add “blacklist dvb_usb_rtl28xxu” (or something else if you have a different usb device) to a file in /etc/modprobe.d/ (i used raspi-blacklist.conf as it seemed sensible)

      Reply
  19. Jan G0BBL – that means your rtl_tcp is not running, you need to start it

    Reply
  20. Im getting the following on make…

    [ 5%] Built target convenience_static
    [ 35%] Built target rtlsdr_shared
    [ 40%] Built target rtl_adsb
    [ 45%] Built target rtl_eeprom
    [ 50%] Built target rtl_fm
    [ 55%] Built target rtl_power
    [ 60%] Built target rtl_sdr
    [ 65%] Building C object src/CMakeFiles/rtl_tcp.dir/rtl_tcp.c.o
    /home/davinci/rtl-sdr/src/rtl_tcp.c:28:23: fatal error: arpa/inet.h: No such file or directory
    compilation terminated.
    src/CMakeFiles/rtl_tcp.dir/build.make:54: recipe for target ‘src/CMakeFiles/rtl_tcp.dir/rtl_tcp.c.o’ failed
    make[2]: *** [src/CMakeFiles/rtl_tcp.dir/rtl_tcp.c.o] Error 1
    CMakeFiles/Makefile2:355: recipe for target ‘src/CMakeFiles/rtl_tcp.dir/all’ failed
    make[1]: *** [src/CMakeFiles/rtl_tcp.dir/all] Error 2
    Makefile:113: recipe for target ‘all’ failed
    make: *** [all] Error 2

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

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=""> <s> <strike> <strong>