Chris Kantarjiev

Find me via APRS

So you want to build an igate?

See the finished project...
It's arguably true that the APRS network has too many high-level digipeaters and too few low-level fill-in digis and/or igates. Building igates used to require either a "real" PC, or require you to dig around in fairly old and creaky code to run a combination of AX.25 in the kernel and perhaps java in user space.

No longer. With the appearance of aprs4r, a ground up implementation of a digipeater/igate combination in Ruby, by a group of hams in Germany, with the Cisco/Linksys WRT hardware family as a target platform, it is possible to build a simple igate into an embedded router that can also provide WiFi linkage. The WRT54G family has provisions on the circuit board for a serial port (or two) - it is only necessary to solder in a connector and provide level conversion. This is well documented elsewhere: I outline a number of options here. With such a serial connection, you can hook up your favorite TNC and radio and be on your way.

But recently, Scott N1VG of Argent Data Systems has released a version of his OT1+ KISS Tracker/TNC that is built using surface mount components, has direct TTL inputs (no RS-232 converter onboard) and uses a 3.3v supply. (He calls this the "RT" version.) This struck me as a great combination for installing the TNC inside the WRT - and indeed it is. Follow along, and you can build one, too.

Install the TNC hardware

WRT54GL mobo
WRT54GL mobo
This cookbook is specifically for the Linksys WRT54GL, which is the currently available version of the WRT54 family that runs Linux, and thus can be reflashed with OpenWRT. The WRT54GL appears to be a rebranded version of the WRT54G v4.0 and/or WRT54GS v3.0. This unit has 16MiB of RAM and 4MiB of flash, which is just barely enough to run aprs4r with careful pruning.

An alternative is the WRT54G-TM, which appears to be version of the GL branded for T-Mobile, that has double the memory and flash. (Or, perhaps, it's an earlier version that didn't have the extra flash/ram removed!) Unfortunately, it ships with a non-standard bootloader; upgrading requires some extra steps. The most straightforward approach is described here. You can probably find a used one on ebay that has already been loaded with DD-Wrt for about the same price as a new WRT54GL. Your choice!

The WRTSL54GS has a USB port already, so you could avoid all this hardware hackery and hook up a TNC-X directly, or use a USB->serial adapter and an OpenTracker. In addition, the CPU is a bit faster (266MHz) and there's lots of memory: 32MiB RAM and 8 MiB Flash. Stu W7IY has described how he did this here. Sadly, the boxes don't seem to be available new!

Another box that's been used is the DLink DSL-502T. Some hams in ZL1 have deetailed information about building an OpenWRT image for it here.

There are older versions of the WRT that fall into this category as well, but their board layout is different, and that matters in how you build your internal TNC board. (See how VE1FIS did it.) You might want to skip down and do the software part first .. or pick up your soldering iron and build the board first. Up to you!

The photo to the right shows the GL's board layout. The empty serial port is marked in red (JP2). The pinout of JP2 on the Linksys PCB is as follows:


Pin  1: 3.3V        Pin  2: 3.3V
Pin  3: Tx (ttyS1)  Pin  4: Tx (ttyS0)
Pin  5: Rx (ttyS1)  Pin  6: Rx (ttyS0)
Pin  7: NC          Pin  8: NC
Pin  9: GND         Pin 10: GND

Your first task is to crack the case (this will void your warranty!) as detailed by Void Main. Then solder in a 5x2 connector to JP2. We'll be building a little board that plugs directly into this connector.

WRT-OT1+ schematic
WRT-OT1+ schematic
The board is quite simple: it has a connector on the underside that plugs into JP2, SIP rails for the OT1+, and an LED to show activity. Unfortunately, this location for the LED is obscured, but you'll be able to see a colored glow through the vents. If you really care, you can drill a hole through the case directly above it, or bring the LED out on wire leads. I also included a set of pins to allow me to select whether to use serial port 0 or 1 (on some WRT versions, serial port 1 doesn't work correctly) and provide a place to access the OT1's serial connector directly. More on that later.

Here are a series of photos taken of the board as I built it.

WRT54GL
WRT54GL with TNC
I used CAT5 cable, with one pair removed, for the radio connector; on pair for transmit audio, one pair for receive audio (each with a ground) and the remaining pair is used for SQL and PTT. If you wish, you can use the remaining pair to remote mount a bi-color LED. This layout works great for the WRT54GL, where the board sticks out into the empty space left in the case. But if you're using, say, an early WRT54GS, you'll want to arrange the board with the jacks on the LED side of the OT1+, so the whole thing will still fit in the case! Build carefully - I recommend soldering the OT1+ last, after checking the board in the WRT to see that power and ground (at least) are where you expect them.

After I built the first one, I decided to try making a PC board version - mostly since I'd never done it before. It came out pretty well, with no serious problems. I handed of the excess to Scott N1VG to list in his store. You can find the Eagle files for the board here. Note that I decided to remote mount the LED this time.

I bring the radio lines out to a DE9F on the side of the case, wired to the Kantronics "standard", as described in the OpenTracker Plus manual.

