Monday, April 29, 2019

FSK RTTY via Serial Port and in Linux

This is a quest that started a few years ago, more for the technical challenge than for any operational advantage. The goal is to utilize FSK rather than AFSK for TX, and to RX using a hardware modem rather than via a PC sound card. Essentially, just use a rather light terminal mode in an old-school fashion.

Naturally this is not ideal for contesting nor the most effective for general contacts in this day and age. Instead it's just exploring the simplicity of the two-tone FSK scheme. I've recently gotten back into CW and can better appreciate how the simple pulsing of tones is pretty effective even when the band fades. Not as efficient as the newer and well-engineered PSK schemes of course, but the brute force approach still has its charm.

Why not just use the pseudo-FSK with fldigi? Well, I have built the circuit and can report it works very well, and hope to write an entry on that endeavor soon once I get the final version wired up.  Again, this is an exercise in letting the hardware do most of the radio interfacing and so the software just needs to handle the Baudot translation and be intuitive to work with, maybe do some simple logging to a file from which to skim what's needed for QSO logging later on.

Another part of the goal is to work in Linux, since my shack operations are all done in Kubuntu, with the exception of a few things I've tried in native Windows when required. Since the termios.h is well documented there are plenty of examples for doing this in C++.

As for the hardware side, this was a bit more of a search. Most of the examples for receiving centered around the use of the DTR pin and software timing, whereas to use hardware timing we would use the RX pin set at the desired rate.

Another challenge is that the newer serial drivers in the Linux kernel have integer params and not floating-point, and so we can't specify a decimal for the baud rate (i.e. 45.45). But since transmitting FSK from a serial port only requires a transistor switch, I set up a test for this and was able to decode perfect copy when transmitting via dummy load and decoding from a different transceiver with fldigi, specifically, with the serial port set to either 45 or 46 bps. This was quite encouraging.

At this point I had spent not a few evenings sending text back and forth through a serial port using Baudot, serial port set at 5 bits, etc. Only recently did I start using a port emulator (tty0tty, akin to com0com for Windows) for such testing, but it was good to verify that the interface to the hardware was all in line.

On to the receive hardware, for which I had originally tried using a tone decoder, to little success. But eventually I came across the spec sheet for the LM565 PLL, which I remembered from Radio Shack catalogs growing up as usable for an FM tuner (along with trying to convince Dad that it was possible to do that without a varicap, miss those days).

It didn't take long to figure out that the 565 had recently gone out of mainstream production, is only available in a new pressing from hobbyist-friendly NTE, or NOS here and there for about the same price as NTE, or else...yeah, from the far east with questionable authenticity or quality. Given the experimental nature of all this I decided to roll the dice and grab 4 chips for about the price of one of the other choices. My experience was that even the counterfeits would work well enough for proof of concept, and that's what I'm after, for now.

So the chips arrived and I went to work breadboarding a circuit, testing the decode with an LED pulse that looked like RTTY pulses - HUZZAH. But then, getting the signal to read pure text in my test program was another matter. At best I would get some of the first characters then garble. It sort of looked like the timing was wrong, but then, I wasn't sure that it was pulling the RX voltage below zero, there wasn't a strong bias "south of the border" so it was questionable as to whether it was really triggering the pin. Also, I was beginning to wonder whether the National Semiconductor sample circuit was compatible with a serial port, being designed to hit a printer head magnet.

All this came about at a time when I was packing up for a move and life change, so it got shelved. Somehow I never took apart the prototype, and recently decided to give it another go. In the interim three years, Arduino boards have come about. Originally it was very clear that this concept won't work with a USB serial dongle, as these typically just don't work below 300 bauds, and why should they? A quick google indicates folks are doing RTTY/FSK already with an Aduino board, but still I'd like to take this as far as possible on the original vector using standard RS-232.

What I discovered recently is that all I needed is to

a) Emulate the voltage comparitor circuit using a 741 op amp
b) Find a very standard darlington-ish circuit for TTL/RS232 interface AND mind the polarity on the 1 μF electrolytic capacitor that has the poles reversed, that seems to provide the proper negative bias, and
c) Correct a capacitor value in the original 565 circuit,

Also, for the TX and FSK lines to the rig I had originally wanted to use optocouplers, but It appears there is not enough drive current for these. I didn't really spend a lot of time trying them since NPN transistors are pretty good at this, so we could always revisit if needed.

Once all this came about I was amazed at the accuracy of the receive when using audio generated in fldigi. It's still impressive when feeding it recorded W1AW bulletins (with filtering enabled on the receiver rig).

At this point I have found the recipe that couldn't be found anywhere else, i.e. demod of the FSK and feeding it to the RS232 RX and it works better than I'd hoped for a possibly subpar 565 chip.

I also have the fortune of a working terminal UI coded in the Qt platform, designed in Linux but conceivably usable on any of the Qt-supported environments. It's very basic and intuitive to use, reads the modem info from a config file and if it can open the port it begins receive mode. Then, just hit Enter in the TX box to start transmit and then type. There's a timer that reverts to RX after about 1.5 seconds.

So we have a proof of concept for this. It can be done, and there's other things to explore. Not planning to solder up the 565 version, but rather explore the TI CD4046 chip, which appears to be a similar concept but with a simplified external component selection scheme.

This is how it's wired for an Icom rig, using the 13.8 V bus for power. This hasn't shown to be a problem although we have to bear in mind that the PLL sync frequency is generally tied to the supply voltage.



