Raspberry Pi & Soundmodem – It works!!

(Part 01)

Many months ago I was working on getting a Raspberry Pi working for APRS work. I was experiencing a ton of issues with getting soundmodem to decode aprs signals that were known to be good (ie. ideal recording played back as an MP3 file, no RF involved).

Most recently, I have managed to get the Raspberry Pi and soundmodem to play nicely with a USB soundcard (the Creative SB1140)! Finally some success – some of which I attribute to a more polished distribution.

In my previous attempts, I tried advanced commands such as setting the dwc_otg.speed=1 flag in (/boot/cmdline.txt) which did not solve the issue(s).

I installed a new image of the Wheezy Raspbian distro (2013-09-25-wheezy-raspbian.zip), and so a software update was in order. To facilitate the update, I logged into the shell and issued the following commands:

Raspberry Pi & Soundmodem – It works!!

sudo apt-get update
sudo apt-get upgrade

It should be noted that you do not need to connect the Raspberry Pi to an external display to complete this work – yes it may be easier, however, there is another way! You can connect to the Pi by using an SSH client such as Putty. All you need is the local IP address of the Pi (as a tip, log in to your router and look for the clients listed in the DHCP table).

Once the core operating system was updated, I installed some of the components which would be needed for operating an APRS gateway:

sudo apt-get install screen build-essential python-serial sqlite3 python-dev soundmodem libax25 libax25-dev ax25-tools ax25-apps libax25-dev

The above command downloads and installs ~47Mb of binaries and takes some time to complete. Once the desired software was installed, I had some fiddling to do with how the system recognizes the USB sound card.

To eliminate as many variables as possible, I told the system to ignore the on-board sound card (output only, so useless) by modifying /etc/modules as follows:

sudo vi /etc/modules

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with “#” are ignored.
# Parameters can be specified after the module name.
#snd-bcm2835
snd-usb-audio

Next, I modified /etc/asound.conf as follows:

sudo vi /etc/asound.conf

pcm.dmixer{
type    dmix
ipc_key 1024
slave   {
pcm     “hw:0,0″
period_time     0
period_size     1024
buffer_size     8192
rate    48000
}
bindings        {
0       0
1       1
}
}
pcm.asymed      {
type    asym
playback.pcm    “dmixer”
capture.pcm     “hw:0,0″
}
pcm.dsp0        {
type    plug
slave.pcm       “asymed”
}
pcm.!default    {
type    plug
slave.pcm       “asymed”
}
pcm.default     {
type    plug
slave.pcm       “asymed”
}
ctl.mixer0      {
type    hw
card    0
}

Next, a basic soundmodem configuration is established. This is the core of the software TNC so take some time to learn the ins and outs of this configuration file.

sudo vi /etc/ax25/soundmodem.conf

<?xml   version=”1.0″?>
<modem>
<configuration name=”AX25″>
<chaccess txdelay=”250″ slottime=”100″ ppersist=”40″ fulldup=”0″ txtail=”100″/>
<audio type=”alsa” device=”plughw:0,0″ halfdup=”1″ capturechannelmode=”Mono”/>
<ptt file=”none” hamlib_model=”” hamlib_params=”” gpio=”0″/>
<channel name=”sm0″><mod mode=”afsk” bps=”1200″ f0=”1200″ f1=”2200″ diffenc=”1″ inlv=”8″ fec=”1″ tunelen=”32″ synclen=”32″/>
<demod mode=”afsk” bps=”1200″ f0=”1200″ f1=”2200″ diffdec=”1″ inlv=”8″ fec=”3″ mintune=”16″ minsync=”16″/>
<pkt mode=”MKISS” ifname=”sm0″ hwaddr=”NOCALL-05″ ip=”44.128.0.2″ netmask=”255.255.255.0″ broadcast=”44.128.0.255″ file=”/dev/soundmodem0″ unlink=”1″/>
</channel>
</configuration>
</modem>

Be sure to replace the NOCALL-05 with your own call-sign to ensure that the APRS packets conform to regulations! The txdelay=250 and txtail=100 are to add a time-delay for VOX operation – these values could be tweaked if you are using a hardware PTT.

Speaking of hardware PTT – it is a somewhat common problem when working with a Pi that a USB to serial adapter may malfunction. It would be advisable to use one of the GPIO pins of the Pi in order to toggle the PTT for your radio.

I may use a GPIO to serial adapter which was purchased on eBay for less than the cost of the materials. It is simple enough to use the GPIO pin directly, just be aware that the Pi is not able to source a large current so it would be prudent to use a transistor to drive an optocoupler for galvanic isolation of the Pi from the radio.

Edit the axports file to include a statement for soundmodem and your callsign(with SSID – ie. -05). This file assists in setting up an AX.25 port which acts as a network adapter. We will use this functionality later to produce AX.25 packets which we can use / listen to in order to verify functionality and to set output levels.

sudo vi /etc/ax25/axports

# /etc/ax25/axports
#
# The format of this file is:
#
# name callsign speed paclen window description
#
sm0     VE3BUX-05       1200    255     2       VHF APRS (1200 bps)
#1      OH2BNS-1        1200    255     2       144.675 MHz (1200  bps)
#2      OH2BNS-9        38400   255     7       TNOS/Linux  (38400 bps)

Next I modified the alsa-base.conf file found in /etc/modprobe.d so that it was as follows:

sudo vi /etc/modprobe.d/alsa-base.conf

Raspberry Pi & Soundmodem – It works!! Board# autoloader aliases

install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe –ignore-install snd && { /sbin/modprobe –quiet snd-ioctl32 ; /sbin/modprobe –quiet snd-seq ; : ; }
install snd-rawmidi /sbin/modprobe –ignore-install snd-rawmidi && { /sbin/modprobe –quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe –ignore-install snd-emu10k1 && { /sbin/modprobe –quiet snd-emu10k1-synth ; : ; }
options snd slots=snd_bcm2835,snd_usb_audio
options snd_usb_audio index=0
#options snd_bcm2835 index=-2
# I commented the above line out as I found it was ineffective at blocking the snd_bcm2835 from being loaded
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2

The intent in the alsa-base.conf file is to preemptively load the USB sound card, blocking the built-in one from taking index=0 (the default device).

So by this point, all should be going well and your system will likely work just fine. We can now start testing by recording and playing back audio handled by the USB sound card. For my initial tests, I simply plugged the USB sound card’s mic jack into the speaker output of my computer and played some audio.

 

For more detail: Raspberry Pi & Soundmodem – It works!!

Scroll to Top
Scroll to Top