Decoding APRS packets with an SDR

One minor goal I had when creating QTH.app was to make it inexpensive and easy to get started with APRS on a Mac. In this post, I’ll show you how to set up what I think might be the least expensive setup for receiving APRS packets over radio, beyond the cost of the Mac itself, of course.

I’m going to be focusing on the receive aspect of APRS. To transmit, you will likely want to invest a bit more money in a quality radio.

Most hams these days have one or more Baofeng radios on hand, and, while you can get your hands on them starting at $35, you would still need a way to interface it to your computer. To do that properly, you probably will need something like a Mobilinkd TNC3 or a SignaLink USB, both of which cost over $100.

However, you can get a RTL-SDR dongle for around $36, plug it into an available USB port and start receiving radio signals.

Step 1: Installing an Audio Router

This is the “secret sauce” to the whole setup. An audio router is a special macOS audio driver that allows you to pipe the audio output from one application to the audio input of another app.

There are two free options:

Both of these function pretty much the same. In my experience, Soundflower implements more of the audio driver API so you get less error messages when it comes to setting volume and such, but it has more trouble keeping up with Mac releases in its support history. It was originally supported by Rogue Amoeba, but is now in the hands of the original author. If you would like a commercially supported option, check out Loopback from Rogue Amoeba.

Choose an option and install it using their instructions. When you are done, you will see a new audio device in your System Preferences → Sound, in both the Output and Input tabs.

Here you can see what my Input tab looks like, with both BlackHole and Soundflower installed:

Step 2: Converting FM to Audio

APRS signals are transmitted as AFSK (Audio Frequency-Shift Keying), which means that audio tones are transmitted using FM modulation. If you’ve ever listened to an APRS packet, you’ll know that it sounds like an old-school modem, because, well, it basically is.

A Software Defined Radio (SDR) like the RTL-SDR captures a portion of the radio spectrum and sends this data via USB as a sequence of I/Q samples. We need to do two things to this stream of data before QTH.app can process it: it needs to be converted from I/Q format and processed by an FM demodulator.

Fortunately, there are a number of applications out there that do this, a subset, of course, that run on macOS:

  • rtl-sdr – command line app. You would need to run rtl_fm and pipe the output to an audio player, like SoX‘s play command
  • GNU Radio – it should be possible to assemble a flowgraph in GRC that reads data from the SDR, processes the signal with a FM demodulator block, and sends the output to an audio device.
  • CubicSDR
  • GQRX

For the purposes of this post, I’ll be using CubicSDR, because I found it to be the easiest to use of all the options.

  1. When CubicSDR starts, choose the RTL-SDR and click Start
  2. Tune the SDR to the national APRS frequency, 144.39 MHz. I made a bookmark in the lower left panel so that I can instantly jump to the right frequency.
  3. Select the FM modem in the upper left panel, and then, under FM Settings, choose the audio router device that you installed in Step 1. In the screenshot, the audio device I have selected is Soundflower. The full name of the device is “ma++ ingalls for Cycling '74: Soundflower (2ch)

Step 3: Decoding APRS packets

  1. Start QTH.app
  2. Open the Connections window. Click on the plug icon on the tool bar, or use Window → Connections
  3. Click the + button to add a new connection, choose ‘Audio Modem’, name it whatever you would like, and click Create.
  4. Click the gear icon next to your new Audio Modem connection to bring up the configuration panel.
  5. For Audio Output, you may choose any device you want, since you will not be transmitting anything. I chose my built-in speakers
  6. For Audio Input, choose the audio router device you installed in Step 1.
  7. Click Save to save the settings and close the panel.
  8. Toggle the switch to start the Audio Modem connection.

And done! Using the audio router, CubicSDR will convert the incoming signal to an audio stream and QTH.app will decode APRS packets from the incoming audio stream.

Bonus Trick: Getting Data From Someone Else’s SDR

Ok, so you might be in my situation – I have an RTL-SDR, but I live in an area where there is very little actual APRS activity on the local airwaves. What if I wanted to listen to the airwaves somewhere else?

You can try out WebSDR.org. This website features a number of SDR receivers that have been connected to the Internet. You can tune to the APRS frequency and listen to the audio.

The only catch here  is that many web browsers do not give you an option to select an alternate audio output device; they simply send all audio to the system default device. If this is the case, and you want to route the audio to QTH.app, you would need to go into System Preferences → Sound and choose the audio router device as your system output device. Just know that while this is set, all other audio, such as alerts or music, will go there as well. This won’t bother QTH.app any, but your computer will be a bit quiet while you have it set up this way.

