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.

SDR Sharp receiving ADS-B Signals

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.

rtl_test -t

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.

SBS-1 Radar Box

Installing gr-air-modes

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

Virtual Radar and RTL2332U

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.

Plane Plotter

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:

Under IO:
Check ADS-B
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)

Final Thoughts

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).

Good Luck!

Discuss in our RTL-2832U Dongle Forums

 

 

 

36 thoughts on “The RTL-2832U SDR and ADS-B”
  1. Hi I tried all the instructions above and all went ok till it got to ….fetching gnuradio via git… nothing happened from there.
    Internet connection is ok, it seemed to start downloading then stopped.
    Mike

  2. Thanks so much for putting it all together like this. I had stumbled upon gr-air modes but wasn’t putting it all together, especially since they mention generating KML data. Cheers!

    1. Thanks Andy………

      Did you do the rtl_test -t to see if your stick covered 1090MHz. I have one E4000 stick that doesn’t cover 1090MHz. Gr-air-modes doesn’t know better and still works with it, but I don’t get any messages……….

  3. Thank you very much for this tutorial!
    This is my first gnuradio working under linux.
    I just had to work with a few chmod to get around some problems and to buy a new dongle as I had the 000 issue because the frequency was in the gap.

    Keep going with some other nice tutorial

  4. Hi, what Mode-S Framerate does Planeplotter indicate in your setup? (there is a framerate meter function in some of the planeplotter menus)

    I am getting quite low frame rates (not more than 3-5 Frames per second), even with a good antenna and as I can see on the server sript it seems to receive many unsuported frame types with strange frame type numbers, which is strange. I use another PIC microcontroller based decoder and miniADSB RX (small simple kit RX) and get around 50-90 Frames/s with it.

    I wonder if this low framerates is due to false decodes due to noise or low sampling rate or whatsoever? Does the python script actually allow packet filtering somewhere (e.g. decode only type 17 frames and discard all others)? Also I saw in some script that the amplitude threshold was set to 3dB above noice level. Maybe by tweaking this value performance can be improved? 73 !

    1. Hi Otti,

      You have asked some very good questions! First of all, I haven’t used PlanePlotter a lot with this setup, so I haven’t checked the framerate. I have compared my results with the some of the on-line tracking systems and the RTL2832U seems to be keeping up. I would hazard to guess that the RTL2832U can not compete with a purpose built ADS-B receiver, but gives the novice an excellent opportunity to explore the ADS-B hobby at a very low cost. The frame rate situation could definitely influenced by the reasons you mentioned. You can issue modes_rx –help
      at the terminal prompt and there are some settings you can tweak. Please let us know if you find any tweaks to improve performance.

      Thanks!

  5. I get the type 17 position report msgs with
    gr modes here in Montreal. ((-11 0.0000000000) Type 17 BDS0,9-3 (air course report) from 3a164f with TAS 174kt magnetic heading 0 VS 1280 geo. diff. from baro. alt. -25ft)
    Flight Radar Server connects to gr-air-modes but no plots on the map.
    I’ve tried everything possible.
    The VRS proximity gadget for W7 or Vista does not work either.It shows “No aircraft in range” only.
    Is there something I should do?
    I start the program command at the terminal like this.
    uhd_modes.py -d -P –kml=planes.kml –gain=90 –location “45,-70

    Any help is welcome.
    Thanks

    1. Hi Flavio,
      I would suggest just starting gr-air-modes with uhd_modes.py -d -P to see if any of your other settings are causing a problem. Also it’s probably not good to set the gain to 90 since the RTL stick will get less sensitive with more gain. Also Virtual Radar Server needs to get several consecutive type 17 messages from an aircraft before it will plot anything. Another issue maybe if your PC is too slow, it may not be decoding the messages fast enough. If you are still having trouble, install the PlanePlotter trial under Wine on your linux box and set it up as described in the article. Sounds like you basically have everything working.

      1. Thanks for answering!
        No, Rig here is a four core 3.0 Ghz.
        Ubuntu Studio host
        Win 7 guest with
        VBox.
        I’ve used PlanePlotter before
        and it worked once.
        The trial period
        has expired, can’t use it any more.
        Gr-modes is able to connect to either VRS on the main computer with Mono+VRS and to another computer on the network with Win XP, it seems it doesn’t broadcast
        packet to clients.
        I’ve tried Google Earth , xastir, VRS, PlanePlotter and AGWtracker.I get type 17 msgs here quit often.
        I don’t know what’s wrong.
        TKS 73

    2. I don’t know if Vbox is causing the problem. I tried it and it did slow the message rate down, but it seemed to work. As far as sending to other clients on another machine, make sure that port 30003 is open on your router. I had this problem, until I figured out what is wrong. Also if this port is blocked you can’t even send port 30003 data to an application on the same machine unless you are using “localhost”. For example if you are using Virtual Radar Server and give the server address as your local machines IP, it won’t get data if port 30003 is blocked on your router. Just a thought…………

      1. I understand but
        if the port is blocked on my router I wouldn’t see the Basestation status
        as connected right?
        When I click on the VRS test connection button(base station tab)
        it says “A connection can be made with these settings”

    3. Sounds like the port may be ok, but you definitely should be able to connect gr-air-modes to other machines and clients. Gr-air-modes does say “Connected” when a client is connected. Do you get a list of aircraft that Virtual Radar is recieving on the left side of the screen. VRS will show all aircraft seen that are transmitting ADS-B. However all, are not transmitting tyoe 17 messages. VRS won’t usually map an aircraft unless it recieves several type 17 messages in a row from that one aircraft. I suspect your problems might be coming from Virtual Box is some fashion. If you have a spare machine you might want to give it a try running everything directly under Ubuntu.

      1. That’s what I’m doing right now.As soon as I start VRS I see the “connections: 1” at the gr-air-modes terminal.I’m doing everything on the Linux machine now, no VirtualBox, no XP involved.
        No, I’ve never seen aircrafts listed on the VRS screen before, the only thing I see is someone’s IP address that says ClosestAircraft.json.VRS says I’ve received 44 msgs 1
        aircraft tracked and 0 bad msgs.
        When I click on the link it opens
        a new tab(Firefox), shows a map but no aircraft.
        Thank you once again for your patience.

        Flavio

    4. It sounds like your RTL stick and gr-air-modes are working fine and VRS is connecting. It could be something in VRS not quite configured correctly. You should be seeing aircraft listings on the right side of the VRS screen if they are sending ADS-B messages even if they are not type 17. If you click on the map link it will always default to Europe until you manually move it. You should see your ip listed as part of the links for the map. If you have not installed the PlanePlotter demo on this machine before, you might want to try wine and pp again just as a test.

      1. I think it might help.
        I see the 192.168.0.107 IP
        on the VRS screen/ClosetsAircraft.json.
        Where is this comming from?
        Shouldn’t I see my local IP only?
        Bytes sent keeps growing.I have no computer with that IP on the network.

    5. Not to sure about whats going on. On the VRS app if you have the drop down menus near the bottom set to “Show Local Address” and “Default Version” you should see an IP address of 127.0.0.1 which is the “Localhost” address of the machine you are running VRS on. VRS depends on using this address by default to process the map display. If you are seeing something else, there may be a problem with the machine localhost setting. In windows you can go to c:\windows\system32\drivers\etc\ and edit the hosts file and remove the # in front of the localhost line. That should set localhost to 127.0.0.1. This should really not be necessary, unless something has modified the local host setting.

  6. Hi, Thanks for this great installation guide. Managed a lot but ended up like Flavio. No connection in VRS however, probably the port problem?. Everything localhost (Linux in Vbox, I do see the data stream). Tried a port forwarding in the router for 127.0.0.1, checked host file etc. I am not that clever to setup port forwardings and assumed when running localhost this shouldn’t be that difficult to setup. Any ideas for further testing or configuration?

    thanks, Rene

    1. Yep, you shouldn’t have to worry about port forwarding for 127.0.0.1 since it is internal to the machine. Try connecting with Planeplotter and see if the problem persists. It could be a setting issue in Vbox, I am not super familiar with all the Vbox settings.

      1. For me the same, not that experienced with Vbox from Oracle or Linux. Someone else here on this board? Tsting with free port monitor and it shows no activity at all on 30003. Even after modifying windows 7 firewall for Vbox and Virtual Radar. 73’s Rene

  7. Would it be possible for you to tell me why the software has stopped at “building UHD…[sudo] password for john,I know nothing about linux afraid

    1. Hi John, it might be asking for your sudo password, which is normally the password you used when you set up linux. If you are not comfortable with Linux, check out the article on this site about the RTL1090 decoder for Windows. It is much easier to set up.

    2. Hi Rene,thanks for the reply,I know my password however I cannot key it in as the keyboard appears to be locked,has been like this for 2 days,I installed again on a much faster PC and have got to the same stage?.

      John

  8. Bonjour
    i am newbee and i donwloaded morning gr air…installation stop at build..ok i send cmd line which is on tuto uhd_modes.py -d -P and answer : uhd_modes.py has been deprecated. The new application name is modes_rx. Can you please update tuto ? i would like today sunday try this app. Thank in advance.
    73 Eric

    1. It looks maybe the author has changed the startup program name. Try entering modes_rx –help at the terminal window. This should give you a list of commands used with the software. Frankly, since this article written, the RTL1090 decoder for Windows mentioned on this site is much simpler to get and running.

  9. Bonsoir

    seems to have big bazar on my DD
    this the computer answer with -help…

    Traceback (most recent call last):
    File “/usr/local/bin/modes_gui”, line 28, in
    import air_modes
    File “/usr/local/lib/python2.7/dist-packages/air_modes/__init__.py”, line 50, in
    from air_modes_swig import *
    File “/usr/local/lib/python2.7/dist-packages/air_modes/air_modes_swig.py”, line 26, in
    _air_modes_swig = swig_import_helper()
    File “/usr/local/lib/python2.7/dist-packages/air_modes/air_modes_swig.py”, line 22, in swig_import_helper
    _mod = imp.load_module(‘_air_modes_swig’, fp, pathname, description)
    ImportError: libair_modes.so.0: cannot open shared object file: No such file or directory

    i reinstall program i think there is a bad install
    thank for your quick answer

  10. Good morning for all from France.

    During the first command i have a message. It says that something is wrong…

    The message is “Failed to dowload any usable files from http://files.ettus.com/uhd_releases/master_images

    With my navigator i searched at the address. The directory uhd_releases does not exist.

    Is there someone who can help me?

    Many thanks and best regards.

    J-L Rostini

  11. I got a new Dongle and it identifies itself as

    “Bus 001 Device 005: ID 0bda:2838 Realtek Semiconductor Corp.”

    According to
    http://www.reddit.com/r/RTLSDR/comments/s6ddo/rtlsdr_compatibility_list_v2_work__in_progress/

    this should work. However, after typing
    $ modes_rx
    (instead of UHD_modes.py, which has obviously been renamed since this article has been written), the only result I get is:

    RuntimeError: LookupError: KeyError: No devices found for —–>
    Empty Device Address

    Any clues? (Linux Newbie, on Ubuntu 12.04 LTS)

  12. Thanks, this actually helped! However, only as far as to the next obstacle. After typing:

    $ modes_rx -d -P use -s osmocom

    I got:

    gr-air-modes warning: numpy+scipy not installed, FlightGear interface not supported
    linux; GNU C++ version 4.6.3; Boost_104800; UHD_003.006.002-1-g9fd308b3

    gr-osmosdr v0.1.0-65-g24f6f88a (0.1.1git) gnuradio 3.7.2.1
    built-in source types: file fcd rtl rtl_tcp uhd hackrf bladerf rfspace
    Using device #0 Realtek RTL2838UHIDIR SN: 00000001
    Found Rafael Micro R820T tuner
    Invalid sample rate: 4000000 Hz
    Gain is 33
    Rate is 4000000
    Using Volk machine: ssse3_64_orc
    Traceback (most recent call last):
    File “/usr/local/bin/modes_rx”, line 100, in
    main()
    File “/usr/local/bin/modes_rx”, line 87, in main
    sbs1port = air_modes.output_sbs1(cpr_dec, 30003, publisher)
    File “/usr/local/lib/python2.7/dist-packages/air_modes/sbs1.py”, line 66, in __init__
    pub.subscribe(“type%i_dl” % i, output)
    NameError: global name ‘output’ is not defined

    Where am I to define ‘output’?

      1. I tried your command but getting the same error as Matthias. Any ideas?

        user@pc:~/gr-air-modes/apps$ modes_rx -s osmocom -d -P
        linux; GNU C++ version 4.8.2; Boost_105400; UHD_003.007.000-0-unknown

        gr-osmosdr v0.1.x-xxx-xunknown (0.1.2git) gnuradio 3.7.2.1
        built-in source types: file osmosdr fcd rtl rtl_tcp uhd hackrf bladerf rfspace
        Using device #0 Realtek RTL2838UHIDIR SN: 00000001
        Found Rafael Micro R820T tuner
        Invalid sample rate: 4000000 Hz
        Gain is 33
        Rate is 4000000
        Using Volk machine: sse4_2_64_orc
        Traceback (most recent call last):
        File “/usr/bin/modes_rx”, line 100, in
        main()
        File “/usr/bin/modes_rx”, line 87, in main
        sbs1port = air_modes.output_sbs1(cpr_dec, 30003, publisher)
        File “/usr/lib/python2.7/dist-packages/air_modes/sbs1.py”, line 66, in __init__
        pub.subscribe(“type%i_dl” % i, output)
        NameError: global name ‘output’ is not defined

      2. I have the same issue with
        #modes_rx -s osmocom -d -P

        NameError: global name ‘output’ is not defined

        Any help?

  13. I have the same issue with
    #modes_rx -s osmocom -d -P

    NameError: global name ‘output’ is not defined

    Any help?

Leave a Reply

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