Arduino KISS TNC

Create a Mobilinkd TNC on a breadboard for just a few dollars.

The Mobilinkd TNC1 started its life, as with many things these days, as an Arduino project.  It quickly took on a life of its own, first gaining Bluetooth capabilities when I discovered the latent abilities of APRSdroid.  And then gaining a battery and recharging circuitry before finally ending up as a product that could be mass-produced.

But underneath it all is still the Arduino project that it started out as.  With a few minor tweaks to the firmware to remove the Bluetooth and battery bits, the same firmware that runs in the Mobilinkd TNC1 will run on an Arduino.

Breadboard_TNC_1

The TNC doesn’t use Bluetooth, so you cannot use it with APRSdroid, but you can use other packet and APRS software on your computer over the Arduino’s USB serial port.

Shopping List

Here are the things you will need for this project:

  • Small Breadboard (IB401 w/Jumper Wires – $5; Amazon)
  • Arduino Nano v3 (Generic Arduino Nano v3.0 – $12; Amazon)
  • 10KOhm Resistor (Qty 3)
  • 100KOhm Resistor
  • 1KOhm Resistor
  • 2.2KOhm Resistor (maybe)
  • 10nF Capacitor
  • 100nF Capacitor
  • NPN Transistor (PN2222 or equivalent)
  • 3.5mm 4-pole jack (SparkFun BOB-11570 – $4)
  • TNC cable for your radio (~$10; Mobilinkd)
  • 3.5mm 4-pole extension cable (optional but recommended – $7; Amazon)

The resistors, capacitors and transistor cost just a few cents in total if you have them lying around.  Otherwise you can find a various starter kits that include the breadboard and a set of electronic components for around $20.

You can skip the 4-pole connector and wire a cable directly into the board if you want to save yourself a few bucks.

You will also need a computer (Linux, Windows or OS X) and a mini-USB cable to load the Mobilinkd firmware onto the Arduino and to run the APRS or packet software.

Getting Started

Take a look at the breadboard.  The pin rows are numbered from 1 to 30.  And the pin columns in the middle are labelled “a” through “j”.  There are power rails along either edge.  We will only be using the power rail closest to the “j” column for this project (the top two rows, red and blue,  in the diagrams below.)

Arduino

Plug the Arduino Nano into one end of the board.  The Arduino pins should start at row 1.

Breadboard TNC_bb_1

3.5mm Connector

Plug the 3.5mm connector into the other end, in column “a”, pins 27-30. The SparkFun connector will facing out the rear of the breadboard.

(The pinout on the SparkFun connector is different than the TRRS connector that I used in the picture at the top of this article.  Some of the parts in this tutorial will be in different places on the board than what is shown there.)

Breadboard TNC_bb_2

(Big shout out to Rick Waldron for the BOB-11570 connector component for Fritzing.)

Just note the following:

  • Sleeve is ground.
  • Ring2 is audio out (TX)
  • Ring1 is PTT
  • Tip is audio in (RX)

PTT Circuitry

Plug the transistor into column “a”, rows 21-23.  The flat part of the transistor is facing the nearest rail.

  • Emitter in a:21
  • Base in a:22
  • Collector in a:23

Run a wire from e:23 (Collector) to the negative rail (Ground).  Plug one end of the the 1KOhm resister into e:22 (Base) and the other into g:22.  Run a wire from j:22 to j:3 (Arduino D10) .  And then run a wire from e:21 to e:28 (3.5mm Ring 1).

Breadboard TNC_bb_4

PTT (Alternate)

If your radio does not use a separate PTT signal, you will need one additional component.  You will need 2.2KOhm resistor.  Instead of a wire from e:21 to e:28, you will need to plug the 2.2KOhm resistor from d:21 to d:17, and then run the wire from e:17 to e:29.  This multiplexes the PTT signal on the audio output line.  If you are using this with an Icom, Yaesu or Alinco HT, this is likely what you need.

Breadboard TNC_bb_4b

Audio Output

The TNC generates audio using PWM (pulse-width modulation).  This is filtered by the radio’s audio circuitry into a nice smooth audio waveform.

Plug the 100nF capacitor into e:29 (3.5mm Ring 2) and f:29, jumping the middle of the board.  Plug the 100KOhm resistor from g:29 to g:25.  Connect a 10KOhm resistor from j:25 to the negative rail (Ground).  Then run a wire from i:26 to i:7 (Arduino D6).

Breadboard TNC_bb_5

The two resistors form a voltage divider that takes the 0-5V audio output and reduces that to 0-500mV.

Audio Input

The TNC uses the ADC on the Arduino to capture the audio input, which is then decoded.

Plug the 10nF capacitor into e:27 (3.5mm Tip) and f:27, jumping the middle of the board as we did with the audio output.  With the remaining two resistors, plug one into j:27 and the negative rail (Ground), and the other into i:27 and the positive rail (5V).  Be careful not to short the resistors.  Run a wire from h:27 to a:4 (Arduino A0).

Breadboard TNC_bb_6

