The RTL-2832U SDR and ADS-B
What is ADS-B
Looking for something else neat to try with your new RTL-2832U SDR dongle? How about using it to set up an ADS-B capable aircraft monitoring system. In a nutshell, ADS-B stands for Automatic Dependent Surveillance Broadcast used by aircraft to broadcast such information as registration number, flight number, altitude, speed, and position in realtime. This data is used as a radar type system that allows ground stations and other aircraft to view the data about each aircraft. The ADS-B system is pretty widely used in some areas such as the UK and is gradually making it’s way into the US. Using an ADS-B receiver and some decoding software, you can view this data and plot the aircraft on a map if it is transmitting its location. The system generally transmits data on 1090MHz. How well this project works for you will depend on your location and how much air traffic passes near you location. Another factor will also be the antenna, its location, and your view of the sky. If you are in the US, only a small percentage of the aircraft transmit their location along with the other data. However, you may be surprised at how many you can see. ADS-B monitoring has been a fairly popular hobby in the UK among aircraft enthusiasts and has been gaining some traction among hobbyist in the US. Here is a pretty good forum if you are interested in learning more. One of the drawbacks to the ADS-B monitoring hobby has been the cost of the equipment. Dedicated ADS-B receivers tend to be a bit pricey in the $400+ range. Of course this data is freely available at Flightradar24.com and planefinder.net, but you might find it fun to put together your own receiving station using the $20 – $35 RTL-2832U SDR radio.
Before you start this project, you may want to take a minute and see if you may be receiving ADS-B signals before setting up the software and such. If you already have your dongle talking to SDR Sharp or HDSDR, tune to 1090MHz. Look carefully at the waterfall display and see if there are any broken lines showing in the waterfall. They may be very faint. so be sure to have your waterfall contrast settings so it will show fairly weak signals. You may never see them if the waterfall is not adjusted properly. You will hear no detectible audio, just static. It is also a good idea to try using the stock antenna, since a larger antenna not tuned specifically for the ADS-B band will not detect the signal. Even if you do not see any signals, it still may be worth a try to set up the project and see what happens. Also, give it a little time since these signals are often sporadic depending on the air traffic in your area.
Linux for Newbies
Ok, there is one little catch to this project. The ADS-B decoding software has to be run under Linux. For you Linux newbies, I would suggest using Ubuntu. Not that Ubuntu is necessarily the best Linux distribution, but everything seems to work more easily. Some of the other distros will work, but you may have to to do a little more fiddling to get it to work. I would also recommend if you have a spare computer, make a Linux machine out of it. You may find it useful to have a Linix box around since this where most of the “cutting edge” RTL-2832U projects will be showing up for awhile. The other option if you are a Windows user, is to install Linux along side of Windows. You will then have a dual boot system where you can choose which OS to start. However, unless you are a power user, you may not want to be monkeying around with your main Windows shack computer. One other option is that if you have a fairly powerful machine is to try installing Ubuntu into a virtual machine like Virtual Box. The downside of this is that the virtual machine will run Linux a bit slower than if it was running directly on the computer since Virtual Machines are “emulating” a computer through software. The advantage of Virtual Machines, is that when your done using Linux, you can simply delete it’s virtual machine since it is mostly kept in one large file.
Okay now that you have Ubuntu up and running, you will need to find the terminal program (ALT-CTRL-T). You probably will want to pin terminal to your task bar since you will use it a lot. Also, don’t forget the password you were required to set up in the Ubuntu install, you may be asked for your password at various steps during the install.
Installing GNU Radio
Once you have the terminal window open, lets start by installing GNU Radio. GNU Radio will automatically install itself and the drivers needed for the RTL-2832U dongle. You will want to keep GNU Radio around on your Linux machine, since it is the base of several current and possible future products. At the terminal prompt enter:
wget http://www.sbrac.org/files/build-gnuradio && chmod a+x ./build-gnuradio && ./build-gnuradio
You may be asked if you want to install this, and enter Y. Now, go get a cup of coffee or go for a walk because it can take awhile for everything to download and install for GNU Radio. Don’t bother the computer until you get the prompt again. When finished you will see a message about setting your Python path. Just copy and paste the recommended setting into your terminal window and you should be good to go.
Plug in your dongle and issue the following command.
You should now see in your terminal window a series a of messages indicating that your dongle was found, its usable frequency ranges, and any gaps in reception. If your dongle does not go to 1090MHz or has a gap there, then its time to get a different dongle.
Ok, after the break, we are going to install a neat little program called gr-air-modes written by Nick Foster. This program will read the data stream from the RTL-2832U stick and then decode the data into usable ADS-B messages. This software basically emulates Kinetics SBS-1 radar box. The resulting data can be sent to port 30003 so SBS-1 compatible software can decode the data to show flight numbers, plot aircraft on map, etc.
Again at the terminal window issue the following commands one at a time. Remember you may be asked for your password:
git clone https://github.com/bistromath/gr-air-modes.git cd gr-air-modes/ mkdir build cd build cmake .. make sudo make install sudo ldconfig
Ok, if you didn’t get any serious errors, gr-air-modes should be installed and you should be good to go.
To start the program type the following command at the terminal prompt:
uhd_modes.py -d -P
This command should start the program and the data server for external programs to decode the data. If the RTL-2832U is receiving an ADS-B signal, you should see a stream of text readable messages. If you don’t see anything immediately don’t worry it may be that there are no aircraft are in range or your antenna is not doing a good job. I used the stock antenna inside and would get transmissions 50 to 75 miles away. Actually, I unscrewed the antenna from the base and still got transmissions. The RTL-2832U seems to be pretty sensitive at this frequency range. Again, I am using the Ezcap 668 dongle. I can’t compare the reception to commercial units, but the RTL2832U seems to work amazingly well for the cost.
Virtual Radio Software
Okay now you are going to want some software to decode and display the aircraft positions. Head on over to the Virtual Radar Server site and go to the Linux page. Follow the simple instructions on this page to install Virtual Radar Server and the Database Writer program. Be sure gr-air-modes is running and you are seeing data in the terminal window. Start the program and go to the base station setup an enter your computers IP address, do not change the port number. Close and restart the program and you should see “connected” at the bottom of the programs window. To see the map and the aircraft data click on the local link showed at the bottom of the programs window. You should now see the aircraft positions overlaid on a google map and other data about the aircraft displayed on the right. You may have to adjust the map to show your area. If you are seeing aircraft but no plots on the map, don’t worry everything is working correctly. This means that the aircraft are not transmitting type 17 messages that contain positional data. You can watch the terminal window and see what messages are being received. You may eventually see an aircraft plot if you are patient. Virtual Radar Server can also setup to run a public web server so that other people can see your plots if you are so inclined.
Gr-air-modes will also work with Plane Plotter. You can download a 21 day trial if you want to give it a try, it is also fairly inexpensive to buy. Plane plotter ads a great deal of functionality to ADS-B aircraft tracking and requires Windows to run. Since you are running gr-air-modes under Linux you can use one of these methods.
1. Install Wine. The basic functions of Plane Plotter work fine under wine. To get some of the more advanced functions going may require some tinkering.
2. Install Virtual Box on your Linux machine and then install a copy of Windows in a virtual machine. Plane Plotter works pretty well this way.
3. Run Plane Plotter on another machine and point Plane Plotter to the IP address of the Linux machine running gr-air-modes. Just make sure that port 30003 is open on your router.
To configure Plane Plotter for gr-air-modes do the following:
Set ADS-B receiver to SBS1/RBv3 TCP
Under Modes Setting:
Kinetics SBS Family
SBS1-BS IP (set IP port on the machine running gr-air-modes)
For a $25 – $35 investment, the RTL-2832U dongle works pretty well for this application. At least it provides a very in-expensive introduction to the ADS-B monitoring hobby. You might want to experiment with adding an antenna designed for ADS-B and getting the antenna out into the clear. Remember at these frequencies, cable loss could be an issue, so use the proper cable. Since the dongle is so cheap you could consider putting it in a weather proof housing and mounting it and the antenna outside. This way you could avoid signal loss due to cable, but you will be limited to about 16 feet (recommended maximum USB cable length). Of course being outside may damage the unit, but then again it is pretty cheap to replace. You could also get a second dongle and add ACARS (Aircraft Communication and Reporting System) to Plane Plotter. ACARS also can provide positional data and other information about aircraft. The advantage is that you might pick up aircraft data from a further distance, but positional data is not updated as rapidly as ADS-B. You can do this by using SDR-Sharp to tune the second dongle to 131.550 AM and pipe the audio to Plane Plotter through Virtual Audio Cable (VAC).