Building your own ADS-B receiver for Raspberry PI 2

Every time I’m in the aeroplane part of the checklist is to switch the transponder on to standby and then on to mode ACS, I know these are message types, but is the transponder working and what information is it giving out!? Wouldn’t it be cool if you could see what was going on and ensure your transponder is working, well I thought so! It transpires you can build your own receiver either running on a PC or as a standalone unit using a Raspberry Pi so let’s try…

just a quick note before we try, most of what I have list below is taken from various web sites such as http://xdeco.org/?page_id=39 and this great post http://radarspotting.com/forum/index.php?topic=4965.0

This what I’m getting with the finished setup, click the images to enlarge them:

   

I have never used a PI before or done anything with Linux so this could be “fun”!

First you are going to need to load an OS on the PI 2, I went with Raspbian via noobs as it’s what mine came with!

Needless to say you will also need an RTL USB DVB-T Stick RTL2832U (£4.00 + p&p) and optionally a WIFI dongle supported by the PI.

Follow the NOOBS setup to load the OS.

In the configuration utility that launches at the end of the OS load I just tabbed to finish, I will change the password later, no time now!

 

WIFI

At the command prompt typing “startx” loads the GUI, go to Menu, Preferences, WIFI configuration and manually added your network, you need the SSID, network security Type (mine was WPA 2 personal) and the PSK password mine was (well that’s for me to know!).

I needed to unplug and replug the USB dongle in for this to connect, not sure why.

I tested my connection by opening the PI browser and going to Google, it worked, amazed!

 

Remote login to the PI!

My PI monitor is rubbish, but as I will be running it headless I don’t care, so I decided to go directly for a remote connection and update the PI via it. To do this google Putty and download it or go here.

Run Putty select SSH and enter the IP address of your PI, or as I did simply enter the hostname which by default will be “raspberrypi.home”

 

If you get a connection you will see a command window open and a dialog asking if you trust the connection (ok this).

 

Login on the command prompt: username “pi” default password “raspberry”. Not there is no key echo when typing the password.

 

Updating the OS

Type each command and wait for it to complete before typing the next:

sudo apt-get update

sudo apt-get dist-upgrade     (this took around 40 mins)

sudo reboot

 

Check and or set the time zone

sudo dpkg-reconfigure tzdata

For me this was Europe and then London.

 

Install GIT Core (I’m not sure this was needed as it said it already existed)

sudo apt-get install git-core (checks/updates the core if needed)

sudo apt-get install git

sudo apt-get install cmake

select Y to continue.

 

Downloading the ModeSDeco2 to the PI

Download ModeSDeco2 for your version of the PI from the link below or google “ModeSDeco2 download”.

http://xdeco.org/?page_id=30

If you are not sure which version you need type the command

lsb_release -da
you can then check which codename you have installed.

Copy it to the PI, for this I used FileZilla

Setup the FileZilla connection as below:

Create a folder on the “remote site” just right click and select “create directory and enter it”

I named it modesdeco2

Select the fie in the “local site” and drag it to the “remote site” under /home/pi/modesdeco2

Now back in Putty connect to the pi and expand the file by entering

cd modesdeco2

tar -xvf modesdeco2_rpi2_yyyymmdd.tgz
(changing the yyyymmdd to match the file name)

 

Installing the USB driver

Enter the following to instate the driver

sudo apt-get install libusb-1.0-0-dev

You now need to create two text files one to allow, user Pi, to access the USB dongle and the other to remove the built-in driver for the dongle.

Enter lsusb and note the shown below:

My number was different so yours maybe too!

Enter

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

this will bring up the editor.

Add the following line replacing both idVendor value and idProduct value with those from above.

SUBSYSTEMS==”usb”, ATTRS{idVendor}==”0bda“, ATTRS{idProduct}==”2832“, MODE:=”0666”

Save the file Ctrl-O hit enter to confirm the file name and then exit Ctrl-X.

Now to stop the inbuilt driver from loading type

sudo nano /etc/modprobe.d/no-rtl.conf

add the following lines:

blacklist dvb_usb_rtl28xxu

blacklist rtl2832

blacklist rtl2830

Save the file Ctrl-O hit enter to confirm the file name and then exit Ctrl-X.

Now reboot by entering

sudo reboot

 

Testing

You should now be able to log back in via putty and run Modesdeco2 but before you run it we need to set it up.

You need to down load the following 2 files:

BaseStation.sqb from http://planebase.biz/sqb.php?f=basestationall.zip

Silhouettes from http://www.iksilhouettes.co.uk 

 

Using Filzila

Copy BaseStation.sqb into /home/pi/modesdeco2 on the pi.

Make a sub folder under /home/pi/modesdeco2 I used /home/pi/modesdeco2/silhouettes

Unzip the Silhouettes.zip and copy the content, a lot of bmp files to the folder.

Note on the PI unlike in windows the folder names Silhouettes and silhouettes are not the same, it got me!

 

Now test its all working by entre the following:

/home/pi/modesdeco2/modesdeco2 --rbs --gain 49.6 --web 8081 --beast 31001 --sbs10001 30003 --db /home/pi/modesdeco2/BaseStation.sqb --silhouettes /home/pi/modesdeco2/silhouettes &

 

I have reinstalled on a PI3 and needed to put “SUDO” in front of the command above for it to run

SUDO /home/pi/modesdeco2/modesdeco2 –rbs –gain 49.6 –web 8081 –beast 31001 –sbs10001 30003 –db /home/pi/modesdeco2/BaseStation.sqb –silhouettes /home/pi/modesdeco2/silhouettes &

You should now be able to browse to the pi from another computer by putting in the browser address http://raspberrypi.home:8081

If it’s all working you will be able to see flights under the flights tab.

 

 

 

Auto run

Now you have it working you will want to make it auto start with the PI, to do this we need to login with Putty and issue the following command.

sudo nano /etc/rc.local

add the line:

/home/pi/modesdeco2/modesdeco2 --rbs --gain 49.6 --web 8081 --beast 31001 --sbs10001 30003 --db /home/pi/modesdeco2/BaseStation.sqb --silhouettes /home/pi/modesdeco2/silhouettes --location 52.741:0.450 &

Note: change the location to your location this can be found in google maps by right clicking your location and selecting “what’s here”.

Note the & at the end is needed!

Save and exit

Reboot the pi sudo reboot and test it has auto started.

 

Feeding FR24

This is quite easy and is the last sequence.

First check what latest version is at http://feed.flightradar24.com/#raspberry-pi below I’m using 1.0.12-3 but by the time you read this it will be out of date!

Enter

wget http://repo.feed.flightradar24.com/rpi_binaries/fr24feed_1.0.18-7_armhf.deb

sudo dpkg -i fr24feed_1.0.18-7_armhf.deb

sudo fr24feed –reconfigure –fr24key=”your sharing key”

Enter 2 as we are using modesdeco2 and not directly connecting to the dongle with this program.

Next enter 1 for network connection.

Type in the loopback IP address 127.0.0.1

Enter the port number 30003 (we set this in the modesdeco2 parameter list)

Say no to the next 3 options as we are sharing from Modesdeco2 not fr24feed.

At step 6A select 0 to disable logging

And just enter to leave the path blank in step 6B.

 

Enter the following to start the service

sudo service fr24feed start

 

You can check its working by entering

service fr24feed status

Reboot the PI sudo reboot

And check it’s all working!

 

Good luck and enjoy!