WRT54GL
Programming the TNC
Now that the serial hardware is in place, you need to program the OT1+ with the KISS firmware. This is complicated by the fact that there's no version of the otwincfg program for Linux, so I use a windows laptop. Now, the nice thing about this version of the OT1+ is that it uses TTL levels on the serial port, instead of RS-232 - that makes it easy to interface to the WRT. But it means that it doesn't work directly with my laptop! I connect with a CompSys RS232 adapter, in particular a A232DBH3v, which is a very convenient package. (Another possibility is this unit from alldav.com.) The other end from the DE9 is connected to an 8-pin housing with four pins that fits over the 8x1 SIP header on the board. Remove the two serial port selection jumpers, install the adapter header, and you have power, ground and serial direct to the OT1+. Use Scott's otconfig.exe to load the 9600 baud KISS firmware.

Now the TNC is running; it's time to load OpenWRT and the aprs4r software.

Upgrade to X-wrt:

I prefer to install the X-Wrt distro, which provides a stable Kamikaze build of OpenWRT as well as a nice web interface for managing the hardware and network setup. Once that's in place, I install aprs4r separately. It's possible to install aprs4r as a complete download with Kamikaze, but that doesn't include X-Wrt .. and X-Wrt has proven difficult to load after the fact.

The native Kamikaze web interface (LuCI) is slowly getting usable, so you might want to try using that; look here.

Initial X-Wrt Setup

Initial setup with LuCI instead of X-Wrt

Initial aprs4r install

This will take a while, as many packages are downloaded and configured.

Turn off X-Wrt

To save memory, turn off X-Wrt! This is a little unfortunate, but that's the way things are. The easiest way to do this is
/etc/init.d/httpd stop
/etc/init.d/httpd disable
If you need to do serious reconfiguration, you can start it with /etc/init.d/httpd start for one time use.

Configure aprs4r with the web interface

At this point, you have two choices. If you loaded the aprs4r-web package, you can use the web page configuration. This is somewhat cleaner and avoids all kinds of syntax errors and other problems - but it's also a little slow. And, unfortunately, the web pages are all in German!

Here's an overview of how to use the web interface. At the end, there's a more straightforward mechanism using a cookbook file that you modify with vi, which is what you'll need to use if you didn't load the aprs4r-web package.

Now you have a basic setup in /etc/aprs4r on the router; you can edit by hand or edit with the web. The following is how to use the website to do the basic setup. (See also APRS4RConfiguration).

Start aprs4r

At this point, many things are configured, but nothing is actually running. Choose 'Startup' from the sidebar. You want to turn on everything:

Configure and start aprs4r without the web interface

This is easier, but more error prone.

cd /etc/aprs4r
wget http://www.dimebank.com/cak/k6dbg/MYCALL.yaml
Use vi to edit MYCALL.yaml to match your setup; there's a list at the top of the file that will help you along. When you're done, save it in a new file myprofile.yaml. Then:

cd /etc/default
cat > aprs4r
PROFILE=myprofile.yaml
START_DAEMON=true
TIMEOUT=120
START_WATCHDOG=true
^D

/etc/init.d/aprs4r start
The /etc/default/aprs4r file tells aprs4r's startup script which profile to use, and how often the watchdog should check to make sure that aprs4r ist still running.

Living with it

Now your igate is running, and the aprs4r system should come up cleanly after reboot. I recommend rebooting at this point ... and then you'll have to debug and tweak. Use http://aprs.fi to see how your system looks on the map and if you're being at all effective. Logs are in /var/log/aprs4r, and are very helpful; you can stop and start the aprs4r system from the command line with /etc/init.d/aprs4r. After things are running, you may decide that you don't want to give up the memory used by the webserver! The free command will show you how much difference that makes.

Spend some time reading through the aprs4r web pages, and get familiar with the options available via the support pages. I strongly suggest that you join the aprs4r-users mailing list; it's very low traffic and really the best place to get specific questions answered.

Depending on where and how you are deploying this, you may want to enable access from the external network interface. That's pretty easy to do with ssh/putty; see this discussion for a lot of details and further links.

Harry SM7PNV wrote to tell me that he has problems with the system getting really slow after a while fixed this by rebooting regularly. Indeed, I have the same problem - there seem to be memory leaks in the Ruby code. I have added a crontab entry on all my boxes to reboot regularly! In /etc/crontabs/root, add the following:


02 4 * * * reboot -f
which will cause a reboot every night at two minutes after four.

Special thanks to Jerry KB0QCL for encouraging me to put this page together.

Future work

The WRT54 serial header has two serial ports. It wouldn't be much extra work to build a board that has two TNCs on it (I'd put the 5x2 header in the middle) and build a split-frequency digi. Or, if you prefer to use external TNCs, just use two of the CompSys ST232A adapters. Either way, this would be a very nice package for areas that are trying to deal with a congested channel on 144.39 MHz... A little care is needed because /dev/tts/0 has console output and a login process by default, but the required changes are pretty well documented in the OpenWRT wiki: mostly you have to comment out comment out following line in /etc/inittab:

ttyS0::askfirst:/bin/ash --login
though it's possible that the boot messages will confuse your TNC. If that's the case, you may have to build your own kernel without console support, using make kernel_menuconfig in the OpenWrt build environment. Happy hacking!

Back to my amateur radio page.

Last updated Sep 08 2010 by cak