Turning a Raspberry Pi 2 into a packet station

March 31, 2016

I keep thinking it’s a good idea for emergency communications to have a packet station. Since I’m cheap, I didn’t want to get extra hardware – instead I wanted to use what I had. Luckily, Dire Wolf is better than any hardware packet decoder out there. Here’s how I got a working packet station on a Pi 2 running Raspbian Jessie Lite.

  1. Connect the radio to the Pi. In my case, I had a spare Signalink SL1+ hanging around which made things easier. I  bought a Syba CMedia USB sound card to talk from the Pi to the Signalink, and a Kenwood speaker mic cable to talk from the Signalink to the radio. Here’s a useful hint: the diameter of the wires in the speaker mic cable are roughly the same as the diameter of the wires in regular Ethernet cable – meaning that you can (if you’re careful) strip the outer jacket, put the inner wires in the right places of an RJ-45 connector and crimp direct to them with no soldering at all.
  2. Download and build Dire Wolf. Instructions for doing so on a Pi are here. I mounted my home directory on a networked drive to make life easier.
  3. Configure Dire Wolf with your callsign (I used the SSID -15 after my call) and sound card. Be sure to avoid the “# ADEVICE – plughw:1,0” line – it looks a lot like the correct “ADEVICE  plughw:1,0” line, but takes input from stdin instead of the sound card.
  4. Run “direwolf” and tune the radio to 144.390 (APRS). Make sure you’re decoding packets. You might have to go to alsamixer and adjust input/output. Mine ended up being 51 for speaker, 29 and 12 for mic. Also adjust the radio volume so it’s not too high or too low. (Hit F6 to get your sound card, then F5 to see all devices. I’m not sure which mic I was using; I had two – a stereo and a mono one. The mono one was 29, the stereo one was 12.) It’s probably a good idea to turn off the squelch on the radio as well.
  5. sudo apt-get install ax25-tools ax25-apps
  6. Edit /etc/ax25/axports and set one line to:
    vhf   mycall-15 1200 255 2 VHF link (1200 bps)
  7. Make sure all the other lines in axports have # in front of them (it doesn’t like blank lines).
  8. Run “direwolf -p” to get the KISS port. It will show up as something like /dev/pts/2. Once it’s running, move to another terminal window.
  9. Change frequency to the freq that you’re going to use.
  10. sudo /usr/sbin/kissattach /dev/pts/2 vhf (your IP address in AMPR 44.0.0.0)
  11. sudo /usr/sbin/kissparms -p vhf -t 200 -s 20 -r 64 -l 50 -f n
    These parameters took a little tweaking. If the transmit delay (-t) was too big, things timed out. If it was too small, things stepped on each other. I had to adjust transmit tail delay as well (-l). I found this page useful for some values.
  12. sudo route del -net 44.0.0.0 netmask 255.0.0.0
    (because I’d set up a route beforehand and needed to nuke it)
  13. sudo /sbin/route add -net 44.0.0.0 netmask 255.0.0.0 dev ax0
  14. ping -i 10 (someone else’s IP who also has a machine on the AMPR 44.0.0.0 net)
  15. Assuming that works, you might want to apt-get install telnet telnetd talk talkd and try to log into your friend’s machine or have your friend log into yours.
  16. Last but not least: I ran into problems with arp. I increased the arp timeout in /etc/sysctl.d/local.conf:net.ipv4.neigh.default.base_reachable_time_ms=1200000

Setting up Direwolf/Xastir on a Raspberry Pi

March 22, 2015

A long time ago I set up Soundmodem for Ubuntu. Recently, I tried setting up an igate using WB2OSZ’s Direwolf instead. Things are much nicer these days.

The Direwolf site includes a very nice guide to setting up a Raspberry Pi as an igate, so I won’t go over it here. Instead, this is just to record the steps I took to set up my Raspberry Pi v2 as an igate server.

1. Set up the Raspberry Pi to run Raspbian
2. Follow along with the setup guide:

sudo apt-get remove --purge pulseaudio # I didn't need to do this since it wasn't installed, but better safe than sorry
sudo apt-get install libasound2-dev xastir # Note that I'm installing xastir at the same time - this is different from the direwolf guide
cd ~
git clone https://www.github.com/wb2osz/direwolf
cd direwolf
git checkout 1.2
make
sudo make install
make install-rpi
make install-conf

Next, make sure the sound card is plugged into USB (I used the bottom slot). When I plugged it in, the system rebooted, so it’s probably smart to shut down before plugging the sound card in. For a sound card, I used the Syba SD-CM-UAUD USB Stereo Audio Adapter, C-Media Chipset from Amazon.

From there, run
aplay -l
to see:
card 1: Device [C-Media USB Audio Device], device 0: USB Audio [USB Audio]

Now I know the device is card 1 device 0. We’re almost ready to edit direwolf.conf. First, though – something that wasn’t documented on the Direwolf site. Igates need a secret code so they can log into the tier 2 servers. It’s based on your callsign, and there’s a utility called callpass in Xastir that will compute it for you.

callpass {my-real-call}

This gives you a 5 or 6 digit integer that you should remember. I’ll call it {my-code}.

