APRS iGate – Part 3 AX25 Config

Now that the Raspberry Pi is configured we can get back to the radio part again, so lets start with configuring the TNC.

Configure AX25 axports file

Before we can start any ax25 configuration we need to define the call signs and ports in the axports file;

$ sudo nano /etc/ax25/axports

edit the last line to look like this;

# /etc/ax25/axports
# The format of this file is:
# name callsign speed paclen window description
1 VK5ZM-5 19200 236 2 145.175MHz (1200 bps)

Don’t worry about all the speed, paclen and window values just yet, copy what you see below.  These values are as described in the TNC-Pi user manual.

Configure Kissattach

Now before the ax25 tools can use a TNC it has to be attached to the kernel.  We’ll do this using a utility called kissattach.  This utility will create the necessary ax0 networking interface, we’ll assume our TNC will use the Serial Port ttyAMA0.  Lets test that kissattach will start;

$ sudo kissattach /dev/ttyAMA0 1

One note make sure that the IP address passed to the ax0 port is not part of your LAN, it needs to be different !  If you want to be old school you can always throw this into the 44.xx.xx.xx IP address range that was reserved for Amateur use, you can find more details here.

If you dont see any error messages type the following command;

$ ifconfig

look for the following lines;

 ax0: flags=67<UP,BROADCAST,RUNNING> mtu 236
 inet netmask broadcast
 ax25 VK5ZM-5 txqueuelen 10 (AMPR AX.25)
 RX packets 0 bytes 0 (0.0 B)
 RX errors 0 dropped 0 overruns 0 frame 0
 TX packets 0 bytes 0 (0.0 B)
 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

All going well we now have a working ax25 interfaces and most of the TNC configured.

Now we need to make sure kissattach is started after a reboot, so open the following file;

 $ sudo nano /etc/rc.local

We need to add the following lines somewhere near the bottom, I found that the maintainers of raspbian-stretch print the IP address to the console when the machine boots, so I added the following after this;

# starting ax0 interface using kissattach
if [ -x /usr/sbin/kissattach ]; then
  echo "Starting Kissattach: Binding port ax0"
  /usr/sbin/kissattach /dev/ttyAMA0 1

You can test this by rebooting and then checking if the service was restarted, but we’ll need to edit this file again before the end of this post so hang tight for a minute !


One of the more tricky aspects of configuring ax25 on linux is we must deal with is non-root access to the ax0 interface that we’ve just created.  On any Linux system you normally must have be root or use sudo to access any network interface.

So what we do is the same trick that admins do with the command ping and set the SUID permission bit on the axlisten file.  By setting this permission bit it will allow non-root users to execute this command as if they were root, without being granted any further root privileges.

$ sudo chmod 4755 /usr/bin/axlisten

now we can test it;

$ls -al /usr/biin/ax*
-rwxr-xr-x 1 root root 50836 Sep 20 2015 axcall
-rwxr-xr-x 1 root root 17516 Sep 15 2015 axgetput
-rwsr-xr-x 1 root root 43064 Sep 20 2015 axlisten

Depending on your shell you may find that the text “axlisten” is coloured with a red background.  If you look carefully at the user permission bits (highlighted above in bold) you should see that instead of an X for execute it has changed to an S for SUID.

Unless you have your TNC connected to a radio and channel traffic there is not much point in testing just yet, however if you do simply run;

$ axlisten -c

It can take time but you should see packets being decoded, the yellow LED on the tncpi will also light when a packet is decoded.

One thing I’ve noted (a of Feb 2018) is that axlisten has not been compiled with ncurses support in the latest Raspbian-stretch packages which means there is no colour support.  You will occasionally see “Could not initialize color support” (sic), wihch is annoying since raspbian-jessie works perfectly.  Hopefully the maintainers will fix this oversight at some point.  We can always compile ax25-tools from scratch, Charles K4GBB has an excellent tutorial and script here for those wishing to try this themselves.

Configure Mheard

The mheard daemon monitors the AX25 channels and records call signs that it hears along with some basic stats.   This can be handy for debugging RF issues and just generally gauging how well your node is working.  It’s much the same as the mheard function found in many packet TNC’s in the day.

To get mheard running we simply edit the rc.local file again;

$ sudo nano /etc/rc.local

Then add the following lines at the bottom of the file after where we start kissattach (see above);

# starting mheard daemon
if [ -x /usr/sbin/mheardd ]; then
  echo "Starting Mheard Daemon"

Now is probably a good time to test that we will survive a reboot;

$ sudo reboot

Once the Pi has restarted use the following commands to see what happened;

$ ps -aux | grep mheard
root 2049 0.0 0.0 1908 120 ? S Feb17 0:00 mheardd
$ ps -aux | grep kiss
root 413 0.0 0.0 1908 108 ? S Feb17 0:00 /usr/sbin/kissattach /dev/ttyAMA0 1

The mheard command needs to monitor the AX25 channels for a little while before it starts recording information, here’s an example of it working.

