Xastir on the Raspberry Pi

Xastir APRS
Xastir APRS
Xastir APRS client on the Raspberry Pi 2

A while back I got interested in APRS. My only 2m radios were a Kenwood TM281A in my car, and a dual band HT. Neither had TNC capabilities built in, though, so the first order of business was to get a TNC that I could use on one or both of these radios. I had seen an article by Jerry Clement, VE6AB, in the May 2015 issue of QST about a bluetooth-capable TNC from Mobilinkd that works well with HT tranceivers and APRSDroid on Android smartphones. I decided to give it a try, and it worked well, as advertised.

Then I started wondering, if I used a Bluetooth USB adapter on a Raspberry Pi, could I use Xastir to set up APRS on my base station. The punchline of the story is yes, I could. Here’s how I did it.

Prepare Your Pi

My Raspberry Pi 2 was running Raspbian Wheezy when I initially set up Xastir. I now run Raspbian Jessie, and it works there as well. The first thing to do is make sure your Pi is up to date by opening a terminal window and running

sudo apt-get update
sudo apt-get upgrade

Once that is complete, you’ll need to install the necessary bluetooth tools:

sudo apt-get install bluetooth blueman bluez

Finally, install the Xastir application:

sudo apt-get install xastir

This should be everything you need.

Set Up Bluetooth

Plug your Bluetooth adapter into a USB port on the Pi. Once everything is installed, look in your Raspberry menu, under Preferences. You should see the newly added Bluetooth Manager. Click it, and wait a moment for the program to start. You should see a Bluetooth icon appear in the task bar, and a Bluetooth manager window should start on the desktop. You may also get a dialog box asking you to enable Bluetooth. Go ahead and do it.

Bluetooth Manager window, after searching for Bluetooth devices

Click the Search button in the window (and make sure your TNC2 is turned on). The TNC2 should appear in the window. Highlight it, and click the Setup button.This will bring up the setup wizard. Make sure the TNC2 is selected in the Device screen and click next.

Once you get to the Pairing screen, select the custom passkey option, and enter 1234 in the entry box. After you hit next, another dialog will open asking for the passkey again. Enter 1234 here as well. After a couple of seconds, the Pi should pair with the TNC2.

Once this is done, there is one more step that will enable Xastir to

Setup wizard device screen

connect with the TNC2. In the Bluetooth Manager window, the TNC2 entry should contain the MAC address of the TNC2. Make a note of this, or move your terminal window so that you can see it. In the terminal window enter the following:

sudo rfcomm bind /dev/rfcomm0 MAC:address:of:your:TNC


(Obviously, replace with the actual MAC address of your TNC2)

Set Up Xastir

Setup wizard pairing screen

Next, open up Xastir. You can do this either by selecting Run… from the Raspberry menu and typing xastir, or typing xastir in the terminal window. Either way, the first time you start it up, the station configuration screen open automatically. Mine looks like this. You can enter your own coordinates, or if you have a GPS attached to your Pi, there’s probably a way to get Xastir to read coordinates from that. I’ll let you figure that out, and then tell me how you did it. Anyway, be aware that the coordinates you enter should be in degrees and decimal minutes. You can select what symbol you want to use, and the parameters of your radio, and whatever comment you want to send with your transmissions. Click OK.

Next, you need to set up the TNC interface. In the main Xastir window, select Interface -> Interface Control. Then click the Add button, and select Serial KISS TNC, and Add. The interface configuration window will open. Fill it in as shown in the image below. The TNC port should match the port we specified earlier in the rfcomm bind command. If you followed my example, you’ll recall that this was /dev/rfcomm0. You can set up your Pi as an IGate, a digipeater, or both if you want. I have not done this. I set my path as WIDE1-1,WIDE2-1, and this seems to be adequate to communicate my local area without cluttering up the APRS frequency unecessarily. The KISS parameters are those specified by Mobilinkd, so make sure you enter those or you may not get the results you expect.

Click OK once you’re happy with your settings. You’ll return to the interface list. Highlight the interface you just set up and click start. If everything goes to plan, you should see the status of your interface change from DOWN to UP, and as my English friends might say, Bob’s your uncle.

The last thing you might want to do is to change the map appearance from crude lines to an actual map. To do this, in the main Xastir window, click on Map, and select Map Chooser. You should have a list of maps to select from, and theoretically you could have several of them layered in your display. However, the only one I’ve had any success with is “Online/OSM_tiled_mapnik.geo.” In fact, some of the others have caused Xastir to hang up.

Once you’ve set all this up, you will probably have to run the rfcomm bind command each time you start your Pi. I put the command in a shell script that I run prior to starting Xastir, which saves me a bit of typing. There are ways to set up your system to run the rfcomm bind command at startup, but I’ll leave that to you to sort out if you want that. Have fun launching those packets!




Leave a Reply

Your email address will not be published. Required fields are marked *