I should point out that to date I have only had a handful of RTTY contacts, mostly just touch n go DX, but there was one that really sticks out as an impetus for pursuing this. One evening as 20 meters was going long to the west I answered a CQ from Ken, K6SAD in California, he turned out to be a long time aficionado of the mode and was even running a HAL. The entire exchange from 14.085 on the dial is further down.

This endeavor feels like something like a custom kit ride that gets taken for a spin on a nice day, just for kicks.. The traditional RTTY segments of the HF bands usually seem rather quiet during non-contest or event times. Recently when trying CQ using the pseudo-FSK with fldigi I did get a comeback, but then the band was not in the greatest shape so I just caught a wisp, but it was encouraging. 

One important thing to remember is the rig will use the lower sideband for FSK, so try to keep out of the way of the JT/FT folks when selecting a frequency above 3580, 7080, 10142, 14080, etc. 

*****

UPDATE Nov 2019: Have been looking at an Arduino version of this concept using a 4045 PLL since realizing that an Uno with the ATMEGA USB interface handles 45 baud serial.

Also ended up taking this on the air (in breadbord form) and made 33 contacts during a weekend contest - learned a LOT and it was rigorous fun. Just now getting this soldered up and will use that good breadboard to work on the Arduino/4046 concept.

*****

CQ CQ DE K6SAD K6SAD K6SAD
CQ C  CQ CQ CQ CQ CQ CQ CQ CQ CQ CQ CQ CQ DE K6SAD K6SAD K6SAD
KK
LZ
K6SAD DE N8VWY N8VWY N8VWY K


YE

N8VWY DE K6SAD. TKS FOR THE RETURN. LOOKING FOR A REAL RTTY CONTACT.

NAME HERE IS KEN KEN. LOCATED IN NORTHERN CALIFORNIA. HAVE NOT BEEN ON

HERE FOR SOME TIME AS GOT TIRED OF JUST GETTING BUFFER QUEENS COMING
BACK. BACK TO YOU. N8VWY DE K6SAD KKK

K6SAD DE N8VWY THANX FOR CALL KEN, GOOD TO HAVE A REAL RTTY CONTACT
AS WELL. AM FAIRLY NEW TO GDIGI MODES AND ESPECIALLY RTTY.L   
RST   NAME MIKE MIKE QTH COLUMBUS OH USA LOC EN80 EN80 THAT IS MY BUFFE
R THERE FOR CONVENIENCE. YOUR RST IS 599 599 .BTU KEN K6SAD DE N8VWY
K

SDM
QVKGVN8VWY DE K6SAD; TY ON SOME OF THAT MIKE. YOUR NOT MOVING THE METER
HERE AT ALL. BUT GUESS GOT ABOUT 50 PERCENT PRINT. RUNNING ABOUT P
WATTS HERE TO AN OLD FIVE ELEMENT MONO BANDER THAT SHOULDBE LOOKING
RIGHT AT YOU. USED TO WORK A GROUP ON THIS FREQ BUT LIKE ME THEY ALL
GOT OLD AND SOME NO LONGER HEE AND THE GROUPLJUST IS NOT THERE ANY
LONGER. USED TO CALL IT THE WHITE HAIR FREQ. HI. RIG HERE IS AN ICOM
775 AND DRIVING A DRAKE L7 RIGHT AT THE MOMENT. AND THE RTTYS ALL OLD
HAL GEAR. ALL DEDICATED STUFF. SO THAT IS IT HERE. AND THE HOBBY JUST
IS NOT WLAT T WAS IN THE PAST FOR SURE. I STARTED USING THIS MODE IN
61. 61. SO A EW YEARS BACK. N8VWY DE K6SAD KKK
GBK
B
K6SAD DE N8VWY FB THERE KEN, I HAM USING THE FLDIGI SOFTWARE, IC-756
PRO RUNNING ABOUT 50 W 50 W CURRNENTLY. SEEMS MOST OF THE QSO IS ON
PSK MODE THESE DAYS AND SO ALL I SEE ARE CONTESTERS AND SUCH ON RTTY
MODE, BUT GLAD TO USE SOEMTHING SO CLASSIC. BTU KEN K6SAD DE N8VWY K


N8VY ZZZZZ N8VWY DE K6SAD. OKAY ON MOST OF THAT MIKE. FINE ON THE 50
WATTS. NOT SURE WHAT THE ANTENNA IS. OKAY. JUST GUESS THE BAND IS NOT
THAT GOOD. SO WILL NOT HOLD IT. DO THANK YOU FOR THE CONTACT. FIRST
CONTACT HERE FOR SOME TIME. JUST HAVE NOT BEEN GETTING ON IT. OKAY.
THANKS AGAIN MIKE AND WILL PASS ALONG THE 73ES FOR NOW. N8VWY DE K6SAD
SK SK

K6SAD DE N8VWY FB KEN , BTW SOLID COPY HERE ON ALL THAT, FB ON DEDICATE
D EQUIPMENT. BAND IS IFFY SO WE'LL NOT HOLD IT EITHER. ANTENNA IS END
FED WITH COUNTERPOISE, 85 FEET LONG. THANKS AGAIN AND HOPE TO HEAR YOU
AGAIN, ALL THE BEST,
TX 73 K6SAD DE N8VWY SK