Setup hamlib

Fri, Jan 6, 2017

This is part 2 of my series about migrating my operating routine to Linux. This edition will focus on getting hamlib installed and minimally configured.

Key equipment:

  • Yaesu FT-991
  • laptop running Ubuntu linux (16.10 Yakkety)
  • USB cable

Before we get into the computer software side of things, the FT-991 connectivity settings need to be configured. As I mentioned in the previous entry, I’m coming from Ham Radio Deluxe, and I used this document to configure my radio to talk to HRD. I’ve also done some configuration to work with WSJT-X based one this page. With that as a starting point, below are the non-default settings I’ve got on my FT-991 coming into this… I have to confess - since I was running WSJT-X in a configuration that piggy-backed on HRS’s local control server, I’m not entirely sure how necessary some of these settings are, and whether we’ll need to update any of them.

Radio settings

These were the settings I was running in my previous setup, recorded for reference:

  • 031 - CAT RATE - 38400bps
  • 060 - PC KEYING - DTR
  • 062 - DATA MODE - OTHER
  • 064 - OTHER DISP (SSB) - 1000Hz
  • 065 - OTHER SHIFT (SSH) - 1000Hz
  • 066 - DATA LCUT FREQ - OFF
  • 068 - DATE HCUT FREQ - OFF
  • 071 - DATA PTT SELECT - RTS
  • 072 - DATA PORT SELECT - USB
  • 110 - SSB PTT SELECT - RTS
  • 111 - SSB PORT SELECT - USB

I set everything back to its default and intend to rebuild the config as needed. Here’s what we need to get started:

  • 031 - CAT RATE - 38400bps - This is the highest setting on the FT-991, faster’s better, right?

Installing Hamlib

OK, so let’s get hamlib installed along with some basic tools that use hamlib. This is pretty simple in Ubuntu as there are packages ready to install. I pulled down the libhamlib-utils package, which will pull in its dependencies, including the hamlib package, libhamlib2:

$ sudo apt-get install libhamlib-utils

Once that’s installed you should be able to start using some of the tools to further sleuth the needed config. First let’s find the radio definition entry we need in hamlib. rigctl -l will list all supported radio definitions- it’s a long list so we’ll grep for our model:

$ rigctl -l | grep -i ft-991

   135  Yaesu                  FT-991                  0.22.4          Beta

The first column, 135, is the definition entry number for the FT-991. Now we’ll use that to tell hamlib which radio its talking to. But we need some more info too - namely the devices we’ll use to talk to the radio over the USB connection…

Connecting the radio

Before you connect the radio, go ahead and open a terminal and run dmesg. Leave this terminal open for later comparison.

Now, with your radio AND radio power supply turned off, go ahead and connect the USB cable (NOTE, in the future, you won’t need to have everything off, this is just to watch the various USB devices come online. Once you turn your power supply on you computer will see the radio’s USB controller). At this point you can run dmesg again to confirm nothing’s changed yet.

Now turn on your radio’s power supply. Run dmesg again, and you should see the radio’s usb bridge and other devices connect. Look for the lines that tell you where the virtual serial ports are attached. It’s probably ttyUSB0 and ttyUSB1; the dmesg lines look like:

usb 1-2.1: cp210x converter now attached to ttyUSB0 … usb 1-2.1: cp210x converter now attached to ttyUSB1

These will be the devices we use to talk to the radio.

You may also have noticed in dmesg that another USB device came online - it’s the USB audio in/out device that your radio presents. We don’t need that right now, but it’s worth noting for later.

OK, so now you need to make sure your system user has privileges to access the ttyUSB devices that just came online. If you ls -l /dev/ttyUSB* you should see:

crw-rw—- 1 root dialout 188, 0 Jan 7 11:39 /dev/ttyUSB0 crw-rw—- 1 root dialout 188, 1 Jan 7 11:39 /dev/ttyUSB1

… at least that’s what I see on an Ubuntu system. Now you’ll want to add your user to the ‘dailout’ group so you can have read/write access to the devices: sudo usermod -a -G dialout username where username is your actual username.

So now go ahead and turn on the radio and let’s see if we can connect to it:

$ rigctl -m 135 -r /dev/ttyUSB0 -s 38400 -v

If the connection was successful you should find yourself at a “Rig command:” prompt. If you got an error, such as “Communication timed out” double check that everything is connected and your rig is on. If that all looks good, try using the other ttyUSB port (1 if you tried 0).

Now that you’re connected you can try issuing some of the rigctl commands. Check out man rigctl for a list of the available commands. If you just want a quick one to convince yourself you’re actually connected to the radio, just type ‘f’ (get_freq) at the Rig command prompt - this should return the freqency that your radio is currently set to. Once you’re satisfied, ctrl-C will exit rigctl.

Graphical control interface

‘grig’ is a pretty basic gui for hamlib. Fire it up using the same options we used for rigctl:

grig -m 135 -r /dev/ttyUSB0 -s 38400

Note, at this point I’m not trying to setup PTT, powercontrol, or other functionality. If you care about these things, you might look into additional options for grig. I’ll get to keying the rig from the computer when we get to digital modes (and setting up rigctld).

I find that there’s a pretty big delay (~5 seconds) in commands/changes made in grig and when those changes take effect on my radio. I’ve tried different baud rate settings to no avail.

Regardless of the performance issues, we’ve now got a linux system communicating with the FT-991. This is a starting point. I’ll cover additional software setup in my next entry in this series.

That’s it for now.

Series: Moving ham ops to Linux