Packet Radio on a Raspberry Pi the cheap way!

Packet radio is, in essence, the transmission of data over radio using a protocol called AX.25. It is the mechanism of transmission under the hood for APRS. However, APRS is unconnected packet, while Packet Radio is connected. This implies that Packet can be used for a number of other applications, such as keyboard-to-keyboard chat or connecting to a mail server or a BBS -- not just "blast away" the message.

In this post, I'll cover how to install and setup packet radio from a Raspberry Pi, without any additional hardware, and for a fraction of the cost.


A terminal showing the output of the HELP command in a TNC


I was recently introduced to the wonders packet radio. It has both a post-apocalyptic and 80's nerd feelings to it that I'm enjoying a lot. The fact that my background is in computer science might have something to do with it, too.

Packet Radio is a marketing term to refer to AFSK-modulated FM using AX.25 at 1200 baud (or 300 baud on most HF bands). Traditionally, the modulation of the data was achieved by a TNC or Terminal Node Controller connected both the a computer and to a radio. On top of the ability to connect to other systems, TNCs usually provide a "listener program" that replies to incoming connections, as well as other applications such as mailbox and BBS.

A Kantronics Packet Communicator 3 sitting on top of a 7100 and a IT-100


TNCs are not cheap, and they provide only a limited functionality, which prevents many amateurs from buying and using one. From time to time, some of this devices appear on eBay, which drastically reduces the cost. Still, you will need to wire your own cable and mess around with the settings on your radio, and this is something that not everyone is up to.

There's a cheaper alternative for those who like to tinker with computers. Any Raspberry Pi - and any Linux system, for that matter - can handle the modulation and offer similar functionalities to a TNC, including PTT control.

Following below, you'll find a step-by-step guide on how to install AX.25 and Linpac on your computer:


Step 1. Install Hamlib and Direwolf
On one side, Hamlib is a software library that most amateur radio applications use to connect to your radio. Direwolf, on the other side is a software TNC: it will handle audio in and audio out, together with CAT and PTT control.

The installation of Hamlib and Direwolf, as well as their configuration,  is extensively covered in steps 2 and 3 in this previous blog post. If you follow those instructions, you will get them up and running in some minutes.


Step 2. Install AX.25
AX.25 is an old data link layer protocol for communications based on an even older protocol named X.25. X.25 was widely use before TCP/IP and the definition of the ISO/OSI stack -- it literally pre-dates the Internet as we know it. It was the protocol that ATMs used to communicate with the central offices of their banks.

The installation of AX.25 is as simple as installing a few packets:
sudo apt-get install libax25 ax25-apps ax25-tools
Once done, you will need to add a line to a file. In order to do so, just execute the following:
cd /etc/ax25/
sudo nano axports
The contents of my /etc/ax25/ax25ports file

Go to the end of the file and add the following line:
vhfdrop M0PQA-1         19200   236     4       VHF Radio
Where:
  • vhfdrop is the name of your port
  • M0PQA-1 is YOUR callsign, followed by a -1
  • 19200 is the Data Terminal Equipment (DTE) speed which is the speed between the computer and the TNC. When using Direwolf, this is totally meaningless.
  • 236 is the Maximum Transmission Unit (MTU). You can increase this value up to a maximum of 255 if your connection is stable. If not, reduce it to a reasonable number such as 128.
  • 4 is the maximum number of packets that your radio will send before waiting for a confirmation. The higher it is, the higher the speed of your comms. However, if one of this packets fail, they all will be re-send. 4 is a reasonable value.

Step 3. Compile and Install LinPac
Unfortunately, the official Raspbian package for Linpac presents many issues. I strongly advice against using it. It will work much better if you compile Linpac yourself following these commands:
cd /tmp
mkdir Linpac
cd Linpac
git clone https://git.code.sf.net/p/linpac/linpac linpac-linpac
cd linpac-linpac
git checkout develop
autoreconf --install
./configure --prefix=/usr
make -j8
sudo /bin/mkdir -p "/usr/share/linpac/contrib"
sudo /bin/mkdir -p "/usr/share/doc/linpac/czech"
sudo /bin/mkdir -p "/usr/share/linpac/macro/cz"
sudo /bin/mkdir -p "/usr/libexec/linpac"
# Note that the following 4 lines are a single command:
sudo checkinstall --pkgname linpac --pkgversion 0.28 --pkgrelease 1 \
--pkggroup hamradio --pkgsource https://sourceforge.net/projects/linpac/files/LinPac/ \
--maintainer ki6zhdattrinityos.com --provides linpac \
--requires libax25,ax25-apps,ax25-tools,libncurses6 make install
After running the last command, follow the command prompts to complete the installation. Essentially press Y (Yes) if you don't get any errors.


Step 4. Configure LinPac
Most of the configuration for LinPac will be done in the first launch. Before you can lauinch it, you need to execute the following instructions:
sudo chmod 4755 /usr/bin/listen
sudo mkdir -p /var/ax25/mail
sudo chown $USER /var/ax25/mail

Step 5. Start Direwolf and attach a AX.25 port
Considering that you have followed the instructions to install and configure Direwolf from this other post, you can now safely start Direwolf, AX25 and LinPac. The order of the following commands is critical.

In a new terminal, type:
sudo direwolf -t 0 -p
Output from the command above

In yet another terminal, type:
sudo kissattach /tmp/kisstnc vhfdrop
sudo kissparms -c 1 -p vhfdrop
sudo mheardd
sudo axlisten -archt
You will need to execute these 6 lines every time you want to use LinPac. Maybe you want to consider creating a shell script file to launch all of them together.

Step 6. Launch LinPac
Now, onto LinPac. Just typeAnd answer the following questions:
  • Callsign without SSID. In my case M0PQA
  • Home BBS callsign. In my case: M0PQA-1
  • Name of the port to connect to: vhfdrop (this is the same name that you added to the end of the ax25ports before)
  • Digipeaters used to connect: None. Just hit Enter.
  • Full hierarchical address will depend on your region. I'm using #32.GBR.EURO
At this point LinPac is ready to use! Just try your first connection with this command (yes, the : is a part of the command in this case).
:C MB7NCR
MB7NCR is my regional server, managed expertly by Paul G4APL and Ann Lewis G7BSF. Their website is www.theskywaves.net, and you can find a plethora of information about Packet Radio and AX.25 in there. Big thanks to Paul for all his patience with noobs.

If connected, you will get a prompt. Use :D (DISCONNECT) to disconnect when you are done. To exit LinPac, use ALT+X.

LinPac screen once launched

And that's it. You are now ready to connect to other stations using Packet Radio from your Raspberry Pi, without any additional hardware.

As usual, leave a comment below, or drop me a note over email, Instagram or Twitter, in case you encounter any issues.

Comments

  1. Very detailed one. I will try my hands on it. Cheers. M6KNB/VU3KNB

    ReplyDelete
  2. Thank you. Let me know if it works for you.
    73 de M0PQA

    ReplyDelete

Post a Comment

Popular posts from this blog

Making APRS work on the AnyTone AT-D878UV

Creating a DMR codeplug for the AnyTone AT-D878UV

Setting up APRS on the Raspberri Pi