Sunday, May 20, 2018

Raspberry Pi for Amateur Radio

AP2AUM Raspberry Pi for Amateur Radio


Interfacing a UV5R Baofeng with a Raspberry PI 3 running Svxlink.  Primary use is for an Echolink node connecting to a local repeater. Primary goal was to NOT use VOX to trigger the push to talk but to use a COS or Carrier Operated Switch. Svxlink is a powerful software program that can be used as a repeater controller, a simplex link. Supports networked multiple receivers and transmitters. It also has an Echolink module. Echolink is a popular system that allows two or more nodes to connect over the internet.

IMG 20180510 WA0019

Call             Node        Location/Connection

AP2AUM-R    995127    [Svx] 144.825, IsbPak

System requirements:

  • Reliable internet connection
  • Raspberry Pi
  • Compatable USB-sound-card
  • Ground-loop isolator filters or audio transformers (for mic/speaker interface)
  • Some circuitry to interface PTT from 3V TTL GPIO on the Pi to whatever works your radio
  • Ideally, also some "carrier-detect" output from the radio, and a 3V level shifter circuit to tell the Pi when a signal is coming in (VOX type detection is possible but less reliable)

Installation instruction for Raspbian

This instruction explains how to install SvxLink on a Raspberry Pi, with precompiled packages from the official Raspbian software repository. It does not cover all parts of the installation and configuration in detail, but is supposed to be easy to understand with limited knowledge and experience of Linux.

Note: Please browse through the instruction quickly, before you begin.

Download and install image

Download the image, Raspbian Stretch:

Details: The official Raspbian installation instruction can be found here.

Download the image installation program "Etcher" and install the image on the card:

Before inserting the SD-card in the Raspberry, enable ssh. Add a file named "ssh" in the root of the SD-card.

Insert the SD-card and boot the Raspberry. The Raspberry PI will start with DHCP enabled (automatically request an ip-address from your local router). Find the ip-address of the raspberry pi, and logon. Details:

Login and password

If you have a monitor and keyboard connected to your Raspberry, just logon at the prompt after it has started. You can also connect via ssh, without a monitor and keyboard connected. Good tools for SSH on Windows are: Putty or MobaXterm

username: pi

password: raspberry

Change the default password "raspberry" to something else, the command passwd will change the password:


Set static ip-address

Optionally set a static ip address by editing the dhcpcd.conf file. See the example in the bottom of the file. You can use "nano" editor. To save and exit the editor, press ctrl-x and answer Y to save:

sudo nano /etc/dhcpcd.conf
# Example static IP configuration:
interface eth0
static ip_address=
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=
static domain_name_servers=

Now is a good time to reboot your Raspberry.

sudo reboot

If you can not reconnect to the new static ip address, something is wrong. Try power off/on, or connect a monitor.

The most current version of the SvxLink packages for Raspbian is called 17.12.1-2. The packages is not available directly in in the Raspbian Stretch image, but in the "testing" software repository (Buster release). To install this release, we temporarily add the Buster software repository and install SvxLink.

echo 'deb buster main' | sudo tee /etc/apt/sources.list.d/svxlink.list
sudo apt-get update

Note: Do NOT upgrade your complete system. We only want the SvxLink applications from the "buster" release!

Now install the svxlink-server package. The apt-get command will automatically select other packages needed for SvxLink to run.

sudo apt-get -t buster install svxlink-server

Now remove the buster repository again.

sudo rm /etc/apt/sources.list.d/svxlink.list

Next install the English sounds for SvxLink with the following commands.

cd /usr/share/svxlink/sounds/
sudo wget
sudo tar xvjf svxlink-sounds-en_US-heather-16k-13.12.tar.bz2
sudo ln -s en_US-heather-16k en_US

It is now time to do some basic tests of the SvxLink installation. Do NOT connect any extra USB-sound card, just connect a speaker to the 3.5mm audio output. The Speaker will be our TX. Since the Raspberry does not have a Microphone input, we need to disable the default RX (RX=NONE).

Edit the main SvxLink configuration file:

sudo nano /etc/svxlink/svxlink.conf

In the SimplexLogic section, change the RX to NONE, and set your CALLSIGN.


