#1 2016-02-14 19:05:53

From: southern Italy
Registered: 2016-02-09
Posts: 2

MicroModem 23B works! example scripts

I got my Unsigned.io MicroModems working under Linux.

By default they talk KISS protocol.

I attached one to an USB port of my Linux PC and identified it as "ttyUSB2" - look at serial port names ad watch out for the latest one inserted:

ls -al /dev/serial/by-id/

(will look like usb-FTDI_...-if00-port0 -> ../../ttyUSB2 - that is, it's currently the "ttyUSB2" port).

I installed the common ax25-apps and ax25-tools packages (almost any Linux distribution ships them).
1. Create the /etc/ax25/axports configuration file containing only:

# portname  mycallsign portspeed paclen window description
aprs        KJ4HDR     9600      256    7      my APRS shack

2. "Attach" the port to the portname:

sudo kissattach /dev/ttyUSB2 aprs

3. Listen for packets and show on the terminal:

sudo axlisten -c -a

The Linux kernel interface has a number of benefits, including the use of the KISS modem as a real network interface (i.e.: you can route TCP/IP traffic from/to the "ax0" interface, while sending/receving APRS data on another "ax1" interface, and so on).

If you only need APRS without fancy stuff (multiple modems, digipeating, etc), there is no need to use the Linux kernel driver: you just have to read and parse KISS packets coming from the modem serial port (the MicroModem). I use the Device TNC KISS library to extract KISS packets and the Ham Finnish APRS Parser library to parse the encapsulated APRS data (the guys at aprs.fi did a pretty good job).

Example source:


# requires CPAN libraries:
#   cpan install Device::TNC::KISS Ham::APRS::FAP

use Ham::APRS::FAP qw(parseaprs kiss_to_tnc2);
use Device::TNC::KISS;

my %config = (
  'port' => '/dev/ttyUSB2',
  'baudrate' => 9600,
  'warn_malformed_kiss' => 0,
  'raw_log' => '/dev/null'

my $micromodem = new Device::TNC::KISS(%config);

while(my $kisspkt = $micromodem->read_kiss_frame())
  # kiss_to_tnc2 expects a kiss packet without leading/ending 0xc0 byte:
  $kisspkt =~ s/^\xc0//;
  $kisspkt =~ s/\xc0$//;
  $pkt = kiss_to_tnc2($kisspkt);
  %data = ();
  $aprs = parseaprs($pkt, \%data);
  if ( $aprs == 1 )
    print "aprs: ok\n";
    while ( ($key, $value) = each(%data) )
      if($key eq 'capabilities' or $key eq 'wx' or $key eq 'digipeaters')
        if($key eq 'digipeaters')
          while(my($kk,$vv) = each $value)
            while(my($kkk,$vvv) = each $vv)
              print "digi_$kk" . "_$kkk: $vvv\n";
          while(my($kk,$vv) = each $value)
            print "$key" . "_$kk: $vv\n";
        print "$key: $value\n";
    print "aprs: error\n";
    print "resultcode: $data{resultcode}\n";
    print "resultmsg: $data{resultmsg}\n";
  print "\n";

# ---

Note that most of this Perl script deals with printing arrays and arrays of arrays (station capabilities, weather stations, digipeaters in the path).

A coworked donated me an old Yaesu FT-23R radio. I attached it to the MicroModem; the MicroModem to a serial port terminal ("minicom" configured with 9600/N/8/1), tuned the radio to 144.8 MHz (local channel for APRS) and got KISS-encapsulated APRS packets on the terminal.

Note that raw KISS APRS data appear as ugly binary-encoded chunks followed by some human readable fields:

aprs-packets-micromodem.png (screenshot)

One of my old hobby projects was sampling true radio APRS traffic and automatically sending every 24 hours the daily summary to a blog (publishing a page to a blog is as simple as sending an HTML-formatted email to a predefined address). I used to read plaintext APRS packets from an old Kenwood TH-D7 radio (which features an RS232 TNC and a number of APRS functions). Back then, when using "parseaprs" function of the Ham::APRS::FAP I needed to set "isax25" parameter to "false", because the TH-D7 outputs data in "TNC2" mode instead of "KISS":

aprs-pulito.png (screenshot)

To work with the Yaesu and the Micromodem, I just had let the "isax25" to its default value "true".

My home server (running 24/365) is a 12-year-old Pentium M: it needs less than 1% CPU time to decode some thousands of KISS APRS packets per day.

I also got the TH-D7 correctly getting and decoding APRS packets sent with the MicroModem, without having to tune any parameter. MicroModem just worked out of the box.

I got also a second MicroModem, I am planning some contraption to install on my bike.

My scripts are avalable on github (link here).

Last edited by KJ4HDR/I8 (2016-02-14 19:07:40)


#2 2016-02-25 12:39:05

Registered: 2014-12-01
Posts: 127

Re: MicroModem 23B works! example scripts

Thanks a lot KJ4HDR for this post! This is a great reference for anyone who wants to set up MicroModem with the native linux drivers! Good job!


Board footer

Powered by FluxBB