Create a Receive-ONLY APRS iGate on a Raspberry Pi

Use a cheap SDR dongle and a Raspberry Pi to make a receive-only APRS iGate in an hour

This document was first created on Feb 9, 2021. It was last updated on Feb 13, 2021. Linux is pretty stable and these steps should not vary much for several years, but obviously there's no guarantee of that. I'm assuming the audience for this will include people with no Linux experience so please don't take the overly detailed steps and explanations in some sections as condescension on my part. Much credit and gratitude goes to the various resources I found online creating this. Anyway, I don't tend to write how-to documents often but I feel there's a need for this one so here goes. ~Reg Natarajan VA7ZEB

Table of Contents

Why Build An iGate?

APRS is a useful system, especially in emergencies in which the cellular system fails or when you're out of range of cellular service (or if you lose/break your phone for that matter). In such cases, APRS lets you send out emails, SMS texts and direct messages using ham radios. APRS also provides a location-reporting service that shows your position on some excellent web-based map front-ends like aprs.fi and aprsdirect.com. This could save your rear-end in an emergency where rescue people need to be sent to your exact location.

The challenge we have with APRS is that, for it to work, there need to be iGates everywhere and there aren't right now. In this document, I'm hoping to show people how to easily build and configure a cheap iGate that will contribute to the APRS system's infrastructure. If even a tiny percentage of ham radio operators did this, APRS would have remarkable coverage just about everywhere.

What Will You Get If You Follow These Steps?

You will get one of these.

It's a fully self-contained APRS receive-only iGate that will accept beacons from anyone on the standard APRS frequency of 144.390 and send them to APRS-IS where they will be displayed on pretty maps on Internet front-ends like aprs.fi and aprsdirect.com. It will also receive encoded APRS messages on 144.390 and relay them to APRS-IS so people in your area can use their radios to send emails and SMS texts to anyone.

It won't be huge or ugly. The only wiring it will have is the power cord, and you will be able to hide it just about anywhere. I'm going to hide mine in a flower pot on the balcony with the power cord nicely hidden along the railing. Obviously I'll need to get a bit creative to make sure water stays out but that's for another how-to that I doubt I'll ever write.

What you won't get is a bidirectional iGate that will send messages back to the radios in the field. While what would be nice, this is still 99% as useful and is vastly simpler, easier and cheaper to build and configure. Let us not make perfect the enemy of good.

Our Approach

Being frugal, we're going to make this happen using an inexpensive Raspberry Pi, an inexpensive SDR, an inexpensive antenna and a bunch of free software. We're going to build a Pi, install Raspbian (now called Raspberry Pi OS), then install Direwolf and the Linux drivers for the RTL-SDR. We're not going to use any other software at all. We're going to configure Direwolf to relay APRS beacons and messages to APRS-IS and to beacon the iGate itself at regular intervals. We're going to configure the iGate to be accessed from your home computer via VNC so that, after you hide it wherever you're going to hide it, you can still get to it and control it from your main PC. We're going to set it up so that it survives reboots and resumes operation without requiring any human action. We're going to set it up to update itself nightly with any new software upgrades and/or security patches and to reboot itself nightly to keep itself fresh. We'll even do a bit of hacker-proofing. It should take about an hour or two to do all of this (including the build of the Pi).

What You'll Need To Buy

These are the parts I purchased and used for this project in Feb of 2021. You can substitute equivalents for any or all of them. Please note that my links are to Amazon Canada because, obviously, I'm in Canada. All of these parts are easy to purchase in most countries.

You'll also need a reasonably fast Micro SD card and reader which most of us have lying around so I haven't bothered listing them below. You will obviously also need a monitor, keyboard and mouse, but you can just temporarily steal those from your home computer while working on this project. You won't need them for long.

Note that you don't need to do this on a Pi. While I haven't tried it, I see no reason this approach wouldn't work on any Debian-based Linux including Ubuntu or Mint. If you have an old computer lying around, use it. Keep in mind it probably won't hide as well as a Pi.

Raspberry Pi

The 8 gb Raspberry Pi 4 I bought for this project was $135 Canadian on Amazon. You would do fine with the 4 gb version. I'm not sure I'd try the 2 gb version.

Raspberry Pi Case

There are a million different Pi cases out there. Mine was $26 Canadian on Amazon. Some say aluminum interferes with wifi. I've had no issues.

USB-C Power Supply

You'll need a USB-C power supply rated at 3 amps or better. I just bought the official Raspberry Pi unit on Amazon for $18 Canadian. Any 3 amp supply will do.

MicroHDMI to HDMI

