h4cking, ham radio, fire fighting and m0re

Portable APRS Client on Raspberry Pi With Touchscreen

For tracking purposes on a holiday trip to France I was looking for a small solution allowing APRS to run. For a spare Raspberry Pi I picked up a TNC-Pi and a small 2.8” touchscreen display. That allowed xastir to run on that machine. GPS data is feed to the system from an ublox NEO-6M GPS receiver connectet to the Raspberry Pi via an FT-232 USB-RS232 adatper. The raspian image is configured to start the graphical desktop on the 2.8” display and launch xastir automatically.

The kernel image was taken from Adafruit because that includes the kernel modules for running the PiTFT display and the touchscreen. The 4 push buttons require an extra kernel module that I could not build yet but will follow up upon.

I had this equipment connected to my IC-706 MK2G while driving the camper. The GPS reception was excellent but the number of reachable repeaters not. So I had to further test this construction on the bench at home after the journey.

The technical details: The TNC is configured to connect the Raspberry Pi via I2C bus. That leaves the only onboard async serial line free. I want to hardwire a GPS RX to that in the future. The linux system uses the kernel AX.25 stuff in order to attach the device via kissattach. Inbetween there is i2ckiss which emulates the kiss device towards the kernel and communicates with the TNC using the I2C bus. The manual for the TNC-Pi is available from [1] and describes the assembly of the hardware as well as how to configure the TNC.

I used the pitnc_setparams and pitnc_getparams [2] to set the TNC to I2C mode and removed jumpers JP3 and JP4 to disconnect the async line to the Raspberry Pi. Furthermore i2ckiss was used to attach the TNC via the I2C bus. That binary can be found at [3]. The TNC is activated from the rc.local file:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
     printf "My IP address is %s\n" "$_IP"

/usr/bin/i2ckiss 1 16 aprs

# delete stale xastir pid file
if [ -f /home/pi/.xastir/ ]; then
      rm /home/pi/.xastir/

exit 0

The config of the /etc/ax25/axports file is simple:

# /etc/ax25/axports
# The format of this file is:
# name callsign speed paclen window description
#1      OH2BNS-1        1200    255     2       144.675 MHz (1200  bps)
#2      OH2BNS-9        38400   255     7       TNOS/Linux  (38400 bps)
aprs    DF2ET   19200   255     7       APRS via TNC-Pi

So this makes the TNC-Pi available as kernel AX.25 device. From here on it can be used from xastir as AX.25 TNC in the configuration. To display the user interface on the TFT screen X needs to be configured to use /dev/fb1 as frambuffer device. I created a new file /usr/share/X11/xorg.conf.d/99-fbdev.conf with the following content:

Section "Device"
  Identifier "bla"
  Driver "fbdev"
  Option "fbdev" "/dev/fb1"

The last thing that needs to be done is to autostart xastir on launch of the graphical desktop. That is again done by creating a file .config/autostart/xastir.desktop in the home directory of the user pi with this content:

[Desktop Entry]

Normally xastir cannot use the kernel AX.25 devices as non-root user. As it runs as user pi here I simply set the suid bit of the executable with sudo chmod +s /usr/bin/xastir.

The GPS device is configured as “Serial GPS” in xastir and requires to set the correct device name and baud rate. I created an udev rule to have a symlink to the actual serial device as /dev/GPSmodule. That can be achieved with a udev rule that triggers on the serial number of the FT232 device. My /etc/udev/rules.d/55-usb-serial.rules contains:

SUBSYSTEM=="tty", ATTRS{serial}=="AH01CE6Q", GROUP="dialout", MODE="0660", SYMLINK+="GPSmodule"

And finally a few pictures from the setup.