$ mheard
Callsign Port Packets Last Heard
VK5ZM-7 1 11 Sun Feb 18 09:52:04

If the output remains blank then using axlisten make sure you’re hearing traffic and that the receive LED (yellow) is being illuminated as traffic is heard.   This needs to be working before mheard will start to do something.

Now we can get onto alignment of the radio and some further testing in the next instalment.

Stackmatch Initial Tests

Well the Stackmatch PCB’s finally came back from the Manufacturer along with the components from Mouser, so it was time to build.  I’m pleased with the 3D model and the actual final assembly, they are pretty close !

This slideshow requires JavaScript.

I’ve not mounted the LED’s on the left hand side yet, this will wait until I can drill the front panel of the diecast enclosure and begin final assembly.  Since I’ve got more than one of these to make I’m getting a template made from steel that I can mount on the front panel and then drill all the holes.

The assembly in the picture above is the first prototype and I wasn’t going to wait for the front panel and die-cast box to be ready before testing.  The connectors have been attached at roughly the right height using an additional nut as a spacer, I’ve only fitted half the standoffs to save some time.

So the question is does it work?

The first test is simply a test of the isolation between ports.  So taking a spectrum analyser with tracking generator the idea is to measure the insertion loss between the input and one output as we switch between all three outputs one at a time and record the results.  All outputs are terminated in a 50 ohm load.  What is interesting with this stackmatch is we can also select “no outputs” where no relays are energised, this has a surprising result on the measured isolation;

This slideshow requires JavaScript.

OK, so what can we deduce from these series of plots.  The Spectrum analyser (SA) tracking generator was on the Stackmatch input, the SA input was on Output #1 unless you missed it.   As we switch each output from #1 to #3 we can see the insertion loss change.  As you would expect when we select output #1 we measure the insertion or through loss of the stackmatch, when we select any output other than #1 we measure the Isolation between ports.

Here’s the all important worst case summary, which is of course at the high end of the HF band i.e 10m;

  • Insertion Loss < -0.2dB
  • Isolation > 37dB

That is not too bad for a single device covering from 160m to 10m.  In real terms it means when we are transmitting 400W PEP (+56dBm) on 10m that less than 80mW (+19dBm) will be leaking out the other two ports.  The same can be said for helping prevent overload in the receiver from adjacent contest stations (i.e. on 20m).  The AREG typically use Elecraft K3’s and high end Icom transceivers so these typically don’t give too hoots about QRO contest stations on adjacent bands in the first place.     The best part is as we go lower in frequency the Isolation increases a further 10dB which can only improve the situation.

The insertion loss is barely measurable, so nothing should be getting really hot or require further bypassing.

Now what was also interesting is the difference in output isolation with no outputs being selected and just one.   The isolation to an unused port increased by +5dB to +6dB when the input was terminated into just one antenna.  That is something that we’ll need to take care of with our control system, not selecting any output is bad.

So then it was a question of moving the Spectrum Analyser input to Port #2, terminating Port #1 and repeating the above measurements again.  We do the same again for Port #3, shuffling the dummy loads and measuring once more.  I’ll not bother putting up all of these plots, suffice to say all of the isolation between ports were within 0.5dB of each other and insertion loss didn’t move.

Now for the main event, parallel combinations.

To do this we use a Return Loss (RL) measurement, so I’ve placed the RL bridge on the input to the Stackmatch and then terminated every output in a good quality dummy load, this is important !.  Then by switching the outputs in succession I can generate the various parallel combinations (25 ohms and 16.7 ohms) and then switch the transformer into to see the effect.  In all cases a 30pF Silver Mica cap has been tacked across the output of the auto transformer as per our previous experiment (click).  Here’s the measured plots;

This slideshow requires JavaScript.

So from our first plot where only one output is selected our return loss looks excellent with the minor exception of a spike at 8MHz.   I’m not sure that this is real just yet and will be doing some further work on what that resonance could be.  It’s got to be a parasitic capacitance there somewhere, will track that down later.   You might notice that the RL is better than -20dB (1.2:1) anyway, so a moot point really.

When we place output #1 and #2 in parallel we get 25 ohms and the RL rises to -10dB as you’d expect.  Then when we kick in the transformer we see an immediate improvement of RL to better than -18dB (1.3:1) at worst case (10m).

Now when we place all three outputs in parallel our RL is destroyed -6dB, but again if we kick in the transformer we see an improvement in RL of -13.5dB (1.6:1).  If you get your calculator out you find the ratios are smack bang on our design of 2.25:1.    So to summarise;

  • Return Loss (1-output) < -20dB
  • Return Loss (2-output) < -18dB
  • Return Loss (3-output) < -13dB

Yaay it works !