New Pis come with irritating MicroHDMI plugs. I bought this converter on Amazon for $11 Canadian (for 2). Obviously buy what you need for your monitor.

RTL-SDR Dongle

The SDR dongle I used was a Nooelec NESDR Smart v4 which cost me $43 Canadian dollars on Amazon. Any RTL-SDR should work fine, however.

SMA Male Antenna

The Antenna I used was an HYS-772. $14 Canadian dollars on Amazon. Any SMA Male antenna should work fine as long as it's tuned to the VHF ham band.

Build your Raspberry Pi

I'm not going to cover this part other than to say if it takes you more than 10 minutes, you're doing it wrong. Using the parts I listed above, I unscrewed the case (four screws), plopped the Raspberry Pi motherboard in, re-screwed the case, connected the fan and that was it. If you're not sure how to connect the fan, there's a good image here. If you have issues, YouTube is your friend.

Let's assume you've got yourself an assembled (but not booted) Raspberry Pi. Make sure your SDR dongle is plugged in to a USB slot on the Pi and your antenna is connected to the SMA female connector on the SDR dongle.

Create a Raspbian Micro SD-Card And Boot Your Pi

I know, I know, it's called Raspberry Pi OS, now. How catchy. I'll come around eventually. Whatever you choose to call it, you're going to need it.

To get it you're going to have to download and install the Raspberry Pi Imager on your home PC (preferably Windows) from this page. Choose Raspberry Pi OS (still 32 bit sadly), choose your SD card and hit Write. It's slow. Be patient.

When you're done, put your Micro SD card in your Pi, connect a monitor, keyboard and mouse, then give it power. Your Pi will boot up and you can start on the software part of your project.

IMPORTANT: For the next few steps, if you only have one monitor you're going to need it for your Pi so you might have trouble following the steps of this document. Not to worry. I have formatted this document so it works on most phones. Just load it on your phone and you can follow the next few steps from there.

Configure Your Pi on First Boot

When your Pi boots for the first time, it's going to ask you a bunch of questions. Your country, your language, etc. If you don't know those things, perhaps building an iGate shouldn't be your top priority. Choose a password you'll remember. Get it connected to Wifi. Let it do its software update. Let it restart. When it comes back, you should see a desktop that looks roughly like this.

Set Up Your Pi For Remote Access

Don't skip this part. I know it's tempting to but you'll regret it. The whole idea of a tiny little iGate is that you can hide it somewhere and let it run headless (no monitor, keyboard or mouse). Well, if it ever needs attention (which it will, computers being what they are), it'll be much easier to fix whatever went wrong if you can just do it from your home PC rather than digging the Pi out of wherever you've hidden it, connecting a monitor, keyboard and mouse, only to click "ok" on whatever error is on the screen.

First, get your local IP address. There are many ways to do that but this is the method I generally use. If you prefer a different way, do that. If not, click on the terminal and then type ifconfig (and enter of course) in the black window that pops up.

The information displayed by ifconfig will contain your IP address. It will probably start with 192.168. It is definitely not the 127.0.0.1 loopback address. Jot your address down or remember it for future reference. You will need it shortly (and later every time you need to tend to your iGate so save it however you save things).

Note 1: You need your local IP, not your public IP. Don't use sites like whatismyip.com as those return your public IP.

Note 2: Technically this address could change since it's DHCP at this point. If you're worried about that, Google how to assign a static IP to a Raspberry Pi and do that. Personally, I find small DHCP networks to be quite stable when it comes to unnecessarily changing IP addresses and I just leave it as is.

Now tell your Pi to accept connections on VNC. Click the Raspberry at the top left, then Preferences, then Raspberry Pi Configuration.

On the resulting pop-up window, click Interfaces and put a tick in Enable on VNC. While you're in here, you might want to click System and change the computer name to something that suits you.

Click OK when you're done but don't reboot.

Now we need to specify a screen resolution. Normally your Pi will just detect the resolution of whatever monitor you have plugged in, but we want to run it without a monitor so if you don't specify a resolution, it will default to an unusably tiny rectangle to save resources.

Load up another terminal and type sudo raspi-config (and enter). Chose Display Options, then Resolution and choose something that suits you. I like to set it to 1280x1024 so that it is a nice usable window on my 1920x1080 screen but choose whatever you're comfortable with. Be sure you see the confirmation message that your resolution has been changed. Choose Finish but do not reboot.

