Linux and Amateur Radio

rigctl

The hamlib libraries allow command-line control of the transceiver via the rigctl programme. Not all of the CAT controls for the FT-991(A) are available via rigctl, so you will find applications such as WSJT-X relying on their own internal libraries. You can still have some fun with the commands. Here is a non-exhaustive list of some of the commands I have played with:

Power On

rigctl -m 135 -r /dev/ttyUSB0 set_powerstat 1


Power Off

rigctl -m 135 -r /dev/ttyUSB0 set_powerstat 0


Check Power Status

rigctl -m 135 -r /dev/ttyUSB0 get_powerstat


Set: Upper Side Band; 2400 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked

rigctl -m 135 -r /dev/ttyUSB0 M USB 2400 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.000000 L PREAMP 10 U LOCK 1


Set: Lower Side Band; 2400 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked

rigctl -m 135 -r /dev/ttyUSB0 M LSB 2400 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.000000 L PREAMP 10 U LOCK 1


Set: Amplitude Modulation; 6000 Hertz bandwidth; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked

rigctl -m 135 -r /dev/ttyUSB0 M AM 6000 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.392157 L SQL 0.039216 L PREAMP 10 U LOCK 1


Set: Frequency Modulation; +/- 2.5 kHz deviation; on 28.5 MHz; 5 Watts RF power; Mic gain 100; Squelch 0; AMP1; VFO dial locked
(FM mode throws an error and will not currently set the bandwidth. It can be read from the radio, but not set correctly.)

rigctl -m 135 -r /dev/ttyUSB0 M FM 9000 F 28500000 L RFPOWER 0.019608 L MICGAIN 0.117647 L SQL 0.039216 L PREAMP 10 U LOCK 1


Enable Noise Blanker

rigctl -m 135 -r /dev/ttyUSB0 U NB 1


Disable Noise Blanker

rigctl -m 135 -r /dev/ttyUSB0 U NB 0


Enable VFO dial-lock

rigctl -m 135 -r /dev/ttyUSB0 U LOCK 1


Disable VFO dial-lock

rigctl -m 135 -r /dev/ttyUSB0 U LOCK 0


Intercept Point Optimization

rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 0


AMP 1 (10 dB)

rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 10


AMP 2 (20 dB)

rigctl -m 135 -r /dev/ttyUSB0 L PREAMP 20


Desktop shortcuts

It is possible to create desktop shortcuts (or shortcuts as icons in a folder) to send some of the above commands to the FT-991(A). I use the MATE desktop on Rocky Linux. You may need to vary the details below according to your Linux desktop environment. This example uses the grig application (or just the png file in the right path) to create an icon shortcut to set CEPT Citizens' Band channel 1:

#!/usr/bin/env xdg-open

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=/usr/share/pixmaps/grig/ic910.png
Name[en_GB]=CEPT01
Exec=rigctl -m 135 -r /dev/ttyUSB0 M FM 9000 F 26965000 L RFPOWER 0.019608 L MICGAIN 0.117647 L SQL 0.039216 L PREAMP 10 U LOCK 1
Comment[en_GB]=CEPT01
Name=CEPT01
Comment=CEPT01
Icon=/usr/share/pixmaps/grig/ic910.png

The above sits in a files called CEPT01.desktop with 755 permissions.


Scripting for fun

After some research and investigation, I found the correct device details to route the output of aplay to the FT-991(A). So here, just for fun, is an example script that can key the transmitter (in various modes) and play a sound.

#!/bin/bash
#
# Script to transmit audio with the FT-991A
#
# Last updated: 1st September 2019

#sleep 52

# DATA-FM, 2.5 kHz deviation, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 077 to USB.
#
rigctl -m 135 -r /dev/ttyUSB0 M PKTFM 9000 F 145212500 L RFPOWER 0.019608 L SQL 0.039216 U LOCK 1

# DATA-FM, 2.5 kHz deviation, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 077 to USB.
#
#rigctl -m 135 -r /dev/ttyUSB0 M PKTFM 9000 F 29150000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1

