{"id":387,"date":"2011-08-14T22:00:50","date_gmt":"2011-08-15T02:00:50","guid":{"rendered":"http:\/\/blog.alanporter.com\/?p=387"},"modified":"2011-08-14T22:00:50","modified_gmt":"2011-08-15T02:00:50","slug":"aprs-igate","status":"publish","type":"post","link":"https:\/\/alanporter.com\/blog\/2011\/08\/14\/aprs-igate\/","title":{"rendered":"APRS iGate"},"content":{"rendered":"<p>When I was working with the NC Nearspace group on our high-altitude balloon, we experimented with two different methods of tracking it once aloft: ham radio APRS, and a commercial system called &#8220;<a href=\"http:\/\/findmespot.com\">SPOT<\/a>&#8220;.<\/p>\n<p>We had some early failures with APRS.\u00a0 But over time, we have found that it&#8217;s a pretty nice technology, if you use the proper equipment.<\/p>\n<p>APRS, or &#8220;Automatic Packet Reporting System&#8221;, is a system that passes data packets over radios. It can be used for passing text messages, but most people use it for telemetry: tracking a vehicle&#8217;s position with a GPS, or on a weather station that broadcasts its weather readings every so often.<\/p>\n<p>Since we have been playing with APRS on our balloons, I wanted to learn more about it. I have been keeping my eyes open for a reasonably-priced handheld radio that can encode and decode APRS packets. Sure, some people use a special radio modem (called a &#8220;TNC&#8221;) to do the encoding\/decoding, but it&#8217;s important to me to have the modem and the radio in a single package, so I won&#8217;t have a big tangle of wires. This week, one such radio popped up on eBay, and so I bought it. While I waited for it to arrive, I did some homework on APRS and what it could do.<\/p>\n<p><strong>Building an iGate at home<\/strong><\/p>\n<div id=\"attachment_408\" style=\"width: 310px\" class=\"wp-caption alignright\"><a href=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1733a.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-408\" class=\"size-medium wp-image-408\" title=\"Kenwood TM421A\" src=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1733a-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/a><p id=\"caption-attachment-408\" class=\"wp-caption-text\">My &quot;mobile&quot; radio at home<\/p><\/div>\n<p>I already have two 2-meter radios: a small handheld &#8220;handy talkie&#8221; and a larger &#8220;mobile&#8221; radio that is designed to be installed in a car. So I tuned the mobile rig to 144.390 MHz and listened. It was a lot of static, with occasional squawks of data.<\/p>\n<p>Most of the time, if you wanted to decode the squawks, you would buy a packet TNC (modem) to convert the squawks to data, and you&#8217;d hook the modem to a computer to <em>use<\/em> that data. But then I read an article about using your computer&#8217;s sound card to encode and decode the packets directly, with no modem at all. Heck, I was sitting around at home waiting for my new handheld-with-built-in-modem to arrive. Why don&#8217;t I try to do this modem-less setup?<\/p>\n<p><strong>Look, Ma, no modem!<\/strong><\/p>\n<p>The first thing I did was hook the speaker output from the radio to my computer&#8217;s &#8220;audio in&#8221;. Optionally, I could have hooked the computer&#8217;s &#8220;audio out&#8221; to the microphone input of the radio. That second step is more complicated than you&#8217;d think, because I would also need to hook SOMETHING &#8212; maybe a parallel port pin &#8212; to the radio&#8217;s &#8220;push to talk&#8221; or &#8220;PTT&#8221; to turn the transmitter on before it&#8217;s ready send a squawk of data over the air.\u00a0 You really don&#8217;t want to just let it transmit all of the time&#8230; because other people are using that radio channel, too.<\/p>\n<div id=\"attachment_415\" style=\"width: 310px\" class=\"wp-caption alignleft\"><a href=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1734a1.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-415\" class=\"size-medium wp-image-415\" title=\"Fit PC 1.0\" src=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1734a1-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" \/><\/a><p id=\"caption-attachment-415\" class=\"wp-caption-text\">My modest Linux server<\/p><\/div>\n<p>I chose the simple receive-only option, setting up my Linux-based server to &#8220;listen&#8221; to the radio. I downloaded a package called <strong>soundmodem<\/strong>, which is a APRS decoder program. It listens to the noise and the squawks, and it outputs a stream of decoded data.<\/p>\n<p>Soundmodem is hard to set up on a headless server, because the normal setup process involves running a graphical configuration program called &#8220;soundmodemconfig&#8221;.\u00a0 Since my server is &#8220;headless&#8221;, I don&#8217;t have a monitor or a keyboard or a mouse.\u00a0 I just connect to it over the network.\u00a0 So I could not run soundmodemconfig.\u00a0 So instead, I ran this program on my laptop and I copied the resulting configuration file back to the server. It was a pretty simple XML file that looked like this:<\/p>\n<p>\/etc\/ax25\/soundmodem.conf<\/p>\n<pre>&lt;?xml version=\"1.0\"?&gt;\n&lt;modem&gt;\n  &lt;configuration name=\"KISS\"&gt;\n    &lt;channel name=\"Channel 0\"&gt;\n      &lt;mod mode=\"afsk\" bps=\"1200\" f0=\"1200\" f1=\"2200\" diffenc=\"1\"\/&gt;\n      &lt;demod mode=\"afsk\" bps=\"1200\" f0=\"1200\" f1=\"2200\" diffdec=\"1\"\/&gt;\n      &lt;pkt mode=\"KISS\" ifname=\"sm0\" file=\"\/dev\/soundmodem0\" unlink=\"1\"\/&gt;\n    &lt;\/channel&gt;\n    &lt;chaccess txdelay=\"150\" slottime=\"100\" ppersist=\"40\" fulldup=\"0\" txtail=\"10\"\/&gt;\n    &lt;audio type=\"soundcard\" device=\"\/dev\/dsp1\" halfdup=\"1\"\/&gt;\n    &lt;ptt file=\"none\" gpio=\"0\" hamlib_model=\"\" hamlib_params=\"\"\/&gt;\n  &lt;\/configuration&gt;\n&lt;\/modem&gt;<\/pre>\n<p>The important parts are where it says it&#8217;ll read the <strong>audio<\/strong> device <code>\/dev\/dsp1<\/code> and it&#8217;ll create a <strong>KISS<\/strong>-mode <strong>packet<\/strong> device called <code>\/dev\/soundmodem0<\/code>.<\/p>\n<p>To start the APRS decoder program, I just run <code>\/usr\/sbin\/soundmodem \/etc\/ax25\/soundmodem.conf &amp;<\/code>. If it all works, then I can just do <code>tail -f \/dev\/soundmodem0<\/code> and see some packets on the screen, with some header garbage and then some readable payload data with a bunch of callsigns.\u00a0 That is enough of an indication that the decoding is working correctly.<\/p>\n<p><strong>The iGate software<\/strong><\/p>\n<p>The second piece of software I installed was a digipeater package called <strong>APRS4R<\/strong>. I had read a story about a guy who put a small TNC (radio modem) board inside of a Linksys WRT54G router and turned it into a very small portable digitpeater. He ran APRS4R on the router, and so I figured that this program must be pretty lightweight. So I should be able to run it on my modest Linux server.<\/p>\n<p>APRS4R is written in Ruby (that&#8217;s what the &#8220;for R&#8221; ending means), and it is configured using a single text file. Here is the configuration file that I came up with.<\/p>\n<pre>--- !ruby\/object:APRS4R::APRS4RConfiguration\nversion: 1.0.2\ndevices:\n  device0: !ruby\/object:APRS4R::AX25SocketConfiguration\n    name: rf0\n    type: AX25Socket\n    enable: true\n    remote:\n    deprecated:\n    call: KR4JB\n    device: \/dev\/soundmodem0\n    port:\n    baudrate: 9600\n    mode: kiss\/tnc2\/northlink\n    speed:\n    duplicatePeriod: 20\n    timeout:\n    parameters: !ruby\/object:APRS4R::KISSDeviceConfiguration\n      name: kiss port\n      type: KISSDevice\n      enable: true\n      remote: false\n      deprecated: false\n      device: \/dev\/soundmodem0\n      baudrate: 9600\n      port:\n      speed: 1200\n      timeout: 300\n      txdelay:\n      persistence:\n      slottime:\n      duplex:\n  device1: !ruby\/object:APRS4R::ISSocketConfiguration\n    name: is0\n    type: ISSocket\n    enable: true\n    remote:\n    deprecated:\n    hosts: [third.aprs.net]\n    port: 14580\n    username: KR4JB\n    filter: \"# filter m\/100\"\n    duplicatePeriod: 20\n    timeout: 60\nplugins:\n  plugin1: !ruby\/object:APRS4R::BeaconPluginConfiguration\n    name: igate is beacon\n    type: BeaconPlugin\n    enable: true\n    remote:\n    deprecated:\n    device: is0\n    period: 1200\n    offset: 30\n    message: !ruby\/object:APRS4R::APRSMessage\n      source: KR4JB\n      destination: AP4R10\n      path: []\n      payload: \"!3546.30N\/07852.07W-&amp;APRS4R CARY NC\"\n  plugin10: !ruby\/object:APRS4R::GatewayPluginConfiguration\n    name: rf02is0 Gateway\n    type: GatewayPlugin\n    enable: true\n    remote:\n    deprecated:\n    call:\n    inDevice: rf0\n    outDevice: is0\n    localOnly:\n    replacePath:\n    path:<\/pre>\n<div id=\"attachment_411\" style=\"width: 210px\" class=\"wp-caption alignright\"><a href=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1735.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-411\" class=\"size-medium wp-image-411\" title=\"APRS.fi\" src=\"\/blog\/wp-content\/uploads\/2011\/08\/IMG_1735-200x300.png\" alt=\"\" width=\"200\" height=\"300\" \/><\/a><p id=\"caption-attachment-411\" class=\"wp-caption-text\">My house on the map at APRS.FI<\/p><\/div>\n<p>It&#8217;s kind of verbose, but it basically defines two devices called &#8220;rf0&#8221; (the radio) and &#8220;is0&#8221; (the internet).<\/p>\n<p>Then it defines a few &#8220;plug-ins&#8221;, which are actions. I use two actions: a <strong>beacon<\/strong> that sends my call letters and position to the APRS internet site, and a <strong>gateway<\/strong> that forwards (some) packets from the radio to the internet.<\/p>\n<p>If I had hooked up my radio to transmit as well as receive, then I would have also transmitted a beacon on the rf0 channel, and probably forward <em>some<\/em> of the incoming internet packets to the radio.<\/p>\n<p>The only tricky bits in this file were:<\/p>\n<ul>\n<li>For the &#8220;is0&#8221; destination, I chose a random host from a list that I saw in example files. Mine is &#8220;third.aprs.net&#8221;.<\/li>\n<li>The &#8220;destination&#8221; in the beacon is <code>AP4R10<\/code>. That is the code for the APRS4R software package. I have no idea why I send my beacons TO some oddly-named station to signify that I am using this digipeater software package.<\/li>\n<li>The &#8220;payload&#8221; string in the beacon is <code>\"!3546.30N\/07852.07W-APRS4R CARY NC\"<\/code>. It consists of a few parts: a bang, my latitude, slash (means &#8220;primary icon set&#8221;), my longitude, minus (means &#8220;house icon&#8221; in the primary icon set), and the rest is a comment with my software package name and my location city and state.<\/li>\n<li>I had a hard time choosing which <strong>SSID<\/strong> (dash number after my callsign) to use. I finally decided that it does not really matter, because there are several conflicting conventions. But I like using &#8220;KR4JB&#8221; with no suffix to mean &#8220;home&#8221;. I will use &#8220;-1&#8221; for my new handheld and &#8220;-2&#8221; on the (internet-only) OpenAPRS app my iPhone.\u00a0 If I buy more toys, they will get higher numbers.\u00a0 Balloons typically use &#8220;-11&#8221;.<\/li>\n<\/ul>\n<p><strong>Stuff I didn&#8217;t do &#8211; and why<\/strong><\/p>\n<p>There were other APRS4R plugins that did stuff like full two-way digipeating and sending beacons on the radio. But my station is a one-way iGate, so I did not need them. My station forwards packets that it hears on the radio to the internet. It does not forward internet packets to the radio.<\/p>\n<p>And my station is not a <strong>digipeater<\/strong>, it does not retransmit packets that it has heard on the air.<\/p>\n<p>I run my station as a receive-only iGate for two reasons:<\/p>\n<ul>\n<li>Most immediately, I did not have a cable to hook into the microphone jack of my mobile radio, and rigging up the PTT looks like a hassle.<\/li>\n<li>More importantly, you need to coordinate with other digipeaters and gateways around you before you start transmitting packets over the air.<\/li>\n<\/ul>\n<p>&#8212;<\/p>\n<p>This has all been a lot of fun, and I have learned a lot about packet radio.\u00a0 Since I went down a few wrong paths, I learned a lot of stuff that was not immediately applicable.\u00a0 But in this article, I have summarized the parts that got my receive-only iGate working in a single afternoon.<\/p>\n<p>Now I am waiting for my new APRS-capable radio to show up!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I was working with the NC Nearspace group on our high-altitude balloon, we experimented with two different methods of tracking it once aloft: ham radio APRS, and a commercial system called &#8220;SPOT&#8220;. We had some early failures with APRS.\u00a0 But over time, we have found that it&#8217;s a pretty nice technology, if you use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-387","post","type-post","status-publish","format-standard","hentry","category-geek","count-0","even alt","author-alan","last"],"_links":{"self":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/387","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":0,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/posts\/387\/revisions"}],"wp:attachment":[{"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/media?parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/categories?post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alanporter.com\/blog\/wp-json\/wp\/v2\/tags?post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}