Wednesday, February 02, 2011

PIC16F88 TNC

I have mentioned before that when I'm not in the shack I like to run a little program called aprsg to gate all the local APRS activity to a UHF frequency so I can see what is going on in the local APRS world using an APRS-capable HT. I have set up a system using sound card software, a USB sound device and my FT-817ND to do this. But I would like to make a standalone box for this. The first step in this project is to find a simple, cheap TNC.

There are products that would fit the bill from Byonics and Argent Data. Unfortunately they are not available in the UK and the cost of importing these kits from the US makes them less than cheap. I looked at the Fox Delta Mini TNC. But that is not a KISS TNC, as was confirmed by an email to Dinesh, the proprietor of Fox Delta.

Whilst searching around for possible solutions I came across a design for a TNC using a PIC16F88 microcontroller by WB8WGA that was originally published several years ago as an article in the ARRL experimenter magazine QEX. It has been modified by DJ7OO and ZL3AME, who had developed a stripboard layout for it. I had all the bits apart from the microcontroller and the clock crystal, which were quickly sourced on eBay. So I thought it would be an interesting project to build and experiment with.

ZL3AME's stripboard layout results in some quite lengthy signal paths. Despite this, the TNC worked first time, with just a minor glitch caused by my mis-wiring the PTT connection on the transceiver connector. (I have a standardized interface that I use on all my projects, with an 8-pin mini-DIN connector for audio and PTT to the transceiver, and a 6-pin mini-DIN connector for serial and GPS connections. I can then have a standard set of cables to hook the projects up to any radio, connect to the computer or a GPS, etc.)

With all the bits of APRS kit I have it was easy to generate some test signals and I soon had packets being decoded on the terminal screen. I wondered how sensitive the TNC would be as it uses the PIC16F88 to do the decoding instead of a modem chip like the MX614. I have not seen any DX packets decoded yet, but it does seem that decoding success is dependent on the audio level into the TNC. All of my APRS generators were decoded with the exception of my weather station, which has rather low deviation. When using the old Kenwood TH-205E as a receiver I could increase the volume so the weather station was decoded, at the expense of reliable decoding of the other radios. That was not even an option when using the DATA output of a radio, which has a fixed level. I suspect that performance could be improved if you could add an audio ALC on the input.

The TNC can also send APRS beacons and work as a fill-in digipeater. To send a fixed position you can simply encode the position co-ordinates into the beacon text. There are also a couple of jumpers that allow you to connect a GPS to the serial port, which would allow the TNC to work as a standalone tracker. I haven't tried that, since I already have a standalone tracker. There are no Connect or Disconnect commands so it cannot be used as it stands for packet radio.

This is not a KISS TNC, so it can't be used with APRSIS32 or aprsg or any of the software I use. I installed UI-View which apparently has the ability to use a TNC for APRS in Converse mode, but it doesn't work with that either. I think that is due to the fact that the TNC expects CR/LF at the end of each command instead of just CR, so fixing that will be the task of my first attempt at modifying the firmware. Other things I would like to try are making it work at 300baud (for HF packet) instead of 1200baud, and implementing KISS mode. In KISS mode the PC software provides the complete packet and the TNC just has to add a CRC and send it. So in theory it should be simpler to implement than the existing code which has to construct an AX.25 packet from the information entered plus parameters previously set in the configuration. We shall see. The TNC source code is written in assembler, and trying to understand assembler code is to me like not being able to see the wood for the trees. But it will be a good incentive for me to look "under the hood" at how APRS, packet and AX.25 really work.

Many of the links to original information about this project seem now to be dead and I had to do quite a lot of searching to collect the information I have. For the benefit of anyone else who would like to try building one of these TNCs I have assembled all the files and information I found into a zip file which you can download here.

4 comments:

Steve Bunting said...

Julian, the cross country wireless TNC is based on this design and does attach to UIV etc. As it is a commercial prodcut it won't be a cheap (or a much fun) as your HB version though.

http://www.crosscountrywireless.net/aprs_tnc.htm

dont forget that the basic argent data open tracker also has a kiss mode but is short of memory if you live in a busy area. 73 Steve

Unknown said...

Hi Steve. Yes, I came across the links on the CCW website. Chris has obviously done some modifications to the code but he hasn't released his modified source code. I am going to try to get that working first.

Unfortunately my recompiled version of the source won't run under the "Screamer" boot loader supplied with the original that allows you to update the program with the chip in the TNC. So I have to take it out of the socket and put it in the EasyPIC5, then put it back which is a bit of a pain. At least I can test the serial interface while it is in the EasyPIC5, just not transmitting and receiving.

Lynn (D) said...

Word to the wise, the KISS packet is byte-constructed for AX.25, but the TNC is still responsible for the "bit stuffing" as it serializes the bytes into bits onto the channel. So if you see one section of code that builds a byte-sequenced APRS packet (with bit-shifted callsigns, the "used" bit, and the "last" bit), that can go. But if you see comments about "bit-stuffing" as the bytes are bit-streamed into the modulator, you'll want to keep that!

Bob VE3MPG said...

Have a look at the TNC-X hardware here: http://www.tnc-x.com/ .

Price seems very good and lots of options and it's a KISS mode TNC.

Bob VE3MPG