Adventures in Fox Hunting

Last night’s topic for Home School Ham Radio was antennas, so I figured what better way to demonstrate a directional (Yagi) antenna than to have a mini fox hunt in Fremont Park. Sounds fun, right? Except that, when I decided to do the fox hunt, I had neither a directional antenna nor a fox transmitter. So, 2 weeks prior, I decided to remedy that problem.

First off, I should probably step back and explain what a “fox hunt” is, for any one who might have no clue. Basically it’s a game that amateur radio people sometimes like to play; a high tech version of hide and seek. Someone builds (or buys) a small, portable transmitter and then hides it somewhere. Its sole job is to send out a beacon periodically on a given frequency. Then the hider gives the frequency and any other clues or details to the seekers. The seekers are armed with a radio and a directional antenna. Because the antenna is directional, the beacon should get stronger when pointed in the direction of the fox and weaker when pointed away. Using this setup, the seekers can travel in the direction of the signal, triangulating along the way, and hopefully find the fox wherever it might be hidden.

If you start miles away from the fox, the signal is generally weak, so the signal should disappear when the antenna is pointed away from the fox. However, once you start to get close, the signal gets so strong that it will seem like the signal is coming from all directions. In fact, if you’re close enough, you can even detach the antenna from your radio and it will still pick up the signal. This becomes a problem when locating the fox in that last mile or so. In my case, I knew that I would be hiding the fox somewhere within the park, so we would be starting out really close.

Step 1: Attenuator

So, the first thing that I built was an “attenuator”. The dictionary definition of “attenuate” is:

to weaken or reduce in force, intensity, effect, quantity, or value:

And that’s exactly what an attenuator does; it’s designed to decrease the amount of signal received by the radio. Normally, in amateur radio, you don’t want to do that; you want the strongest signal you can get. But, in the case of a fox hunt, it is designed to decrease the signal back down to a point where the difference between pointing the antenna at the fox and away from the fox can be heard again.

I decided to go with a kit attenuator from 3rd Planet Solar / KC9ON.

Fox Hunt Offset Attenuator
KC9ON Fox Hunt Offset Attenuator

This kind of attenuator will mix the incoming signal with a small signal generator in order to generate a signal 4 MHz above or below the fox’s signal. Then you can turn the knob to increase or decrease this new signal. So, for example, in our Fremont class, I chose a frequency of 147.54 MHz for the fox to transmit on and then added 4 MHz to it, for a final frequency of 151.54 MHz. This is the frequency that I tuned the radio to. The neat thing about this arrangement is that, because the radio is 4 MHz off of the target signal, if the attenuator is turned off, the radio won’t receive any signal.

You can buy the attenuator already assembled and soldered, but I chose the kit that just had all the parts and you have to solder it yourself. I wanted to put it in a specific enclosure and needed to extend the distance between certain parts like the light, the switch, and the knob.

Here’s what it looks like all assembled:

Step 2: “Tape measure” Yagi Antenna

Once that was done, the next step was to build a “tape measure” Yagi antenna.

Emma helped me build the antenna and we recorded the build; look for it in a future episode of Ham Radio with Emma! We used the plans created by NT1K.Here’s what it looks like all assembled:

Tape measure Yagi

Overall, the parts are pretty cheap to buy at a hardware store. The only special parts that are ham-radio-specific are the PL-259 connector at the end and the RG-58 coaxial cable. You will need to be able to solder wires, but you can get pretty cheap soldering irons. Harbor Freight has the cheapest irons I’ve found. No bells and whistles, but they will get the job done.

Step 3: Fox Transmitter

I knew a fellow ham that already had a fox transmitter, so I had hopes that we could simply borrow that for our meeting. Unfortunately, schedules did not align and it didn’t work out, so I had to get creative.

I initially thought I needed to buy a special transmitter, like the Byonics MicroFox, but they are all over $100 and even if I wanted to spend the money, there wasn’t enough time to get one shipped out in time for the class.

But then it dawned on me that it’s just a radio and I already have a couple of those.

I found this video on YouTube about simply hooking an MP3 player to a Baofeng radio with an audio cable.

I even had the right cable! So, I dug out a really old iPod we don’t use anymore, created an audio file with my callsign and message, and imported it into the iPod. The theory was that I could switch the Baofeng into “VOX” (voice activated) mode and then when the audio file played, it would transmit the audio. On the iPod, I could switch it into “repeat single” mode and it would just play the same audio file on repeat forever. I used Audacity to add 15 seconds of silence to the end of the audio file. The theory was that the VOX mode on the radio would detect silence and stop transmitting.