Now it's time to put your Pi in its permanent home. Don't skip this as VNC will look funny if you leave your monitor connected (the monitor's native resolution will override whatever you set in the step above). You also need to be sure your Pi won't have issues running headless. We'll do the rest of the steps in this document from your home PC using the VNC you just configured. In your terminal window, type shutdown -h now and hit enter. Wait a minute and your Pi will shut down. Now, unplug the USB power from your Pi. With the power unplugged, now unplug the monitor, keyboard and mouse, and then move the Pi to wherever you plan to keep it permanently. Finally, plug only the USB power back in. At this point, your Pi is operating "headless", without a keyboard, mouse or monitor.

Finally, we need to go to your home PC and download/install VNC Viewer which you'll find on this page. Once installed, run it and create a New Connection. Enter the IP address you jotted down a few steps ago, give the connection a nice name, click Ok and then double click it to connect. You'll be prompted for a user/password. Enter pi as the user and whatever password you entered on initial setup. If you click "save password", you won't be prompted again on subsequent connections to your Pi.

You should now see your Pi as a window on your main computer's screen. From now on, whenever you need to work on your Pi, just load up VNC Viewer and double click the connection you saved. Again, all the remaining steps in this document will be done from inside a VNC window.

IMPORTANT: Your home PC needs to be on the same network as your Pi for this to work, otherwise you're going to have to get into forwarding ports on your router and opening ports on your firewall.

Install Direwolf and the Linux SDR Drivers

At this point, things will be easiest if you load this document in the web browser on your home PC as you will be copying/pasting a lot. Always use ctrl-shift-v to paste instead of just ctrl-v because the shift lets you paste into terminal windows.

Load up another terminal and copy/paste the following lines one at a time. Yes, it's tedious to do this one line at a time. Just do it that way or it might fail. Pasting in multiple lines at a time is always hit and miss.

sudo apt update

sudo apt upgrade -y

sudo apt install cmake build-essential libusb-1.0-0-dev libasound2-dev libudev-dev -y


cd /usr/src

sudo git clone https://www.github.com/wb2osz/direwolf

cd direwolf

sudo mkdir build && cd build

sudo cmake -DUNITTEST=1 ..

sudo make -j4

sudo make test

sudo make install


cd /usr/src

sudo git clone git://git.osmocom.org/rtl-sdr.git

cd rtl-sdr

sudo mkdir build && cd build

sudo cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON

sudo make

sudo make install

sudo ldconfig

sudo rtl_test

You should see your SDR dongle listed as follows.

Don't worry if you see a few lost bytes when you first run it. It should stabilize quickly and not show any more lost bytes. If you keep seeing significant numbers of lost bytes pop up on your screen after the first few seconds, you may have bad hardware. Once you're satisfied, type ctrl-c to terminate the program.

Configure your iGate

Copy/Paste the following command into a terminal window.

nano ~/igate.conf

Copy/Paste the following brown text into the Nano editor. Note that lines starting with # are just comments that don't affect anything. You can paste them safely. They won't harm anything.

IMPORTANT: Change YOURCALLSIGN to your actual call sign. Change YOURPASSCODE to your actual passcode. If you don't have a passcode, get one here. Change your latitude and longitude to your actual coordinates (just right click on any point in Google Maps and it'll tell you the lat/long). If you're not in North America, change the IGSERVER to one of the alternatives listed below.

# Set the sound card to null

ADEVICE null null

CHANNEL 0


# Put your callsign here. It is common to add "-10" to the end.

MYCALL YOURCALLSIGN-10


# Enter your callsign (no "-10" this time) and your passcode.

# If you don't have one, get your passcode at http://apps.magicbug.co.uk/passcode/

IGLOGIN YOURCALLSIGN YOURPASSCODE


# The IGSERVER defaults to North America.

# If you prefer a different server, use one of these:

# noam.aprs2.net - North America

# soam.aprs2.net - South America

# euro.aprs2.net - Europe and Africa

# asia.aprs2.net - Asia

# aunz.aprs2.net - Oceania

IGSERVER noam.aprs2.net


# Set your iGate up to beacon itself every 60 minutes.

# IMPORTANT: Change your latitude/longitude to your own coordinates.

PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat=42^37.14N long=071^20.83W

When you're done with your changes, type ctrl-x to exit and then y to save. Hit enter when it asks you to confirm the file name.

Create A Script To Run Your iGate

Copy/Paste the following command into a terminal window.

nano ~/igate.sh

Copy/Paste the following brown text into the Nano editor.

IMPORTANT: If you are in Europe, change 144.39 to 144.80. Obviously if you wish to use APRS on any other frequency, there's nothing to stop you from doing that but I encourage you to stay within the conventions of your area.

#!/bin/bash

export DISPLAY=":0"