In case you are wondering, the pair of resistors are there to add a 2.5V DC offset to the audio signal.  This is needed because the audio signal comes in at about +/-1V.  The ADC on the Arduino can only handle input voltages between 0-5V.  With the offset, we get an audio signal that varies from 1.5-3.5V.

Power & Ground

Run a wire into a:12 (Arduino 5V) into the positive rail (5V).  Run a wire from i:12 (Arduino GND) to the negative rail (Ground) and from a:14 (Arduino GND) to the negative rail.  It is always a good idea to tie all of the ground connectors to the ground rail.  Finally, run a wire from e:30 to the negative rail.  This ties the 3.5mm connector’s sleeve to ground.

Breadboard TNC_bb_7

Checkout

That’s it for the hardware!  Go through the instructions one more time.  Make sure the wiring matches and that there are no shorts (easy to do with the bare wires on the discrete components).  If everything looks OK, we are ready to proceed to uploading the TNC firmware.

Firmware Installation

For this you will need  a program called “avrdude” and the firmware from the Mobilinkd GitHub site.  These instructions are going to assume that the firmware is being installed from a Linux host, but the process is very similar on Windows and Apple OS X.  The major difference is that “avrdude” is available as an easily installed component of most Linux distributions.  Getting and installing avrdude for Windows or OS X is a little more involved.

Download the firmware from the GitHub site.

https://raw.githubusercontent.com/mobilinkd/tnc1/arduino/images/mobilinkd-473-arduino.hex

You should have a file called “mobilinkd-473-arduino.hex”.

Plug the mini-USB cable from you computer to the Arduino.  Find the USB serial port being used.  It will typically be /dev/ttyUSB0.  On my computer it is /dev/ttyUSB1 because another USB device is plugged in.

Run the following command to upload the firmware:

avrdude -c arduino -p m328p -P /dev/ttyUSB1 -b 57600 -U mobilinkd-473-arduino.hex

You should see the TX/RX LEDs flash for a bit as the firmware is uploaded, and you are done.

You now have a fully functional KISS TNC with a USB serial port.  It has PTT signalling that, depending on how the circuit is configured, will work for just about any radio.

Leave the cable plugged into the TNC because this is how your computer will be communicating with the TNC.

Connect Your Radio

Before plugging in your radio, please be careful with RF around computers and in your shack.  The wires on the breadboard and the leads on the components are all small antennas.  It is best if you have an external antenna, keeping the RF well away from you work area.  Or you can use a dummy load while testing.  If you have neither of those things, please at least set your radio to low power.

Plug the extension cable into the 3.5mm jack on the breadboard.  Plug your TNC cable into your radio, making sure it has a ferrite bead on it.  Then plug the TNC cable into the extension cable.

Running APRS Software

The last step of the process is to run APRS software on your computer.  That is a bit outside the scope of what I had intended for this article.  Xastir is an easy-to-use GUI app on Linux.  Just set your software to connect to a KISS TNC on the same COM port that you used when you uploaded the firmware.  Set the serial port to 38400, 8N1.

If you are on Windows or Linux, you should be able to use the Mobilinkd TNC configuration programs to adjust the TX volume and monitor the RX volume, as well as set the various KISS parameters.

Connection Tracking Hack

This page provides instructions on how to modify the Mobilinkd TNC1 to allow it to track the Bluetooth connection state and to configure the TNC to drop packets when Bluetooth is disconnected.  This is necessary when using the TNC as a digipeater and iGate.

Please note: all TNCs that we currently sell include this feature.  This page exists to help those that purchased their TNC before May 2014.

The Challenge

The Mobilinkd TNC from the factory queues packets indefinitely. That’s great when you walk away from the TNC with your smartphone in your pocket, and then come back a few minutes later. All the packets that were received by the radio and decoded by the TNC get queued in the Bluetooth module and then downloaded to your phone when you return. The only downside is that the packet times are a bit off.

Georg Lukas, DO1GL, the author of APRSdroid, mentioned that, in order to use the TNC as a digipeater, it is important that old packets are discarded. Otherwise it is possible that old packets are digipeated and iGated. This is bad behavior on APRS and affects everyone in range of the radio and possibly the world if acting as an iGate.

It has certainly happened to me while performing routine station maintenance on WX9O-4. I forgot to turn off the TNC while doing an hour of maintenance. When I brought up the APRS system, to my chagrin, a bunch of outdated packets were digipeated and iGated.

How do we make this work?  This wasn’t a consideration when the TNC was designed.

The Solution

It turns out the Bluetooth module toggles one of its pins as the Bluetooth connection is established and dropped. But this pin is not connected to the TNC’s MCU (microcontroller). To make this work, we are going to need to break out the soldering iron!

The BT module uses PIO9 to indicate connection status.  It normally takes the pin high when connected and low when disconnected.

The TNC has an exposed ISP (in-system programming) pad that makes it possible to connect to three otherwise unused I/O pins on the MCU (MOSI, MISO and SCK, or PB3, PB4 and PB5).  We just need to connect the PIO9 pin from the BT module to one of the pads.

