I’ve written many posts over the last couple of years detailing the steps needed to integrate ADS-B decoder applications (like RTL-1090 and dump1090) with virtual radar display apps (like BaseStation and PlanePlotter). The solutions were mostly complicated by the need to use additional software utilities to massage data streams.
I recently came across a decoder application, though, that does everything you need all in one utility. Want to feed BaseStation and PlanePotter at the same time? No problem. Want to add another data stream for Virtual Radar Server? No problem. Want statistics about the types of data being received? No problem. Want to run it on a variety of platforms, including Windows, Mac OS X, Linux, or the RaspberryPi? No problem.
This little all-in-one solution is called ModeSDeco2, and while it doesn’t have an official website you shouldn’t be put off by that. It’s a versatile, robust command-line utility (don’t be scared!) that will do everything you need to track ADS-B enabled aircraft flying over your home. And it doesn’t need any additional drivers installed to do it.
Download the application from the link above and uncompress the folder. At this point I suggest changing the name of the uncompressed folder because by default it will have the compile date as part of the folder name, which adds bulk. Let’s simplify this by changing the name to modesdeco. Now move the folder to a location on your hard drive from which you can safely run applications. I’m not going to go into great detail about this because I don’t know which operating system you’re using. But whether you’re a user of Windows, Linux or the RaspberryPi, you’ll know where to put applications.
Create a batch file or shell script from which you will run ModeSDeco2. We’re doing this because we need to append parameters to the run command, and – unless you want to type them all in each time you run ModeSDeco2 – adding them to a batch file or shell script is the easiest way. ModeSDeco2 comes with a sample batch/shell script that you can look at or modify to suit your tastes. In Windows you can use Notepad for this. In any of the unix- and linux-based OS’s, including Mac OS X, use a command line text editor like vi or pico. (Make sure the permissions are set correctly so you can execute the shell script once you’ve got it written.)
In Windows, at its most basic, your batch file will look like this:
@echo off cmd /c c:\modesdeco2\modesdeco2.exe PAUSE exit
That tells Windows to open a new command line window and run ModeSDeco2, then wait until the user (that’s you) forces the application to quit by pressing CTRL+C.
In any of the *nix operating systems, including on the RPi, this is simplified into one line:
This assumes you have your shell script saved in the same folder as ModeSDeco2. If not (say you’ve saved the shell script to your desktop), then you’ll need to specify a full path to the app, perhaps like this:
So now you have a batch file or shell script that will run ModeSDeco2 using the default settings. This means you’ll be able to receive messages from your rtl-sdr dongle and decode them. Assuming you have your rtl-sdr dongle connected to an available USB port, you should initially see something like this:
2015-04-26 19:52:34.553 INFO ModeSDeco2 v.20150308 2015-04-26 19:52:34.608 INFO Magnetic declinations coefficient file wmm.cof load successful 2015-04-26 19:52:35.636 INFO Using device: 0 mnf: Realtek prod: RTL2838UHIDIR serial: 00000013 2015-04-26 19:52:36.653 INFO Supported Gains (dB): 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 2015-04-26 19:52:36.653 INFO Sample Rate: 2.0 MHz 2015-04-26 19:52:36.653 INFO Freq: 1090.0 MHz 2015-04-26 19:52:36.653 INFO Freq Correction: 0 ppm 2015-04-26 19:52:36.653 INFO Gain: Auto
So it’s working, but you’re not able to actually see any info about any of the aircraft it’s picking up. To see some results, you’ll need to add a parameter to the end of your run command:
cmd /c c:\modesdeco2\modesdeco2.exe --verbose or ./modesdeco2 --verbose
That instructs ModeSDeco2 to display all the raw data it receives, which will look like this:
2015-04-26 20:09:45.246 INFO 8D0C602399C4851948588BF2EBAC DF17 Type 19 ICAO: 0C6023 CA 5 NUCR 0 GNSS -250 VSRC 0 VR -1344 TT 326.706 GS 240.468 GR 0 IC 1 SSC 0 IFR 1 TIMESTAMP 1430093385 2015-04-26 20:09:45.507 INFO 5D0C602381F1AE DF11 ICAO: 0C6023 CA 5 GR 0 II 9 TIMESTAMP 1430093385 2015-04-26 20:09:45.509 INFO 5D0C602381F1AE DF11 ICAO: 0C6023 CA 5 GR 0 II 9 TIMESTAMP 1430093385 2015-04-26 20:09:45.574 INFO 02A185B6301E61 DF0 ICAO: 0C6023 ALTITUDE 8350 MBIT 0 QBIT 1 GR 0 RI 3 CC 1 SL 5 TIMESTAMP 1430093385 2015-04-26 20:09:45.770 INFO 02A185B6301E61 DF0 ICAO: 0C6023 ALTITUDE 8350 MBIT 0 QBIT 1 GR 0 RI 3 CC 1 SL 5 TIMESTAMP 1430093385 2015-04-26 20:09:46.296 INFO 8D0C6023582F5102590556D35FA6 DF17 Type 11 ICAO: 0C6023 CA 5 NIC 8 ALTITUDE 8325 QBIT 1 GR 0 TS 0 CPR 0 TIMESTAMP 1430093386
Now it may be that you still aren’t seeing any aircraft data on your screen, and that may be that the gain on your dongle isn’t set high enough. ModeSDeco2 uses
auto by default, but you can specify a gain to use:
cmd /c c:\modesdeco2\modesdeco2.exe --verbose --gain 49.6 or ./modesdeco2 --verbose --gain 49.6
That’s the maximum gain allowed by my dongle. Yours may be different. When you first launched ModeSDeco2, it returned a list of Supported Gains. Use that as a reference.
Now, being able to see the raw data from the aircraft is nice, but wouldn’t it be even better if you could see those planes plotted on an interactive map and see statistics for them? We can do that using the
--web argument, followed by a port number we want to use, like this:
cmd /c c:\modesdeco2\modesdeco2.exe --verbose --gain 49.6 --web 8000 or ./modesdeco2 --verbose --gain 49.6 --web 8000
That starts a web server on port 8000, which you can then access using this url: http://127.0.0.1:8000 Pretty cool, eh? Of course, now that we have the web server and can view the data that way, we no longer need the
--verbose parameter, so you can remove it.
If you want to feed the data from ModeSDeco2 to another virtual radar application, like BaseStation, for example, you can do that by enabling an output specifically for BaseStation:
cmd /c c:\modesdeco2\modesdeco2.exe --gain 49.6 --web 8000 --sbs10001 10001 or ./modesdeco2 --gain 49.6 --web 8000 --sbs10001 10001
That instructs ModeSDeco2 to output a data stream in the format a Kinetic SBS receiver would normally produce on port 10001. You have to specify a port after the
--sbs10001 argument, so to keep things straightforward I used port number 10001.
There are many other command line arguments that you can use and combine to make ModeSDeco2 behave the way you want it to. Here’s a complete list:
|-h or --help||This help message||Displays the same info that’s in this table.|
|--device-list||List Available devices|
|--device-index arg||Select SDR device (default: 0)||Instruct ModeSDeco2 to use a dongle based on its index number (if using more than one dongle).|
|--device-serial arg||Select SDR device by serial no||Instruct ModeSDeco2 to use a dongle based on its serial number (if using more than one dongle). Use RTL1090 to change a device’s serial number.|
|--gain arg||Set gain in Receiver, dB (default: auto)||I like to set --gain 49.6 for maximum reception.|
|--agc||Enable Automatic Gain Control in SDR (default: off)|
|--freq arg||Set frequency, Hz (default: 1090000000)||There’s no need to change this for ADS-B reception.|
|--freq-correction arg||Set frequency correction, ppm (default: 0)||There’s no need to change this for ADS-B reception.|
|--input-file arg||Set input filename with I/Q signals||Use this to read in a file with raw ADS-B data in it.|
|--rbs||Enable RBS decoding (default: off)||Decode Mode-S and Mode-A/C at the same time. Required for multilateration (mlat).|
|--beast arg||Enable Beast output listen port (default: off)||Enable Beast mode output on the port you specify.|
|--avr arg||Enable AVR output listen port (default: off)||Enable AVR mode output on the port you specify.|
|--avrmlat arg||Enable AVR MLAT output listen port (default: off)||Enable AVR MLAT mode on the port you specify. Use this for sharing with PlanePlotter.|
|--sbs10001 arg||Enable SBS-3 output listen port (default: off)||Enable Kinetic SBS mode on the port you specify. Use this with BaseStation.|
|--msg arg||Enable MSG output listen port (default: off)||Output raw data on the port you specify.|
|--web arg||Enable Web Server on port (default: off)||Enable the built-in web server on the port you specify, typically 80, 8000 or 8080.|
|--silhouettes arg||Set Silhouettes directory||If you have a folder of Silhouette files like those used in BaseStation, Virtual Radar Server or PlanePlotter, you can specify that directory using this argument. Must be a local directory. Use with the --web argument.|
|--pictures arg||Set Aircraft Pictures directory||If you have a folder of Aircraft photos, you can specify that directory using this argument. Must be a local folder. Use with the --web argument.|
|--db arg||Set DB Filename||Tell ModeSDeco2 where your BaseStation.sqb file is. CAUTION: Do not use this argument if you are running BaseStation as well as ModeSDeco2 unless you make a copy of BaseStation.sqb first. Use the copy with the --db argument. Use with the --web argument.|
|--frdb arg||Set FlightRoute DB Filename||Use a FlightRoute.sqb database to display routes for aircraft shown with the web server. Use with the --web argument.|
|--location arg||Receiver location Lat:Lon Example: 36.2:-15.3||Tell ModeSDeco2 where you are in the world.|
|--verbose||Verbose mode (default: off)||Output raw data in the command window.|
|--localtime||Local Time in MSG format output (default: UTC)||Don’t worry about using this. ModeSDeco2 will get the time from your system clock.|
|--filter-expire arg||Filter record expire time, sec (default: 20)||How often to check for expired aircraft.|
|--filter-count arg||Filter record min count (default: 6)||Minimum number of messages to receive before an aircraft gets added to the list.|
|--filter-time arg||filter record min time, sec (default: 60)||Minimum amount of time an aircraft must be received for before it’s added to the list.|
|--filter-nocountry||Disable ICAO Country filter (default: on)||Don't display aircraft whose Mode-S code doesn’t correspond to a country. Turn off to include these aircraft in the list.|
|--flight-expire-time arg||Flight expire time, sec (default: 3600)||How long to wait before an aircraft is considered as a new flight if it was previously lost. 3600 seconds = 1 hour.|
|--nmea arg||Enable GPS Emulation. Format: ICAO:Port:BaudRate||For use with an external GPS antenna.|
|--nmea-logfile arg||Set GPS Emulator logfile||For use with an external GPS antenna.|
As mentioned, you can combine these codes to produce more than one output at the same time. For example…
modesdeco2 --gain 49.6 --web 8000 --rbs --sbs10001 10001 --beast 31001 --avrmlat 33003
…would output the data in three different formats on three different ports all at the same time.
In my next post, I’ll talk about running ModeSDeco2 on more than one computer and how to combine the feed from them into a single data stream. The same can also be used to combine streams from other decoder applications with data from ModeSDeco2, or to massage the data from a different decoder application.