# DATA-USB, 2.4 kHz bandwidth, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 072 to USB.
#
#rigctl -m 135 -r /dev/ttyUSB0 M PKTUSB 2400 F 28500000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1

# AM, 6 kHz bandwidth, 5 Watts, Squelch 10, AMP1, VFO dial locked.
# Set menu 045 to REAR and 048 to USB
#
#rigctl -m 135 -r /dev/ttyUSB0 M AM 6000 F 28500000 L RFPOWER 0.019608 L SQL 0.039216 L PREAMP 10 U LOCK 1


# Enable PTT
#
rigctl -m 135 -r /dev/ttyUSB0 T 1

# Play audio
#
aplay -q -Dplughw:2 pips.wav

# Disable PTT
#
rigctl -m 135 -r /dev/ttyUSB0 T 0

exit 0

What does the script do? The commented-out sleep command allows the script to be called from the at scheduler, and is only there as part of my experimentation to play out the Greenwich style "pips" as heard on BBC Radio. at cannot handle seconds, so you call the script at, say 11:59, and the pips.wav file should be played out with the final long pip signalling 12:00. Timing may vary based on your computer's clock and the serial speed set in your radio (I use 38400 bps).

Each of the four rigctl examples offer a range of modes and the necessary settings in the FT-991(A). Only one rigctl line needs to be un-commented, else your radio will change modes four times whilst the script runs! The AM mode completely disables the front-panel microphone input. AM is not intended for data-modes, hence the lack of options.

The next line enables the PTT. aplay now plays the selected WAV file through the USB CODEC device found in the FT-991(A). You may have to run aplay -l to see the number your USB CODEC interface and adjust the plughw: accordingly. Multiple aplay lines can be added to play an array of WAV files (for example, presenting a news bulletin).

The final lines disable the PTT and exits the script.


What are those odd RF and SQL numbers?

At present, hamlib appears to be offering integer values for many of the settings instead of the simplified values present on the front panel of the radio. I am open to suggestions if anyone has found a work-around. I really do not want to have to create a look-up table to convert the front panel figures!


modem-manager

Before I describe how to use the Yaesu FT-991(A) with Linux, there is one gotcha to be aware of. In most Linux installations that use a GUI and NetworkManager, there is a little background application called modem-manager. It is started whenever a modem-type device is detected so NetworkManager can see if it can/needs to control it, and offer it as a means of communication. modem-manager scans serial ports, such as the one found inside the FT-991(A), with commands that will cause the radio to lock into transmit mode. When this happens, you have no choice but to power off the radio.

In Rocky Linux, you can disable the ModemManager with the command: sudo systemctl disable ModemManager. This command may work for other Linux distributions. For others, you may need to delete /usr/share/dbus-1/system-services/org.freedesktop.ModemManager.service or move the file to, say /root - in case you need to put it back. Always back-up your system in case these changes cause major issues!


Permissions

In order to run some of the commands featured on this website, you will need to give yourself sudo access, and add yourself to the dialout group. This applies to the primary machine, and any virtual machines running Rocky Linux / Fedora. If you install VirtualBox to run virtualised images, you will also need to add your uid to the vboxusers group.

Open a terminal window and enter: su - to become super-user. You will be prompted for your root password.

Add yourself to the wheel and dialout groups with the following command: usermod -G wheel,dialout uid
- where uid is your id as found from the command: whoami.

In the same terminal window as above, edit /etc/sudoers and un-comment either of the %wheel options, depending on whether you want to input your password each time you run a sudo command, or not. I prefer not, so I un-comment: %wheel    ALL=(ALL)    NOPASSWD: ALL

You will need to log-out and log-in again for the above changes to take effect.


Page updated: 15th February 2023

Home  |  Tips  |  Linux  |  fldigi  |  APRS  |  QSSTV  |  WSJT-X  |  Blue Ham  |  Projects  |  PSU  |  Repairs  |  Downloads  |  Links
SSTV Gallery  |  eQSL Gallery  |  MQ0PLT eQSL Gallery  |  MQ0PLT eQSL Awards