Winlink under Linux

Winlink is an email service that allows people to send and receive email from anywhere in the world using HF radio. I wanted to try it out but on Linux, and without using WINE.
To do this, there are three components.

The Winlink client

Pat is a cross-platform CLI and web-based Winlink client. It doesn't talk to the radio, or modulate/demodulate audio. For that it delegates to other software.
Hamlib provides the functionality to change frequency
Ardop does the actual modulation/demodulation


Winlink gateways support quite a few protocols that can be used to connect. Some require expensive proprietary hardware, but the one that is of most interest to Linux users will probably be Ardop.
This is an open standard radio protocol.
It is apparently open source, but I couldn't find the Linux source for it anywhere, so I grabbed the binary from https://www.cantab.net/users/john.wiseman/Downloads/Beta/

Install and configure Pat

Install Pat from https://getpat.io. Run pat configure for it to provide an example config file which should live in ~/.wl2k/config.json
Configure the hamlib_rigs section

"hamlib_rigs": {"your_rig_name": {"address": "localhost:4532", "network": "tcp"}},

You also need to configure Pat to use Ardop:

  "ardop": {
    "addr": "localhost:8515",
    "arq_bandwidth": {
      "Forced": false,
      "Max": 500
    "rig": "your_rig_name",
    "ptt_ctrl": true,
    "beacon_interval": 0,
    "cwid_enabled": true

Run it all

#You need to find out what number corresponds to your radio's soundcard. Run aplay -l and arecord -l
./ardopc_64 8515 plughw:2,0 plughw:2,0
# Change 237 for the id for your radio as listed in rigctl -l
rigctld -vv -m 237 -r /dev/ttyUSB0 -s 115200
pat http

Now, visiting should give you the web interface to Pat.

Sending and receiving email

In order to send or receive email, you need to connect to a gateway. Go to https://winlink.org/RMSChannels, and tick the Ardop box. Hopefully, you should see some gateways near you. Clicking on one of them will show you their callsign, the bands they support, and what frequencies they're listening on.
Select Connect in Pat, select Ardop, fill in the callsign and frequency, and click connect.
Hamlib should change the frequency of your radio, and Ardop should start keying between TX and RX and transmitting.
What happens next? I'm not sure. I haven't managed to connect to a gateway yet :)