APRS – Raspberry Pi Virtual TNC

Raspberry Pi IGate/Digipeater Instructions

Today we’re going to build an ultra low draw Digipeater, IGate, or APRS Beacon. In its current form, this is best suited to a base station environment because it has no GPS. With no GPS, you tell the system where you’re at so this isn’t something for your car. You can add GPS to the Raspberry Pi, but that’s another tutorial for another day. This setup can also run with or without a monitor. This means you could have it attached to a screen in your ham shack, tucked away by itself in a closet out of sight, or running in a box at a special event checkpoint.

Depending on what you have around the house (radio, spare SD card, USB cable, keyboard, mouse) you could build this for around $40.

Assemble the pieces:

1. Raspberry Pi Model A or B. Either will work, but I’d recommend B for the Ethernet jack and the extra USB. $25-35

2. A video display that will take HDMI or RCA. I recommend HDMI because it can be hard to read small computer text on a standard definition TV.

3. A HDMI or RCA cable.

4. A micro B USB cable for charging (the same type used for Android phones) and a quality 5V power adapter. Make sure what your using is rated for 5V. Pushing less than that can cause your Raspberry Pi to exhibit erratic behavior.

6. A USB sound card. I tried a couple different cheap ones along the way. The only one that got me the 44100 audio sampling that I needed was this one from Adafruit.com. Plus, it’s one of the cheapest at $4.99. http://www.adafruit.com/product/1475

7. Though not required, I’d recommend getting a case for your Pi. I tried building a few different things. In the end, getting a well designed case was just better. There are several designs on Amazon and Adafruit for around $9.

8. A USB keyboard and mouse. To save on USB ports and increase portability, I bought a really small wireless keyboard with a built in trackpad for under $30. Now I just need a way to protect it when it’s in my backpack. If you have a USB keyboard and mouse, that will work just fine. Keep in mind that once it’s running, you don’t have to interact with it for it to work. Plus, there are multiple tutorials for remoting in from another computer or even from your Android device. What I’m saying is you don’t have to incur more cost here unless you just want to. I got this little keyboard and track pad because I had visions of putting Pi in my car. I’ve always wanted an in car computer…

9. A transceiver. Currently I’m using a HT to take advantage of its VOX. However, we’ve already talked about the limitations of HTs in packet radio. As soon as I get something that will trigger PTT for me, I’m switching to my Kenwood TM-281 for better reception and range. Check out the Hardwired Cell page for plans on how to make an audio cable for a Wouxon, Baofeng, or Kenwood for this project. To keep from having to sacrifice another lapel mic to get that 3.5 / 2.5 mm connection, I created a second cable that the Hardwired Cell would plug into like an adapter. It’s basically a TRRS 3.5 mm female jack that I took from an audio extension cable and terminated in two standard TRS 3.5 mm male jacks so I could attach to the mic and headphone jacks on the Raspberry Pi. I use this cable combo on my Windows laptop, too, when I’m running Dire Wolf with APRSISCE.

10. Though not required, you may need a powered USB hub, depending on how many USB devices you have plugged in at one time.

Put it all together:

1. Download the Raspbian “Wheezy” distro from raspberrypi.org. This guide is based off of the January 7, 2014 image.

2. Place the image on your SD card using the imaging software of your choice. I used ImageWriter in Linux. Win32DiskImager is recommended by the Raspberry Pi Foundation if you’re using Windows. Both are free. Note: You cannot simply copy the image to the SD card. It won’t work. As an image, you’ve basically got a snapshot of an installation that’s going to get cloned onto your device.

3. Insert the newly imaged SD card into your Raspberry Pi along with the Ethernet cable (or wireless device), keyboard, mouse, and monitor. Once everything else is in, plug in the power. There is no power switch, so it will start up immediately after you plug it in.

4. At this point, you should see text scrolling across the screen as different systems are loaded and tested. The process will stop at the Raspberry Pi Software Configuration Tool. I’m a visual guy, so my next step is “Enable Boot to Desktop” and then “Desktop Log in as user ‘pi’ at the graphical desktop.” This will tell your Pi to boot directly into a graphical desktop environment henceforth. Also, it will keep you from having to enter a user name and password every time you start it up. This is important if you plan on running headless (no monitor) in the future.

5. Select finish and reboot.

6. Ensure the Pi is connected to the internet. It’s update time. If you’re using the Edimax USB for internet, it should install automatically. However, you’ll have to scan for access points and type in your WiFi password. Run the following lines in Terminal to make sure we’re working with the latest and greatest. If you’re on the 01/07/14 distro of Raspbian, only the first command is required.

sudo apt-get update

sudo apt-get dist-upgrade

sudo rpi-update

7. Install the “libasound2-dev” package.

sudo apt-get install libasound2-dev

8. Download Dire Wolf from http://home.comcast.net/~wb2osz/site/?/page/Download/ to /home/pi. Googling “Dire Wolf Linux Download” also brings this up as the first hit. The name of the file should be direwolf-0.0-src.zip. If it’s not, change the following commands accordingly. Be advised, I’ve never been able to download this file properly through Midori. Use NetSurf or another web browser.

cd /home/pi

unzip direwolf-0.9-src.zip

cd direwolf-0.9

make –f Makefile.linux

make –f Makefile.linux install

