Do you have an unused Raspberry Pi lying around your bench somewhere and just can’t figure out what to do with it? You could build a wireless RTL-SDR streaming server!
Why would you want to do that? Well, maybe you’re in a similar situation like me and your computer is in a location where radio reception is very poor. This is where a small, WiFi connected RTL-SDR would be very handy, you can set it up in places where there is better radio reception and then stream the IQ data from the SDR to your PC for further processing.
My setup currenty looks like this:
In the picture you can see that I have a powered USB hub connecting the R820T based SDR and the TL-WN725N wireless stick to the Raspi. The antenna cable running off to the top is going to the antenna which is placed outside the window for better reception (the thick, steel reinforced walls in my apartment make it impossible to even tune in to local FM stations).
Setting up the Raspi is pretty simple, I’ll start with the wireless setup (skip this if you’ve got a different WiFi dongle or already have a working WiFi setup) and then continue with the RTL-SDR setup.
Setting up the SDR software
Now comes the interesting part, setting up the SDR software. To communicate with the SDR we make use of the great work done by the people over at OSMOCOM, using their librtlsdr. The installation is pretty straightforward:
Now we have to blacklist a kernel module which is normally loaded when plugging in the RTL-SDR dongle, otherwise librtlsdr will not be able to access the RTL-SDR dongle and retrieve data from it. To do that, simply run:
Now reboot the Raspberry Pi. After rebooting, plug in the dongle and change to build/src inside of your rtl-sdr directory. Running ./rtl_test after a successfull installation should yield an output similar to this:
Great! What’s even better is that the software we just compiled already comes with a network streaming server. We can now use SDR# to tune in to different stations and have a look at the spectrum. Alternatively we can also use adsbSCOPE to plot the locations of aircraft on a map.
Streaming raw IQ data over the network
On the Raspi we will run rtl_tcp, a server that sends the raw IQ data from the SDR over a TCP network connection to another computer running SDR# or similar software. In my case the Raspi has the IP address 192.168.0.106.
To start the server simply run the following command (replace the IP address with the IP of your Raspi):
Now in SDR# running on another computer connected to the same network, we can select “RTL-SDR/TCP” as a source from the Source drop down menu. In the settings menu (click on the cog button in the menu bar) we have to enter the IP address and port on which our Raspi is streaming the data:
Huzzah! We can now tune in to different radio stations using SDR#, without the RTL-SDR dongle being connected to the same PC!
Streaming ADS-B data over the network
As it turns out, librtlsdr also comes with a program to demodulate the ADS-B data sent out by aircraft. We can then use netcat to stream the raw ADS-B data over a TCP connection to another computer running adsbSCOPE or similar ADS-B data plotting software.
To stream the raw ADS-B data over the network, simply run:
Now in the network setup menu of adsbSCOPE, in the RAW-data-client box we enter our Raspi’s IP and the port we’re streaming on:
Depending on the air traffic in your area and how good the reception in your location is, you should start seeing some aircraft on the map:
Note that the data was collected just with the standard (far from optimal) DVB-T antenna that came with the SDR dongle, placed outside a window on the 7th floor of an apartment building. I plan on building a better antenna, specifically for receiving ADS-B messages. Most likely I will start out with a quater wavelength ground plane antenna as a half wave length 16 element colinear coaxial antenna will be a bit large for dorm room (read as: stick antenna out of the window) operation.