ADS-B using dump1090 for the Raspberry Pi
What you can do with PlanePlotter and the dump1090 program.
PlanePlotter from COAA is a well-established program taking input from a variety of receivers, and which can also operate with Internet sharing. Below is a sample animated screenshot kindly provided by John Locker showing what PlanePlotter can do. Click the picture for a full-resolution animation. This note is about using a low-cost TV receiver dongle and a Raspberry Pi as a very low cost remote receiver for PlanePlotter and similar programs. The same DVB-T dongle can work directly on your PC using the Windows version of dump1090, which supersedes with the earlier highly valued RTL1090 software. You'll find some more notes in Sopwith's blog post.
In the picture above, I show my own Raspberry Pi which I have fitted with a GPS receiver for highly accurate timekeeping, although this is not essential for this application. I recommend the Uputronics GPS Expansion Board or Adafruit GPS receiver if you can't find a local supplier.
The System - don't forget the antenna!
Typically, you will have a Windows PC running Plane Plotter, but you will want to get the antenna as high as possible with as clear a view as possible to maximise the range you can receive. But at 1.09 GHz the cable loss can be quite significant, even if you use good-quality satellite TV cable, so an alternative is to place a small computer with the receiving stick close to the antenna, and connect that to Plane Plotter using a Wi-Fi link. You could also use a USB extender cable but these can be problematic and have length limitations. The Raspberry Pi can meet the requirements for such a small computer, and it's a fun project to learn something about the Raspberry Pi, and a little about Linux.
By the way, don't forget the antenna! The supplied antenna with the TV receiver dongle is not optimised for 1.09 GHz use, and you should get better results from a dedicated antenna. Graham Leighton has reported good results with this home-made antenna, and Moonraker and DPD will sell you antennas as well. Other home-made antennas: coaxial collinear, wire collinear. What matters is getting that antenna as high as possible with a clear view all round, ideally outside and not in the loft.
I have a FlightAware account - can I upload there?
Yes! FlightAware have released PiAware, their dump1090 client for
FlightAware - see: https://flightaware.com/adsb/piaware/
Note! This is a Snapshot!
Please note that this information started as notes in 2013. Of course,
the developments in the Raspberry Pi hardware, and the Linux OS variant used by
the Raspberry Pi mean that at least some of this information will be out-of-date
and some will be wrong as the new versions are not 100% backwards
compatible. Please let me know of anything you find which needs updating,
or could be better explained. Thanks!
The following information is mostly from Malcolm Robb, attavionics [at] btconnect [dot] com
I have tonight [2013-Apr-06] uploaded a version of dump1090.c into the file shares section which I hope will implement GS/MU capability when used on a Raspberry Pi, running Raspbian Wheezy.
The file is called dump1090_06_04_2013.c. This is a work in progress - the suffix to the file indicates the date it's posted.
What I have not done is modify the ADS-B/Mode-S detection algorithms.
Whilst playing with the software I have noticed that dump1090 misses quite a lot of the available
Mode-S frames present in the data. In some of my off air recorded files, it misses 30% or more, mainly due to the poor detection
algorithm. However, it does correctly receive strong local signals, so it's good enough as a starter.
djt notes: As the aim here is to provide a remote feed to Plane Plotter, perhaps we should say a little about remote operation. You don't need to have a keyboard, mouse and display to set up the Raspberry Pi providing the Linux you install as been configured to allow SSH - a remote secure shell which runs over the network. You can use SSH via a LAN connection initially with a program like PuTTY installed on your PC. You can do everything described here directly from the command-line. Once you have PuTTY working over your hard-wired LAN connection, you can set up the Raspberry Pi with a Wi-Fi dongle and run the device wirelessly.
The NOOBS software, however, does require a keyboard and HDMI display just for the initial configuration. Choose the Raspbian operating system. Your house TV may well have an HDMI input you can borrow...
Setup with PuTTY is described here.
Setting up Wi-Fi from the command-line is described here, although setup with the GUI works well on Raspbian Jessie.
Using a single Ethernet cable from Raspberry Pi directly to your Netbook or laptop PC is described here. This avoids the need to have a spare port on your LAN router or switch, and to have a power-consuming Wi-Fi dongle attached to the Raspberry Pi. Your PC can still talk to the Internet over its own Wi-Fi link. Thanks to Fred Hillhouse N7FMH for spotting that page.
Roger House notes: I am just building a Raspberry Pi 3 to use with my new Airspy and had an issue trying to connect it to my Wi-Fi. It seems that out of the box the Wi-Fi is only setup to use channels 1 to 11, but my Virgin Media Super Hub uses channels 1 to 13. I found the following on the Web that has resolved the issue and now allows me to connect to channel 13.
Remote Web output from the dump1090 program
The dump1090 program when running on the Raspberry Pi, can also produce a rather nice plot on a Web browser running on your local network (PC, Linux or Mac). You might also like to use this as a check that the dump1090 program is still running as expected, and that the TCP/IP link is still up on your Raspberry Pi. Simply enter the URL:
where the address can be a number or a name, e.g.
Click the image for a larger version.
Preparing the Raspberry Pi
Please note I'm not any kind of RPi/Linux guru - my first contact with it was 6 days ago. If you have RPi/Linux questions, you'll probably need to ask someone else. In the lines below, can highlight the command required, use Ctrl-C or right-click Copy to get the text into the clipboard, and then if you use PuTTY you can right-click on the text area of the terminal session to enter the command into the Raspberry Pi. To use the software, do the following (tested on Linux 3.6.11 and NOOBS/Raspbian 3.12.22+).
[djt: If you need help with your Raspberry Pi and following the instructions below, please ask on the Plane Plotter group. I am unable to answer direct e-mails about using the Raspberry Pi for ADB-S reception.]
You can now re-run the test if required:
If you want to see the output over the network at this point, remember to add the "--net" command-line switch:
There has been one report from Marco Haakmeester that the file rtl-sdr.h and
dump1090.c require changes to compile properly, but Malcolm was unable to
reproduce the problem. Contact Marco for more details if this affects you
- I'll send his e-mail address on request.
Script for doing everything at once
Chris Jeffries has kindly contributed the following script to prepare your Raspberry Pi for using dump1090. If you try the script, please report back to the PlanePlotter Group your success or otherwise. Thanks to Chris for making this available.
On the Raspberry Pi, you can download the script here, then make it executable, and then run it with these three commands:
The box below shows what the script contains. You could copy the text below to your clipboard:
.. and on the Raspberry Pi use nano to create a script:
Use the right-click mouse button to paste the contents of the clipboard into the script file you are creating (assuming you are using PuTTY to access the Raspberry Pi). Once pasted, exit nano with a Crtl-X, answering "Y" to the do you want to save question. Finally, you need to make the script executable using the chmod command:
chmod +x build-1090
and execute it with full privilege:
Thanks to Steve Tickle for those further notes.
Fred Hillhouse Jr (N7FMH) notes:
It turns out that the above command did not work within the script. I logged in as SU and entered the single line and then did reboot. The dongle was then found. I tried to start dump1090 immediately and was reminded that I needed to change the directory.
An alternative script to build the program is available from Roger House, who notes:
Please note that to download Roger's script you will need git installed, so you first need to enter the command:
Of course, it's much more within the spirit of the Raspberry Pi to learn, and
my personal feeling is that you learn more by entering the commands one at a
time and watching what they do, than by running a script.....
Changes required for Plane Plotter Mlat (multi-lateration)
So that's Malcolm's version of dump1090 installed and running on your RPi. This version already incorporates the changes required for a Plane Plotter Mlat Ground Station.
[djt] notes: To reduce the amount of network traffic you can replace the --interactive with --quiet.
To run the command so that it continues to work after you logout from the Raspberry Pi, you can run a command with a trailing ampersand, such as:
Alternatively, for a reduced CPU and network I/O load:
Note the "--no-fix" parameter to disable single-bit error
correction, and the "--gain -10" parameter to set maximum gain.
Please ask in the PlanePlotter
Group if you have problems as a result of using the gain
parameter. There will doubtless be better ways of doing this suggested by those more
expert in Linux than I. See the section below on automatic starting, for
example. If you intend to use the dump1090 program for Mlat, be sure
to tell Bev so that he can set up the server correctly for you, as the timing
for the various Mlat data sources can differ. [djt]
To find the IP address of your Raspberry Pi...
To enable Plane Plotter to talk to your Raspberry Pi, you will need to know its network address, or IP address. You can find this out by entering the command:
Look for the line containing "inet addr:". On my Wi-Fi connected RPi, that line is in a section "wlan0", which looks like this:
wlan0 Link encap:Ethernet HWaddr 00:26:f2:aa:ff:ff inet addr:192.168.0.19 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3093550 errors:0 dropped:0 overruns:0 frame:0 TX packets:1752901 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:379098734 (361.5 MiB) TX bytes:667598489 (636.6 MiB)
so you can see that the IP address is: 192.168.0.19. On a LAN connected RPi, the information will be in the eth0 section.
eth0 Link encap:Ethernet HWaddr b8:27:eb:e4:10:a9 inet addr:192.168.0.111 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1852989 errors:0 dropped:125 overruns:0 frame:0 TX packets:296245 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:191447650 (182.5 MiB) TX bytes:40837008 (38.9 MiB)
so you can see that the IP address is: 192.168.0.111.
Next, you need to configure Plane Plotter to talk to the RPi
Checking it's working using view1090.exe
Malcolm has released a Windows program which you can use to view the output of dump1090. It's a command-line program, and has text output. You can download the program from:
by pressing the Raw button and saving the file. You should right-click the downloaded view1090.exe, Properties, and press the Unblock button if it is visible. This Windows program implements the --interactive screen as a separate application. It connects to dump1090 over the same port as plane plotter does, so gets all the information that PP does. To use the program, either create a shortcut with the requisite properties, or build a command file named e.g. run-view1090.cmd, which contains:
i.e. on my system:
You only need the --net-bo-port setting if you've configured your dump1090 command line switches using "--net-ro-port".
Double-click run-view1090.cmd to
run the program, and use Ctrl-C to exit.
Keeping the Raspberry Pi's IP address across boots
Steve Tickle reminded us that as the IP address is hard-coded into Plane Plotter in the step above, you will need to make it constant across system reboots so that your Plane Plotter installation can find the Raspberry Pi every time. The easiest way to do this may be to reserve an IP address in your router for the Raspberry Pi, which matches the MAC address of the Wi-Fi device (00:26:f2:aa:ff:ff in the example above) to a fixed IP address (192.168.0.19 in the above example). Consult your router operations guide for information on how to do this. An alternative may be to set the Raspberry Pi to a fixed (static) IP address as described here.
Note: you may need to edit the hosts file on your systems to allow
access to the device by name rather than by IP address. Add a line such
as: 192.168.0.19 raspberry-pi-1
to the file. On Windows-8, note that Windows Defender may try and replace
an edited hosts file with the default one, thus removing your changes! On
Windows, the file to be edited is \Windows\system32\drivers\etc\hosts, and you
will likely need Administrator access to edit that file.
.. and finally
Others will no doubt have suggestions on how to ease the installation - but as I said, my knowledge of RPi/Linux is minimal.
If you want the dump1090 program to run automatically every time your
Raspberry Pi boots, please see the automated
start/stop script below.
Recompiling a new version
First stop any dump1090 process which is running. You can do this with the following commands, first checking whether you have a dump1090 process, and then killing it:
The ps -e shows all processes, ps alone would show just your processes. Here's what the end of the list from ps -e looks like on one RPi.
1870 tty5 00:00:00 getty 1871 tty6 00:00:00 getty 1980 ? 00:00:00 sudo 1981 ? 10:43:09 dump1090 13832 ? 00:00:02 kworker/0:0 14209 ? 00:00:13 kworker/u:2
Alternatively, if you have installed the automated start/stop script, below, enter:
Now follow these steps as you did before, with the additional step of moving (mv) the existing dump0190 directory to a safety copy, here named dump1090-001. For your next recompile when dump1090-001 will already exist, your might want to use dump1090-002, and so on. Note that if you are also running ppup1090 to send your output to Plane Plotter (and if you aren't, why not!), then you also need to copy the customised coaa.h which you have been sent to replace the newly downloaded file.
Now you can start the program and logout. Use one of the two following commands according to your needs:
Just type logout after starting the program. Alternatively, if you have installed the automated start/stop script below, enter:
How do I know what version I am running?
Run the command:
If you have just logged in, you will need to change to the dump1090 directory first, or run the following command from your home directory:
Full details of these and all other updates are available here.
Automated update to a new version
Roger Peggram, G7RUH, has kindly provided a documented script which will automate updating of the program. I have put the script and Roger's note into this Zip file (updated to V1.1, 2014-Oct-21).
Roger writes: Attached is a script file I wrote for a potential user who is not really computer literate.
I did it so the dump1090 program can be backed up and updated just by running the script.
As you can see it has a little error detection built in. I have commented the script so it should be self-explanatory.
Starting the dump1090 program automatically
Here is some information kindly provided by Steve Tickle, who notes that he
is a Linux user,
as opposed to a Linux guru...
Now copy and paste the following into the new file:
Now we make this file executable with the following command:
Now we create the runlevel shortcuts with the command:
And that's about it. If we reboot the RPi it will start dump1090 automatically. If we later log into the RPi, we can stop or restart dump1090 with the commands:
Oh, and it you want to remove dump1090 as a service, try:
Uploading to the Plane Plotter server directly from the Raspberry Pi
Getting started - posted by Malcolm in the Plane Plotter group
I think we're ready to try a basic uploader. However please note the following words of caution:
Ok - To use the uploader do the following:
ppup1090 must be started after dump1090. If dump1090 is not running when you attempt to run ppup1090 then ppup1090 will terminate.
If ppup1090 is being run on the same RPi as the main dump1090, then no command line arguments should be necessary. ppup1090 defaults to connecting to dump1090 via 127.0.0.1:30005, which is the loopback IP address and default beast output port.
However, if you're running dump1090 on a separate RPi, then yes, you do need to specify the IP address of the RPi running dump1090. And if you're running dump1090 with a different beast output port to the default (30005) then you also need to specify that. The command line in either case should be something like:
Anyway, give it a go and see what happens. I'm not claiming it'll be an easy install, and there may well still be issues, but hopefully it should give those of us with remote RPi installs the ability to upload to PP 24/7.
Malcolm has created separate makefiles for dump1090, view1090 and ppup1090, and these can be run with the command line "make -f makedump1090", "make -f makeview1090" and "make -f makeppup1090". Running the make command on its own creates just dump1090 and view1090.
Once compiled error free, at the command prompt type "./ppup1090 &". This runs the program in the background and allows it to continue running after you log out.
Checking it's working....
Look at the personalised coaa.h you were sent (use the cat command), and you will see a hex authorisation code - something like 123abc. Substitute that hex string in the URL:
and you should get a report like this:
Sample startup-script for both dump1090 and ppup1090
Steve Tickle has kindly supplied this script to start both the dump1090 program and the ppup1090 program when the Raspberry pi starts running. You can create it as discussed above in /etc/init.d/dump1090.sh
[DJT] There could be errors in the script below - please use with caution. I modified it slightly from Steve's original. I have also placed this file in the Plane Plotter Group's Files area as dump1090.sh.txt in case the download from scraping this Web page proves faulty.
[DJT] Paul Gulliver noted that there's an alternative way mentioned here. Look for section (3) "Make ppup1090 to auto-start at boot".
Earlier version which may not download correctly....
----------------------------------------------------------------------------- | dump1090 ModeS Receiver Ver : 1.10.3010.14 | ----------------------------------------------------------------------------- --device-index <index> Select RTL device (default: 0) --gain <db> Set gain (default: max gain. Use -10 for auto-gain) --enable-agc Enable the Automatic Gain Control (default: off) --freq <hz> Set frequency (default: 1090 Mhz) --ifile <filename> Read data from file (use '-' for stdin) --interactive Interactive mode refreshing data on screen --interactive-rows <num> Max number of rows in interactive mode (default: 15) --interactive-ttl <sec> Remove from list if idle for <sec> (default: 60) --interactive-rtl1090 Display flight table in RTL1090 format --raw Show only messages hex values --net Enable networking --modeac Enable decoding of SSR Modes 3/A & 3/C --net-beast TCP raw output in Beast binary format --net-only Enable just networking, no RTL device or file used --net-bind-address <ip> IP address to bind to (default: Any; Use 127.0.0.1 for private) --net-http-port <port> HTTP server port (default: 8080) --net-ri-port <port> TCP raw input listen port (default: 30001) --net-ro-port <port> TCP raw output listen port (default: 30002) --net-sbs-port <port> TCP BaseStation output listen port (default: 30003) --net-bi-port <port> TCP Beast input listen port (default: 30004) --net-bo-port <port> TCP Beast output listen port (default: 30005) --net-ro-size <size> TCP raw output minimum size (default: 0) --net-ro-rate <rate> TCP raw output memory flush rate (default: 0) --net-heartbeat <rate> TCP heartbeat rate in seconds (default: 60 sec; 0 to disable) --net-buffer <n> TCP buffer size 64Kb * (2^n) (default: n=0, 64Kb) --lat <latitude> Reference/receiver latitude for surface posn (opt) --lon <longitude> Reference/receiver longitude for surface posn (opt) --fix Enable single-bits error correction using CRC --no-fix Disable single-bits error correction using CRC --no-crc-check Disable messages with broken CRC (discouraged) --phase-enhance Enable phase enhancement --aggressive More CPU for more messages (two bits fixes, ...) --mlat display raw messages in Beast ascii mode --stats With --ifile print stats at exit. No other output --stats-every <seconds> Show and reset stats every <seconds> seconds --onlyaddr Show only ICAO addresses (testing purposes) --metric Use metric units (meters, km/h, ...) --snip <level> Strip IQ file removing samples < level --debug <flags> Debug mode (verbose), see README for details --quiet Disable output to stdout. Use for daemon applications --ppm <error> Set receiver error in parts per million (default 0) --help Show this help Debug mode flags: d = Log frames decoded with errors D = Log frames decoded with zero errors c = Log frames with bad CRC C = Log frames with good CRC p = Log frames with bad preamble n = Log network debugging info j = Log frames to frames.js, loadable by debug.html
Al Henderson had been having problems with the network connection from his Raspberry Pi dropping out, but in late October 2013 he resolved it, and posted this note on the PlanePlotter Group:
For a few months now, I have been running a Raspberry Pi with the RTL dongle and dump1090 to feed PP. It's never been 100% reliable, seeming to drop its Wi-Fi connection every so often which is frustrating.
I think I found out why last night. A simple Google brought me to a number of pages that discussed how to turn off the power management on the Wi-Fi dongle (it's an Edimax 7811Un). This dongle goes into power save when network traffic drops off, and getting it to wake up seems to be a problem. Certainly Plane Plotter trying to re-establish it's TCP/IP link doesn't appear to do it.
To try and sort this problem, I did two things (although either one of them should suffice). Firstly, I put an entry in the cron file on the Pi to ping my router every minute - this should keep the network alive and stop the dongle going into power saving. Secondly, I turned power saving off for the dongle. This part was specific to the model of dongle, in case anyone else has the same one, here's what I did:
- created a file called /etc/modprobe.d/8192cu.conf
- added the line: options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
I did the former because I didn't have complete confidence in doing the latter - the page I was looking at didn't say if you had to do anything else to make that happen.
This seems to have done the job, my Pi has now been running for 12 hours uninterrupted which is something it hasn't done for a long time. The drop outs got worse the other week when I changed the dump1090 options to reduce network load - clearly making the dongle fall asleep more often!
Thanks for posting that information, Al. I may not have seen the
problem as both NTP and MRTG will regularly make network connections.
Folks who have limited coverage have asked about running two Raspberry Pi cards with dongles, with antennas pointed in different directions from a single location, or perhaps one from an east-facing and one from a west-facing window. Note that these must be at the same location - not two different locations connected by the Internet! A helpful note was posted here (was: message 91820) by Marco showing how to use the Linux nc command to achieve this. Many thanks to Marco! He writes:
So here's my write up regarding a dual receiver using two Raspberry Pi cards, with some amendments since the original post back in December.
With a spare RPi lying idle on my desk I started wondering if I could use this somehow for a second antenna, as a simple way to get 360 degrees antenna coverage.
After a bit of online research I found it is actually very easy to use two Raspberry Pi cards, each with their own dongle and antenna. Here's how it can be done:
Two Raspberry Pi cards with dump1090 installed as usual, both network connected. We will just for clarity call one of them PRIMARY and the other SECONDARY. PlanePlotter connects to the PRIMARY Pi as usual (over port 30005) without any additional configuration in PlanePlotter needed. Nor does the SECONDARY unit need any additional configuration. Only on the PRIMARY, this line will fetch data from the SECONDARY dump1090 and inject it into the PRIMARY dump1090:
nc -d <secondary ip address> 30005 | nc 127.0.0.1 30004 &
Of course replace "<secondary ip address>" with the actual IP address of that RPi. Entering this on the command line will do the trick, but if this setup is going to be permanent it should be in a startup script.
How does it work? nc is short for netcat, a very handy set of Linux network commands. First we fetch data from the remote RPi, on port 30005 (TCP output port in Beast format). The "-d" is there to prevent the connection is broken by any keyboard input. Next we pipe this data to the local IP address on port 30004 (TCP input port in Beast format). Finally the & is used to let it run in the background.
With both Raspberry Pi cards linked, the view1090 program can still be used on both. On the SECONDARY it shows only the messages received by that Pi, but on the PRIMARY it will show not only its own received messages but also the messages received from the SECONDARY. That the setup is working can thus be tested very simply by alternately disconnecting one antenna from its dongle (just the antenna, do not unplug the dongle). With the PRIMARY antenna disconnected, view1090 on the PRIMARY will (after a short while) show the same messages as on the SECONDARY view1090.
After some testing and using this setup for several weeks, I only found one drawback: when the netcat commands are executed on the PRIMARY, dump1090 on the SECONDARY must already be up and running and available on the network, otherwise the linking will fail. Also, whenever the connection gets interrupted the link breaks and will not automatically restore. Dump1090 on the PRIMARY will continue to function without any problems, regardless of the link being active or not. In my setup, the connection is very stable and only is lost when one or both Raspberry Pi cards reboot. Therefore on the PRIMARY if have added the netcat command line in my dump1090 startup script with a 2 or 3 second delay after starting dump1090 itself, and making sure that should the Raspberry Pi cards be rebooting I first reboot the SECONDARY and then the PRIMARY.
You can always check on the PRIMARY if the link is active, with the 'ps aux' command there should be two nc processes active. Also the 'top' command will intermittently show the nc processes.
Not tested, but I'm 95% sure that the ppup1090 program on the PRIMARY (if used) will also upload the data fed in from the SECONDARY.
I'm not saying it would make much sense, but more than one SECONDARY can be used, just add the netcat command line for each SECONDARY on the PRIMARY. Do NOT use remote SECONDARY antenna's (i.e. over a WAN connection) because the antenna's would not be in the same location anymore and you will mess up the system, I think...
Any feedback is much appreciated! (feedback can be given on the PlanePlotter Group)
Simon Hitzemann writes: Many thanks for the great write-up on how to get dump1090 running on a Raspberry Pi.
While everything worked like a charm an integration with monit on monitoring the dump1090 service was a bit tough, so I put together an init-script that's a bit nicer to integrate into monitoring solutions while being Debian/Raspbian compliant.
I'm using start-stop-daemon in it a lot, it basically implements a lot of the functionality of the original script. It's even writing the PID of the process into the PID file and if you try to start it again it either notices the PID exists and does nothing or it spawns a new process and puts the new PID into the file.
Long story short, here's the init script. I hope it helps :) download a Zip file with the script
To shutdown - which you should do to close the system cleanly before powering off - use shutdown. The -P argument turns the power off, now says shutdown immediately:
To display processes running and their CPU load, memory consumption etc.
Note that you may need to install htop with a sudo apt-get install htop, but you can see that it's worth it!
Perhaps the next step might be to get a better receiver, such as the Airspy. This can be used with the Raspberry Pi to provide better performance than the DVB-T dongle provides. Details are here.
To Malcolm Robb for the original post, and to Steve Tickle and others for much-needed help with Linux.
A small glossary of the terms used may be found here.