Dire Wolf is now installed and you should see an icon on your desktop for it.

9. If you haven’t done so already, shut down your Pi and plug in your USB sound dongle. At this point it’s nice to have the Model B with two USB ports and internet coming in through the Ethernet jack.

10. Determine the sound card’s device address on your sound card.

aplay – l

If your USB dongle was detected and installed correctly, you should see the default ALSA device at 0 and the USB device at 1. Write this location down.

arecord –l

Since the Raspberry Pi doesn’t come with an input, you should only see your USB device at 0.

11. Configure Dire Wolf

This part is pretty straight forward. Open /home/pi/direwolf.conf.

First, replace NOCALL with your call sign.

Next, we have to point Dire Wolf to your USB audio device, not that lonely speaker jack on the side of the Pi. Your USB was on 1 and 0, right? Then delete the # from in front of the line “ADEVICE plughw:1,0.”

As you’ll probably notice, every line that starts with a “#” is ignored by the program. This is great because the author has mapped out all the configuration settings in such a way that all you have to do is delete the “#” from in front of the lines that you want to activate. Scroll through the examples for Digipeating, IGating, and Beaconing that are given. Activate the ones that you wish to activate.*

Don’t forget to change the latitude and longitude from the example given to the coordinates that are right for you.

Once you’re done, save the file.

12. Plug in your radio and turn it on. If you’re in North America, tune to 144.39. If you’re relying on VOX, turn that on now. Keep in mind, reception may be slim if you’re relying on a HT inside your house, depending on your proximity to other stations.

13. Fire up Dire Wolf. Watch the dialogue box for a few minutes to make sure everything was setup correctly. If you have another APRS rig, have it transmit and see if you get the packet. Adjust audio levels as necessary to improve capture.

14. Once Dire Wolf is configured to our satisfaction, we want to set it up to run automatically. Moreover, we want the system to check periodically to make sure it’s still running and restart it if it crashes out for some reason.

crontab –e

This will open up a notepad in the terminal. Add the following line to the end of the file.

* * * * * /home/pi/dw-start.sh >/dev/null 2>&1

If you’re wondering, yes, the asterisks are needed. In crontab speak, each one represents a time period over which to perform a check on the line that follows the time fields. The first asterisk is seconds, the second is minutes, etc. Leaving the asterisks in place leaves crontab at the default setting of “run check every one minute.” Also, those are spaces in between each asterisk.

Hit Shift and X to exit, Y to save, and Enter to keep the default name.

The script should run once per minute. If Dire Wolf is not running, it will start shortly.

Congrats. You now have a Digipeater, IGate, and Beacon.

———————————————————————————————————————————————

What’s that? You’re not planning on relegating this device to a radio closet or an ammo can for field special event Digipeating? You want to setup a base station at your house and see what’s out there, to include messages sent your way?

Ok. Let me introduce you to phase 2 of our little project.

14. Install Xastir

sudo apt-get install xastir

15. Run Xastir. This will tax your Pi. Keep in mind that it was designed to be a platform that children in developing countries could learn to write code on.

16. Once Xastir is running, the first thing you’ll want to do is ditch the world map and download better maps. Go to the map section to do that. I like the four with “cloud” in their name.

17. Configure your Interface. You’ll need to add a networked AGW device that represents Dire Wolf. Xastir needs a TNC. Dire Wolf will be it. The default settings are fine. Once added, make sure you tell it to start. If it works, you’ll see Dire Wolf acknowledge the connection.

19. Keep in mind you may need to adjust your Dire Wolf settings, depending on what you enabled in phase 1, so you’re not sending out double the packets. Xastir thinks you’re plugged into a simple TNC right now and will tell it to send packets periodically. If you’ve told the same thing to Dire Wolf, you’ll be sending an excessive number of packets. Remember that APRS has no error correction or delivery confirmation. Excessive packets means that packets that get stepped on are lost forever. If you’re a stationary object, we don’t need to hear from you any more that every 15 minutes. Preferably 30 unless you’re serving up weather data.

20. Have fun. This was a down and dirty guide, but you should be able to find your way from here…

* A warning about Digipeater placement. It’s worth noting that what the world needs is not always more Digipeaters. See the map below. Every object you see there is a green Digipeater star. Hopefully, this guide isn’t your first foray into APRS. My recommendation is for people to be a user for a few months, day in and day out, before you think about Digipeating. There are some well intentioned people out there who just want to contribute to the system and end up causing needless QRM. Once you’ve gotten the lay of the land in your area and you find that you live or work in an APRS deadspot, then you can throw your Digipeater into the mix. What if it looks like your area is already well covered by Digipeaters? Consider IGating. We can always use more IGate coverage. Preferably, an IGate that sends as well as receives so we can improve our worldwide messaging capabilities.

This page was created April 17, 2014 and updated July 25, 2014. Special thanks to John Langner, WB2OSZ, for writing DIRE WOLF, keeping it in active development, and pointing our some errant information in my original article regarding lat/long.

NOTE: It has been nearly four years since I wrote this page and I no longer use this setup to map APRS. I now use APRSISCE32 running on a Windows computer connected to the USB port of my Yaesu FTM-400dr or Kenwood TM-710G. As a result, I can’t help with troubleshooting because I’m too far removed from the DIRE WOLF / Raspberry Pi setup.