Except that theory didn’t work. The audio triggered the radio to transmit, but when it got to the silence part, it wouldn’t shut off. We can’t have that happening, so back to the drawing board.

I had the radio part figured out, I could just use a Baofeng. But the two things left to figure out was generating some sort of signal and triggering the Push-to-Talk (PTT) to get it to transmit. That second part is tricky.

The Baofeng has a connector that looks like this:

In order to trigger the PTT, you have to connect the sleeves of both pins. A lot of devices that can be programmed to do things, like computers or phones, don’t have any way of making this electrical connection; typically they just have USB ports as their way of connecting to other devices.

But… Arduinos and Raspberry Pis do! They have “general purpose I/O” (GPIO) pins that can basically turn a voltage on or off. I have devices of both families laying around, so I started searching the Net for designs. I decided to look for Arduino designs first because they are much simpler devices and don’t need a full-on operating system, like a Raspberry Pi does.

As luck would have it, I stumbled upon this design from NF7Z Nelson Farrier:

Auto-Keyer for Radio “Fox Hunting”

Fortunately, between my parts box and Emma’s parts box, I managed to find all of the necessary electronics parts, like capacitors, resistors, and the relay. The tricky part was finding the right cable to connect to the Baofeng. Like I mentioned before, I do have a BTECH APRS-K1 TRRS / APRS Cable, but I discovered that it only connects the mic and speakers, there is no way to trigger the PTT. The expectation, when using this cable is that you will just enable VOX on the Baofeng. After my earlier attempt, I wanted to avoid VOX.

I could have soldered up a new cable for this, but, since this was really intended to be a temporary solution, I didn’t want to use up some connectors. But I happened to have a cable that has a Baofeng-compatible end on it from Mobilinkd. I knew that the Mobilinkd TNC was able to trigger the PTT using this cable, so I just had to get the connections right.

I modified the Arduino code to put my callsign in. The code makes the Arduino generate a morse code audio sequence that beeps out “W8WJB FOX” and then follows with a short tone to help with getting a heading when swinging the Yagi around.

Just turn on the Baofeng radio, tune it to the desired frequency, and plug in the Arduino. It repeats the sequence over and over with a short pause in between until you power it off.

This was the result:
homemade fox transmitter

I secretly turned it on and hid it a half hour before the ham radio class. I’m happy to report that the kids managed to find it where it lay hidden in some brush!

I tried to hide it again, but we discovered that, in the excitement of the first find, it got jostled around pretty good. I think a wire probably came loose and it was no longer transmitting. There wasn’t time during the class for me to troubleshoot which wire, so we simply moved on with the lesson.

But, all in all, I would say that that, despite the last minute, rushed build, it worked for what we needed it to and everyone had fun!

Practice Test Recommendations

At our class in Fremont last night, I promised to provide some links to websites or apps that can help with doing practice tests.

Here is the iOS app that everyone in my family used:

HAM Test Prep: Technician

It costs $5. If you want to see what it’s like before you buy it, you can try the Lite version. Just be aware that the Lite version only contains 2 of the 10 subelements of the question pool.

HAM Test Prep Lite: Technician

You can also take practice tests on several websites. Here are the ones I’ve used and liked:

I really recommend creating an account on these sites when practicing the test because the site can keep track of your past test results and you can see the progress you’re making.

 

Week 2 Handout

As promised, here is the handout from yesterday’s class in Fremont. It looks much better in full color. Here’s what each page has:

Page 1: The “Schematic Scavenger Hunt”. We did the first three rows, from resistors to capacitors. We’ll learn about the rest next week.

Page 2: Technician test diagrams. These are the three figures that appear on the test. The questions are generally worded like “What is component 6 in figure T2?”. (Bonus points if you comment back and tell me the answer)

Page 3: Resistor color code reference + handy way to identify transistors. We didn’t talk about transistors yet; we’ll cover that next week.

Page 4: A nice collection of electronics symbols courtesy of Sparkfun.

Week 2 Electronics Handout

Electricity Reference Sheet

We had more people that I expected for yesterday evening’s session! That’s awesome! But it also meant I hadn’t printed out enough handouts ahead of time. Here’s the reference sheet as a PDF for anyone who wasn’t able to take one home.

There are a few things that we didn’t get a chance to cover, such a the PIE formula and decibels, but we’ll cover some of the things we missed next week.

Electricity Reference Sheet

Episode 6: Electricity – Resistance

Learn about electrical resistance with us!