Now edit direwolf.conf:

  1. uncomment ADEVICE plughw:1,0 – if you got a different number from aplay above, you might have to modify it.
  2. change MYCALL NOCALL to MYCALL {my-real-call}-10. I used -10 because that’s the APRS SSID for igates. (APRS SSIDs are documented here.) In the direwolf.conf that I got, the NOCALL had a ^J after it; I had to take that out
  3. uncomment IGSERVER noam.aprs2.net (maybe use a different server if you’re not in North America)
  4. uncomment IGLOGIN and change it to IGLOGIN {my-real-call} {my code}
  5. direwolf

Yay, you’re igating. But what’s around? Set up Xastir for that:

  1. xastir
  2. In the first menu that comes up, set your callsign to {my-real-call}-10 and (if desired) set your lat/long/position ambiguity
  3. Interface -> Interface Control, Add, Networked AGWPE, Add. Leave Pass-code blank, save and Start. Now you’re getting APRS from over the air displayed on your Xastir maps.
  4. Not enough for you? Interface -> Interface Control, Add, Internet Server, Add. Set Pass-code to {my-code}, save and Start. Now you’re getting APRS from the network as well.
  5. Want to see it on maps? I wasn’t able to get all the maps going, but things worked when I picked Maps -> Map Chooser and selected only Online/osm_tiled_mapnik.geo and worldhi.map.

Setting up soundmodem on Ubuntu 10.04

June 29, 2011

After a long delay, I finally decided to upgrade to 10.04 LTS and get soundmodem running again.

Luckily, there was help this time. I started with my config, and merged with this post:
ubuntuforums.org/showthread.php?p=10864691

Here’s the config I ended up using:

Configuration: AX.25
IO:
Mode: soundcard
Audio Driver: /dev/dsp
Half Duplex: selected
PTT Driver: none

Channel Access:
TxDelay: 150
Slot Time: 100
P-Persistence: 40
Full Duplex: not selected
TxTail: 10

Channel 0:
Modulator:
Mode: afsk
Bits/s: 1200
Freq 0: 1200
Freq 1: 2200
Differential: selected

Demodulator:
Mode: afsk
Bits/s: 1200
Freq 0: 1200
Freq 1: 2200
Differential: selected

Packet IO:
Mode: MKISS
Interface: sm0
Callsign: mycall
IP address: 10.0.0.1
Network mask: 255.255.255.0
Broadcast addr: 10.0.0.255

I also set up /etc/ax25/axports to have:

sm0 mycall 1200 255 7 144.39 APRS (1200 bps)

Finally, I made sure Avahi was set to ignore sm0. This is easier than it was prevously – now you just add:

deny-interfaces=sm0

to /etc/avahi/avahi-daemon.conf

Once that’s done, don’t forget to chmod 4755 /usr/bin/xastir so it can open sm0 and things are good.


Compiling soundmodem-0.14 on Ubuntu 9.10

November 21, 2009

The soundmodem that ships with Ubuntu 9.10 is not the latest. The latest is available here:

http://www.baycom.org/~tom/ham/soundmodem/

In order to compile it, you need to install a bunch of development packages. Here’s what I did:

sudo aptitude install libasound2-dev
sudo aptitude install libxml2-dev
sudo aptitude install libgtk2.0-dev 
sudo aptitude install libaudiofile-dev

Also, if you don’t have the compiler already you’ll need:

sudo aptitude install g++

Then:

tar xzvf soundmodem-0.14.tar.gz
cd soundmodem-0.14
sh ./configure
make

To test it, go to the configapp/src directory and run

sudo ./soundmodemconfig

to set up the configuration. Finally, go to the soundcard directory and run:

sudo ./soundmodem -v5

Assuming you’ve configured everything correctly, you should see something like:

sm[10093]: mkiss: ifname sm0 mtu 256 hwaddr CALLSIGN-0 ipaddr 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255
sm[10093]: unknown node "text"
ALSA: Using sample rate 9600, sample format 2, significant bits 16, buffer size 4800, period size 150
ALSA: Using sample rate 9600, sample format 2, significant bits 16, buffer size 4800, period size 150
sm[10093]: audio: starting "plughw:0,0"

In a different terminal, you can then ifconfig sm0 to see that it’s there.


Stopping the squeaks with soundmodem as ax.25

October 17, 2009

I tried to set up soundmodem as an AX.25 device in order to run xastir on my machine. Unfortunately, Ubuntu by default has a bunch of services installed that prevent this. (Not so much prevent it as try to shove 100k of data through the 1200-baud soundmodem, which kills it and drives you nutty if the audio is turned up.)

Here’s what I did to get around this:

1. Change /etc/samba/smb.conf to include only the eth0 interface.

interface = eth0

2. Go into /etc/cups/cupsd.conf and turn off broadcasting (instructions here):

# Browsing was on.
#Browsing On
Browsing Off
BrowseInterval 0
# end trying to get around sm0 problem

3. Stop the AVAHI daemon by moving /etc/rc5.d/S18avahi-daemon to /etc/rc5.d/K18avahi-daemon and running /etc/rc5.d/K18avahi-daemon stop

Note that on Ubuntu 9.10, avahi has been moved into Upstart. Stop it with

sudo stop avahi-daemon

then edit /etc/init/avahi-daemon.conf and comment out the

#start on (filesystem
#         and started dbus)

and

#respawn