Installing DUMP1090 on Raspberry Pi

Hardware

If you’ve arrived at this post you probably already have a RTLSDR receiver and the other hardware that is needed and now you just want to read the ADS-B data that you are receiving. However I will share what hardware I was using in case you are wondering what is actually needed to get it to work. The hardware I used was:

Installing the needed software

To be able to receive and filter out the data that we want to read we need to install some software on the Raspberry PI.
First off, we will need to build some of the independent softwares from the source code into binaries. This sounds harder than it is but we will need some specific tools that will facilitate this process for us.

First of, open a terminal either on your PI or if you are remotely connected to your PI through SSH will also work just as fine. Some or most of these packages might already be installed on your system, in that case it doesnt matter, your system will just tell you that these packages already exist.

Installing packages needed for building software

Run the following command:

1
sudo apt update && sudo apt upgrade

This will just update your system and repositories so that you will get the latest versions of everything.
Next run:

1
sudo apt install git-core git cmake build-essential libusb-1.0-0-dev

Ok great, once these packages have been installed we are ready to start downloading and compiling the RTL-SDR software that is a dependency of DUMP1090.

Installing RTL-SDR

For more information about this specific piece of software please visit https://osmocom.org/projects/rtl-sdr/wiki

Now run this command in your terminal:

1
git clone git://git.osmocom.org/rtl-sdr.git

The above command will clone all the source code of this software down to your raspberry pi.
Next run these commands:

1
cd rtl-sdr && mkdir build && cd build && cmake  ../ -DINSTALL_UDEV_RULES=ON && make && sudo make install

The above command is actually multiple commands concatenated so they will run sequentially after each other. Hopefully all these commands succeeded for you without any errors, in that case we have successfully managed to compile the rtl-sdr source code into a binary file. Now we need to set some udev rules to make this RTLSDR dongle available for non root users.

Now there are two things that we need to know about your RTLSDR dongle. The vendor ID and the product ID.
Run the below command to find these ids:

1
lsusb

You should get an output that looks something like this:

1
2
3
4
Bus 001 Device 004: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

As we can clearly see Device 004 on line 1 is the device we are interested in. In my case the vendor id is “0bda” and the product ID is “2838”. Now that we have this information we can create the udev rules file.
This file should be located in the /etc/udev/rules.d/ directory, so next lets create this file and start editing it.

1
sudo nano /etc/udev/rules.d/rtl-sdr.rules

Notice that the filename should be rtl-sdr.rules
Now the nano editor should have opened with an empty file. We have to paste a configuration string into it. Mine looks like this:

1
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", GROUP="adm", MODE="0666", SYMLINK+="rtl_sdr"

In ATTRS{idVendor}==”0bda” and ATTRS{idProduct}==”2838” you should replace the ids with your vendor/product ids.
Now save this file by doing CTRL + O and then close nano by doing CTRL + X
Fantastic, now reboot your raspberry pi.

1
sudo reboot

Once the pi has started back up lets test our receiver to see if its working.

1
rtl_test -t

You should see similar output to this:

1
2
3
4
5
6
7
8
9
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 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
[R82XX] PLL not locked!
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.

If you see something like “Kernel driver is active, or device is claimed by second instance.” dont worry about it for now.

Installing DUMP1090

Ok, now we’ve come far. To install dump1090 we will need to once again download the source code and compile it. The source code can be found on github, there are several forks but this is the one I use in this tutorial: https://github.com/antirez/dump1090

Run this:

1
git clone https://github.com/antirez/dump1090

Now we’ve cloned the source code from the github repository, next we compile it:

1
cd dump1090 && make

After this has run, you should have a dump1090 binary in the folder. When I first did this I encountered some errors and I will address these now.

First I got an error that looked like this:

1
2
3
4
5
6
/usr/bin/ld: dump1090.o: in function `modesInitRTLSDR':
/home/pi/Downloads/dump1090-master/dump1090.c:340: undefined reference to `rtlsdr_get_device_count'
...
...
...
...

This error was fixed with the following steps:

1
pkg-config --libs librtlsdr --debug

I ran the above command and got an output like this:

1
2
3
4
5
6
7
8
9
10
11
12
Error printing enabled by default due to use of output options besides --exists, --atleast/exact/max-version or --list-all. Value of --silence-errors: 0
Error printing enabled
Adding virtual 'pkg-config' package to list of known packages
Cannot open directory #1 '/usr/local/lib/arm-linux-gnueabihf/pkgconfig' in package search path: No such file or directory
Scanning directory #2 '/usr/local/lib/pkgconfig'
File 'librtlsdr.pc' appears to be a .pc file
Will find package 'librtlsdr' in file '/usr/local/lib/pkgconfig/librtlsdr.pc'
...
...
...
...
...

The important information in the output is the “Will find package ‘librtlsdr’ in file ‘/usr/local/lib/pkgconfig/librtlsdr.pc’.
I opened that file with the nano editor and replaced the lines at the top with this:

1
2
3
4
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Then I saved the file and after this I could successfully build DUMP1090.

The next error I got was when trying to run DUMP1090. I couldnt because the kernel was using the RTL-SDR receiver (or so I think). I fixed this by blacklisting it in the kernel module like this:

1
cd /etc/modprobe.d && sudo nano no-rtl.conf

Then I added these lines to the file:

1
2
3
blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830

And then saved the file. When this was done I could successfully run the DUMP1090 application. To see available commands for DUMP1090 run it with the –help flag.
Otherwise if you just want to quickly get started run dump1090 in interactive mode and see the planes in your area as they arrive like this:

1
./dump1090 --interactive

Keep in mind that you need to be inside the directory where the dump1090 binary lives for the above command to work.