DWCMD="direwolf -c /home/pi/igate.conf -r 24000 -D 1 -T \"Timestamp: %F %T\""

LXCMD="bash -c 'rtl_fm -f 144.39M - | $DWCMD -'"

sleep 30

/usr/bin/lxterminal -t "iGate" -e "$LXCMD"

Type ctrl-x to exit and then y to save. Hit enter when it asks you to confirm the file name.

You also need to make the file executable. Copy/Paste the following command into your terminal.

chmod +x ~/igate.sh

Now, finally, you get to run your iGate! Copy/Paste the following command into your terminal.

sudo ~/igate.sh

After a 30 second pause, you should see this.

Test your iGate by beaconing some APRS with any APRS-capable radio. You should immediately see the packets in your iGate window. They should also show up almost immediately on aprs.fi.

AutoStart Your iGate Whenever Your Pi Boots

There are different ways to do this. To be frank, I find most of the common ones (such as throwing a dw-start.sh into a cron) to be overly complicated and prone to failure. I'm just going to use the Raspberry Pi desktop to autostart the iGate 30 seconds after it loads.

Copy/Paste the following lines into a terminal window.

mkdir ~/.config/autostart

nano ~/.config/autostart/igate.desktop

Copy/Paste the following brown text into the Nano editor.

[Desktop Entry]

Type=Application

Name=iGate

Exec=sh -c "sudo /home/pi/igate.sh"

Type ctrl-x to exit and then y to save. Hit enter when it asks you to confirm the file name.

Test it. Reboot your Pi by typing reboot into your terminal window. VNC will disconnect, of course, but it should reconnect automatically as your Pi boots and your iGate should run automatically after 30 seconds.

Configure Automatic Software Updates

Automatic updates should not be a controversial idea. They'll keep your Pi up to date with the latest security patches, bug fixes and so on. Some people worry about the risk that an update in the future may break the stack of software programs and configurations that make up your iGate. To me, the risk of old and stagnant software being compromised is far greater than the risk of an upgrade making your stack fail. It's worth setting your Pi up to auto-update itself.

Copy/Paste the following commands one at a time into a terminal window. It will not work if you try to paste both lines at once.

sudo apt install -y unattended-upgrades apt-listchanges

sudo dpkg-reconfigure -plow unattended-upgrades

Every few weeks (or months), you should try to remember to log in to your Pi and just do a sudo apt update && sudo apt upgrade to see that it's working. There should be (almost) no updates found if automatic updates are working correctly.

Configure Automatic Nightly Reboots (optional)

Nightly reboots are something each sysadmin has to decide on (and you're now a sysadmin, even if it's for just one system). If your software stack hangs and you don't happen to notice, a nightly reboot will keep your downtime to less than a day. I choose to do automatic nightly reboots but you'll have to decide for yourself. If you want to proceed, do the following.

Copy/Paste the following command into a terminal window.

sudo crontab -e

Choose 1 for Nano and copy/paste the following brown text into a new line at the bottom of the file. Note, this will reboot your Pi every night at 4 am. The first number is minutes, the second is hours. If you want a different time, just change those two numbers.

0 4 * * * /sbin/shutdown -r now

Type ctrl-x to exit and then y to save. It should say "crontab: installing new crontab".

Protect Against Hackers With fail2ban (optional)

Fail2ban is a well known and well regarded hacker-protection program that just bans IP addresses temporarily if they try to log in with the wrong user/pw too often or too fast. I always install it. You can decide for yourself. If you want to proceed, do the following.

Copy/Paste the following commands one at a time into a terminal window. It will not work if you try to paste both lines at once.

sudo apt install fail2ban -y

sudo systemctl enable fail2ban

That's it.

Congratulations!

You've done it. You've built, configured and tested your APRS receive-only iGate. Your final product should look like this.

Put it somewhere safe with as much exposure for the antenna as you can manage, test that VNC still works, and boast to all your ham friends about how cool you are, because you really are. APRS only works if people like you deploy iGates and you've done your bit for the community today.

Link your ham friends to your iGate on aprs.fi and I bet they'll be jealous of you. If they do happen to be jealous, please consider sharing this document with them. Let's get as many iGates out there as we can. I'd prefer that you link to my site because I intend (ok, hope) to keep this document updated here as much as possible, but I release everything I post here to the Public Domain so use it as you see fit.

Error reports, typo reports and bug reports are very welcome. Please email them to me at reg@natarajan.ca.

I also belong to some of the large APRS and BC/Canada ham groups on Facebook. Those groups are great places to get individual advice and support from the community. You can find my FB profile here.

I hope this has helped you.

Best,

Reg Natarajan

VA7ZEB