SvxLink is normally started from the a start script, but as a test it can be started on the command prompt. We start the program as the svxlink user. You will see some errors on missing configuration for echolink, this can be configured later.

sudo -u svxlink svxlink
pi@raspberrypi:/usr/share/svxlink/sounds $ sudo -u svxlink svxlink
SvxLink v1.5.99.17 Copyright (C) 2003-2017 Tobias Blomberg / SM0SVX
SvxLink comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it in accordance with the terms and conditions in the
GNU GPL (General Public License) version 2 or later.
Using configuration file: /etc/svxlink/svxlink.conf
--- Using sample rate 48000Hz
Starting logic: SimplexLogic
Loading RX: NONE
Loading TX: Tx1
Loading module "ModuleHelp" into logic "SimplexLogic"
      Found /usr/lib/arm-linux-gnueabihf/svxlink/
      Module Help v1.0.0 starting...
Loading module "ModuleParrot" into logic "SimplexLogic"
      Found /usr/lib/arm-linux-gnueabihf/svxlink/
      Module Parrot v1.1.1 starting...
Loading module "ModuleEchoLink" into logic "SimplexLogic"
      Found /usr/lib/arm-linux-gnueabihf/svxlink/
      Module EchoLink v1.3.99.1 starting...
*** ERROR: Please set the EchoLink callsign (ModuleEchoLink/CALLSIGN) to a real callsign
*** ERROR: Initialization failed for module ModuleEchoLink in logic SimplexLogic
Loading module "ModuleTclVoiceMail" into logic "SimplexLogic"
       Found /usr/lib/arm-linux-gnueabihf/svxlink/
      Module Tcl v1.0.1 starting...
SimplexLogic: Event handler script successfully loaded.

Enter *# on the keyboard, and you should hear your SimplexLogic identify itself in the speakers.

SimplexLogic: digit=*
SimplexLogic: digit=#
Tx1: Turning the transmitter ON
Tx1: Turning the transmitter OFF

Stop SvxLink by pressing ctrl-c. If the volume is too low, use alsamixer to increase the volume.


Congratulations! You have successfully installed SvxLink! Now the fun begins. You will need to configure svxlink to match your system setup.

You should read the Post installation stuff chapter.


GPIO Configuration

sudo gpasswd -a svxlink gpio

Before you make changes to the /etc/svxlink/gpio.conf, you should stop svxlink and stop the gpio setup.

sudo systemctl stop svxlink
sudo systemctl stop svxlink_gpio_setup

Below is an example how to configure gpio4 for PTT in /etc/svxlink/gpio.conf

Note: Also comment the three rows for GPIO_USER, GPIO_GROUP and GPIO_MODE.

# Space separated list of GPIO pins that point OUT and have an
# Active HIGH state (3.3v = ON, 0v = OFF)
# User that should own the GPIO device files
# Group for the GPIO device files
# File access mode for the GPIO device files

In the /etc/svxlink/svxlink.conf you should change the following lines in the [Tx1] section:


When ready, start svxlink (the svxlink_gpio_setup will be started automatically).

sudo systemctl start svxlink

Good to know

The normal way to start and stop SvxLink on Raspbian is via scripts.

sudo systemctl start svxlink
sudo systemctl stop svxlink

Monitor the system via the svxlink log.

tail -f /var/log/svxlink

All manuals are available from the command prompt.

man svxlink
man svxlink.conf


IMG 20180510 WA0020

Here is the interface that was built which works fine.  It expects the PTT control signal from the GPIO pin to go high (3v) to trigger the ptt output which grounds the PTT line from the UV5R.  And the COS signal to go hi (3v) from the RX when a signal is received. The output will also go hi when is connected to one of the GPIO pins on the Raspberry PI. The main take-away here is NO NEED to MODIFY the UV5R. This circuit can also be used to interface with a PC serial port *however* you might want to add a diode on the PTT input to prevent rs-232 negative voltages. And you don’t have to use 3.3v unless you are interfacing with logic that requires 3.3v.

Interface schematic Courtesy WB5HUP

UV5r Rev1 cropped

Pi3 B GPIO pinouts

raspberry pi circuit note fig2