Raspberry Pi’s are small yet surprisingly powerful computers that run an operating system called Linux. As they are relatively inexpensive they are ideal for tasks such as receiving ADSB data in remote locations but the learning curve is steep. If you’re expecting something as easy to use as Microsoft Windows then you’re in for a shock.
Below are comprehensive instructions on how to set up networking, install the drivers for the DVB-T dongle and dump1090. You will need to complete all of these steps to get dump1090 working.
If this looks like too much work then it’s probably better to stick to running dump1090 on a Windows PC. If you have an old laptop then that may be a way of doing it without needing to have your main computer running all the time.
1. Setting Up the Raspberry Pi for the First Time
Connect the keyboard, a mouse and a monitor to the Raspberry Pi and connect it via a network cable to your router.
Take the microSD card out of the SD card adapter and carefully place it into the slot at the opposite end of the Raspberry Pi to the USB slots. Make sure that you insert it with the card contacts down towards the circuit board. It should slide it and click into place.
Power up and select Raspbian operating system – this will take a while to install so go and make a cup of tea or take the dog for a walk !
When it’s finished it’ll wait for you to reboot. Once rebooted loads of information will scroll up the screen. Towards the end there will be a line like ‘My address is X.X.X.X’ where X.X.X.X will be something like 192.168.1.23 or similar. Write this down as you’ll need it later
Once you’ve logged in you’ll be presented with a clunky looking configuration program where you use the cursor keys and the Enter key to select options.
First change the default password to something secure and memorable (Option 2)
Then choose to boot into the command line (Option 3) as this will save memory and the RPi will almost certainly be used without monitor, keyboard and mouse when it’s finally configured.
Then setup localization – basically this is telling it the timezone (Option 4)
Finally go into Advanced options (Option 8) and set up SSH (Option A4). You want to enable this.
As the Raspberry Pi will have been assigned a network address by your router you should be able to connect to the RPi from any other computer in the house. To do this we’ll use a program called Putty:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
To connect to your Raspberry Pi enter pi@X.X.X.X where X.X.X.X is the address of the RPi. In my case this was 192.168.1.23. You’ll get warning the first that you connect because Putty hasn’t seen the computer before so just click Yes and then enter the password you set for the Pi earlier.
If all goes well you’ll get a command prompt. If you can’t connect double check the IP address by looking in your routers list of attached devices. It may be shown as ‘Unknown’ or the default name of ‘raspberrypi’.
Shutdown the RPi with the command:
1 | sudo shutdown -h now |
You can then disconnect the power, keyboard, monitor and mouse. Reconnect the power and log into your RPi as before this time using Putty.
2. Updating the Raspberry Pi to the later operating system
The SD card that came with your Raspberry Pi may not have the latest version of the operating system on it so we ought to check and download any updates. To find out your current operating system version enter the command:
1 | uname -a |
which will tell us the system version, you’ll get something like:
1 | Linux raspberrypi 3.12.32+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 |
This indicates that my Pi is running version 3.12.32 which was built on June 18th
To start the upgrade process enter:
1 | sudo apt-get update |
to get a list of the latest versions of the software packages. This may take some time depending on the speed of your internet connection.
When it’s done we’ll tell it upgrade to the latest version of everything – again this may take some time – with the command:
1 | sudo apt-get upgrade |
If asked any questions just accept the default by hitting the Enter key
This upgrade process will take between 30 and 45 minutes so go have lunch, make a cup of tea, take the dog for another walk etc !
At the end of the upgrade process, the RPi will almost certainly need to be rebooted. To do so enter:
1 | sudo reboot |
When it starts up again, enter
1 | uname -a |
and check that it’s reporting more recent version and date. If it is then we’re ok to move on to setting up WiFi. Mine reported:
1 | Linux raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 |
3. Setting up Wifi
In order to receive as many aircraft as possible the Raspberry Pi will need to be located as high as possible or connected to an antenna that is as high as possible. The small size of the Raspberry Pi means that, as long there is power available, then it can be mounted high up. This allows for a shorter cable run and lower signal losses.
If you intend to locate it some distance from your router then you’ll need to set up Wifi. If you intend to connect it via cable to your router then you can skip to the next section.
Make sure that the Wifi dongle is plugged in and then enter the command:
1 | sudo lsusb |
to list all USB devices currently plugged in
Look for a line referring to a WLAN adapter. If you don’t see one ensure that the Wireless dongle is inserted properly. If a reboot doesn’t fix it then you may have an unsupported one.
Enter the command:
1 | sudo nano /etc/network/interfaces |
and edit the file to look like:
1 | auto lo |
1 | iface lo inet loopback |
1 | iface eth0 inet dhcp |
1 | allow-hotplug wlan0 |
1 | iface wlan0 inet manual |
1 | wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf |
1 | iface default inet dhcp |
To save the file enter Ctrl X, Y and then enter.
Now check for available networks:
1 | sudo iwlist wlan0 scan |
All being well it will list at least one network and hopefully one of those will be yours. If there is too much information to take in use the grep command to find your network:
1 | sudo iwlist wlan0 scan | grep ESSID |
Now we need to tell the RPi to connect to that network. The easiest way to do this is download a readymade version of the file. To that we’ll first move the existing version out of the way:
1 2 | cd /etc/wpa_supplicant sudo mv wpa_supplicant.conf wpa_supplicant.conf-old |
Then download the readymade version:
1 | sudo wget http://radar.lowflyingwales.co.uk/files/wpa_supplicant.conf |
And then edit it with the following command:
1 | sudo nano /etc/wpa_supplicant/wpa_supplicant.conf |
Now turn off WiFi (in case it’s on) and then turn it on:
1 2 | sudo ifdown wlan0 sudo ifup wlan0 |
Don’t worry if you get an error message saying wlan0 not configured after the first command
Each network device can only have one IP address associated with it so we need to find out which address the WiFi card has taken. To do that enter:
1 | sudo ifconfig |
and look for the address in the wlan0 section. In all probability it’ll be one higher than the address that the cabled connection used. In my case it was 192.168.1.24
If no address is given it’s because the PSK code needs to be encrypted. To do that enter the command:
1 | sudo wpa_passphrase <ssid> <passphrase> |
and copy the resulting line:
1 | psk=xxxxxx |
into wpa_supplicant.conf
Now shutdown the RPi using:
1 | sudo shutdown -h now |
And unplug the ethernet cable. Then restart it and connect over WiFi in exactly the same way as before but using the address that we just found.
There seems to be an issue with some WiFi dongles which go to sleep after a while. To get around this with we can get our dongle to send a short message to our router every minute to stop it falling asleep. Here’s how we do it:
1 | crontab -e |
At the bottom of the text enter:
1 | */1 * * * * ping -c2 192.168.1.1 > /dev/null |
This sends to tiny packets of data to my router (192.168.1.1 – your address may be different) every minute, 24/7/365.
Save the file in the normal way (Ctrl X, Y, Enter)
4. Setting up the DVB-T dongle
Unlike Windows computers, software for RPi computers is regularly updated. It is also usually compiled from source code rather than just being installed and run. Don’t worry if this doesn’t make any sense – all it means is that there’s a few extra steps to take !
We need to install the software which will allow us to compile programs from source code. To do that enter:
1 2 | cd sudo apt-get install git-core |
If you get a message telling you that it’s already installed that’s fine otherwise it’ll install it.
Now we need to get the code to recognise the USB dongle as it’s not automatically recognised. If you’re asked any questions, just accept the default option. To get started enter:
1 2 3 4 | sudo apt-get install git sudo apt-get install cmake sudo apt-get install libusb-1.0-0-dev sudo apt-get install build-essential |
Once that’s done, we can actually get the code to communicate with the dongle:
1 2 3 4 5 6 7 8 | git clone git://git.osmocom.org/rtl-sdr.git cd rtl-sdr mkdir build cd build cmake ../ -DINSTALL_UDEV_RULES=ON make sudo make install sudo ldconfig |
The last command should produce no output. If that’s the case then you’ve got the dongle installed so now we can tell it what it’s allowed to do:
1 2 3 | cd ~ sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/ sudo reboot |
The RPi will reboot so log back in as before and then enter the command:
1 | rtl_test -t |
If you get an error message like this:
Using device 0: Generic RTL2832U OEM
Kernel driver is active, or device is claimed by second instance of librtlsdr.
In the first case, please either detach or blacklist the kernel module
(dvb_usb_rtl28xxu), or enable automatic detaching at compile time.usb_claim_interface error -6
Failed to open rtlsdr device #0.
Here’s the fix:
1 | sudo nano /etc/modprobe.d/no-rtl.conf |
Add the following lines to the file:
1 2 3 | blacklist dvb_usb_rtl28xxu blacklist rtl2832 blacklist rtl2830 |
And save it as before. Ctrl X, Y, Enter
Reboot once again:
1 | sudo reboot |
Log in and then issue the command to test the dongle again:
1 | rtl_test -t |
If all is well then you should see something like this:
Found 1 device(s):
0: Realtek, RTL2838UHIDIR, SN: 00000001Using 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
Sampling at 2048000 S/s.
No E4000 tuner found, aborting.
5. Installing dump1090
We need to download the software:
1 2 3 4 5 6 | cd ~ git clone git://github.com/MalcolmRobb/dump1090.git cd dump1090 make sudo apt-get install pkg-config make |
1 |
If there are no error messages then you can start dump1090 running:
1 | ./dump1090 --interactive |
If all is well you should see the familiar dump1090 window with aircraft listed within it. Marvel at it for a while and then end the process using Ctrl C.
6. Starting dump1090 automatically
Ideally we want to start dump1090 automatically whenever the RPi starts. To do this we need to create a script. The easiest way to do this is to download it directly to where it is need so:
1 2 | cd /etc/init.d sudo wget http://radar.lowflyingwales.co.uk/files/dump1090/dump1090.sh |
Now we need to do some magic to get this to run:
1 2 | sudo chmod +x /etc/init.d/dump1090.sh sudo update-rc.d dump1090.sh defaults |
We can now reboot the RPi and dump1090 should start automatically. To check that it has, use the following command:
1 | ps ax | grep dump1090 |
If all is well then you should see something like this:
1 | 2414 pts/0 Rl 0:04 ./dump1090 --interactive --net --net-ro-size 500 --net-ro-rate 5 --net-beast --mlat --no-fix |
To stop dump1090:
1 | sudo /etc/init.d/dump1090.sh stop |
and to start it again:
1 | sudo /etc/init.d/dump1090.sh start |
If all is well, the next step is to confirm that we can connect to dump1090 across the network.
Credit to lowflyingwales.co.uk