After a bit of work on the TNC firmware and the Bluetooth module configuration, I found that it is possible to configure the pin on the MCU to read high when not connected and to configure the BT module to hold its pin high when the BT link is disconnected and set it low when connected.  In this way, the only way the pin on the MCU goes low is when both connected to the BT module and the BT link is established.  That allows the TNC to easily detect that it has been modified.

The Upgrade!

To make this work,a few things need to happen:

  1. A 4.7kΩ resistor needs to be soldered be soldered between the PIO9 pin on the Bluetooth module and the SCK pad on the ISP connector.
  2. The TNC firmware needs to be updated to a version that supports connection tracking.
  3. The Connection Tracking option in the firmware needs to be enabled.ConnTrackBoardConTrackFirmwareAnnotated.jpg

Requirements

You will need a Mobilinkd TNC of course.

Parts

  1. 4.7kΩ resistor (1/8 watt)
  2. 2.5mm (.098″) shrink tubing cut to 37mm
  3. TNC shrink wrap

Tools

  1. X-acto knife
  2. Soldering iron with temperature control and a very fine tip
  3. Hot air gun (or a hot-air rework station)
  4. Solder braid
  5. Fine solder (.5mm/.020″) or solder paste
  6. Helping hands soldering stand
  7. Diagonal cutter
  8. Needle-nose pliers
  9. Electrical Tape
  10. ESD mat and wrist strap

Please do not attempt this modification if you do not have a good, temperature-controlled soldering iron.

Instructions

Be very careful of ESD (electro-static discharge).  The TNC can be damaged if proper care is not taken.  Perform the work on and ESD mat and use and grounded wrist strap.

Firmware

Start by upgrading the firmware to build 464 or later. (A more detailed post on upgrading the TNC firmware will follow.)

ConTrackFirmwareUpgrade

Disassembly

Start by removing the plastic wrap from the TNC. Be very careful not to cut yourself or the battery.

RemoveWrap1

Use a sharp X-acto knife.  Start with the hole by the slide switch.  Work the blade toward the near end first.  Then work the blade slowly and carefully towards the far end.  A sharp blade should cut through the plastic fairly easily.  Angle the blade towards the board and away from the battery.

RemoveWrap2

Peel the plastic away from the TNC and discard it.

RemoveWrap3

Unplug the battery from the TNC.  Pull on the plug or pull on the wires near the plug.  Do not pull on the battery.  Put the battery aside.

DisconnectBattery

Modification

You will be soldering a 4.7kΩ resistor from PIO9 on the Bluetooth module to the SCK pad on the ISP pad.  The resistor must be sheathed in shrink tubing to insulate it from the circuit board.  Both ends of the resistor will be soldered from the top of the board.

Diagram

Install a fine tip on your soldering iron and set the temperature to 315°C (600°F).

The amount of solder on the pads connecting the Bluetooth module varies.  You may wish to remove some solder from the PIO9 pad before soldering the resistor to the pad.  Use the solder braid to remove any excess solder on the pad.

Put a 2mm bend at one end of the resistor to form an “L”.  Use the helping hands to hold the resistor on the PIO9 pad.  This is the third pad from the end by the antenna, near the outer edge of the TNC circuit board.  (Refer to the diagram above if unclear which pad to use.)

Resistor

Solder the resistor to the pad.

Solder1

Slide the shrink tubing over the resistor.

ShrinkTube

Bend the resistor over the circuit board and slide the free resistor lead through the SCK hole.

Resistor2

Solder the resistor to the hole from the top.  Do not solder the resistor from the bottom of the circuit board.  And do not use so much solder that it flows through to the other side of the through-hole. Doing either may later damage the battery.

Solder2

Cut the lead flush to the bottom of the circuit board. It is important that the lead does not protrude through the hole.

CutLead

Cover the bottom of the pad with electrical tape to help protect the battery when reassembled.  Press down firmly.

ElectricalTape

If the resistor lead pokes through the tape, the resistor lead is too long.  Do not reassemble the unit in this condition.  Remove the tape and cut the resistor lead flush and try again.

HeatShrink

Set your heat gun to 155°C (310°F).  Shrink the tubing.

Testing

Attach the battery.  Wait at least 5 seconds then power on the device.

Start the Mobilinkd Configuration program and connect to the TNC.  You should see the “Conn Track” button active.  If it is not, verify that you have the latest version of the firmware installed and the lastest version of the configuration utility.  (The Android verions 0.8.3 is known to work.)

Enable “Conn Track” on the TNC and then exit the configuration program.  You should now find that the TNC receives packets only when the Bluetooth link is established.

Reassemble

The best option for re-assembly is to print or purchase a case!

The Mobilinkd TNC1 case is now a Thing on Thingiverse!  If you have access to a 3D printer, you can print your very own.  If not, we sell freshly printed cases in your choice of Black or White in the store: http://store.mobilinkd.com/collections/kits