So there we have it, the beginnings of a workable stackmatch design.  As with any new design there is still plenty to be tweaked and played with.  In the coming weeks I’ll be;

  • investigating the effect of the cap across the output
  • chasing down that odd parasitic resonance at 8MHz with one antenna selected
  • measuring the temperature rise of the transformer with 120W of CW being blasted into it, or 300W of RTTY to give it some real curry…
  • Making the final enclosures and seeing what effect (if any) this has on the design
  • Trying #16, #20 & #24 gauge PTFE wire on the same core to see if the performance or characteristics of the transformer changes
  • Seeing what effect the +/- J term from various antennas has on the combined feed point impedance that our radio will see (thanks to David VK5DGR for bringing that one up !)

Yes it’s going to be a busy few months as we explore what this new toy can do.

Stackmatch Binocular Matching Transformer

Many stackmatch designs use a toroid core, but I’ve decided to  instead investigate using a multi-aperture “binocular” core.

There are not many manufacturers of large-ish binocular cores that can take the full VK HF limit of 400W PEP, let alone a full kilowasp amplifier !

So to start with I’ve chosen two well known binocular cores that you can obtain from various online suppliers;

  • Amidon BN-61-002
  • Fair Rite 2861010002

Both are the equivalent of each other in terms of price, size and material.  Both are made from Type 61 NiZn Ferrite material with a ui of approximately 125.   This material has good low loss properties and is essentially what others have used for their toroid designs.  It seems like a good place to start.

The transformer is wound the same way as if on a toroid, so take three wires, twist them together (battery drill helps) and wind the desired number of turns through the holes.   It seems sensible to start with a full core and take turns off if I achieved too much inductance.  Both of these cores hold ~4 turns of trifiliar wound 20AWG silver plated PTFE wire, it might add the last turn is hard to do.  All that is left is to series up the windings and tap at the appropriate positions, the schematic is to the right.

To make my measurements I decided to use a variable resistor (R1) to check the effect of load change on the transformer.  I had also seen some designs using a small amount of shunt C across the output to neutralise the output leakage inductance as well, so I placed a variable cap across the variable resistor when needed.

To make these measurements I’m fortunate to have a Spectrum Analyser with tracking generator and a suitable Return Loss Bridge.  The return loss bridge has a directivity of > 45dB at HF.  This means I can see how much energy is being transferred to the load resistor (R1), any RF energy that is being reflected back to the spectrum analyser is therefore wasted, so in all of the screen captures below the lower the Return Loss the better !

You can see the experimental setup in the image below and my initial measurement on the kitchen table…

I’d start these measurements by adjusting R1 until I achieved the lowest Return Loss and then remove the resistor temporarily and measure it separately with a 4-digit ohmmeter.  I wanted to check that I was close to 22.2 ohms in all cases.   With such a low resistance don’t forget to deduct the resistance of the multimeter leads.

Once I had confirmed the impedance transformation was correct I would then tack the trimmer cap across R1 and start with it completely un-meshed (min C).   The cap on the secondary side of our transformer will assist in “tuning” out the output reactance (Xs) of the transformer a little and improving the return loss at the upper end of our plot.

However there is a null that will occur at the low end of VHF that you need to be wary of as it can be unstable, you can if you have enough capacitance bring it into HF spectrum which is not advisable.   You will easily see the point where I’ve added too much in the sequence below.   What you’re looking for is just enough turns to give you the broadest match possible with the smallest value of C across it’s output.

Here’s a sequence of plots showning what happens as you increase C from min (5p) to too much (120p).  This was with 3 turns wound through the core, R1 approx 22.3 ohms;

This slideshow requires JavaScript.

So in the above sequence you can see what the effect that the capacitance has across the output.  As we keep adding capacitance the return loss kept getting better and better before the null appears.  The ideal compromise was somewhere between 65p-80p.

What you can also do is widen out the frequency from 1-200MHz and watch what effect any nulls will have on the response.  It also pays to vary the load (R1) and see what happens as the load decreases below and above the desired match.   I found that as the output impedance goes up the null has a much more prominent effect as the load is varied.

So starting at 4 turns I checked the impedance ratio and then wen’t looking for the best compromise in terms of response, stability and lowest capacitance.   Below are the three best candidates that I found;

This slideshow requires JavaScript.

So as we reduce the turns (inductance!) we see the return loss decrease at the low end, but we also see the required capacitance to flatten out the upper end also reduce.   Based on these measurements the best compromise I found for this transformer is 2T C=30p.   Ideally a return loss less than -20dB is a good target to aim for, I’ll let the reader work out what the equivalent VSWR is for this RL value (hint: it’s low, for additional points also take a look at a RL of -10dB for reference !).

Now to check that this is stable I’ve included a plot that is much wider in terms of checking the VHF region for signs of that null we wish to avoid.  Hmm, this combination is potentially usable up to 6m, now there’s an idea for another day.

Sweet no signs of the null being anywhere close to the MF/HF bands I want to operate over.

Now the ultimate test is to make two of these transformers, place them back to back into a 50 ohm load then measure the insertion loss. That will give me some idea on what sort of loss this transformer will have an ultimate how hot it will get when I attempt to pass 120W CW/FM or 400W pep of SSB.

More to come.