RTTY Modulator
Andrew Kilpatrick VE3KOB
Introduction
For a long time I’ve thought it would be cool to build some sort of a modem. And finally I had the need for something that could send low-speed wireless data from my GPS to a computer. There are many ways to do this, but I wanted to make something that would use audio tones so that the data could be sent over any audio link, recorded as audio, etc. This would give the most flexibility in the transmission medium.
Ham radio operators have used RTTY (Radio TeleType) for years on the HF bands to send low-speed text data over the air. This technology came from original teletype machines, and the encoding is Baudot, not ASCII. Basically, it’s 5 bit data with a start bit and either one or two stop bits, sent at 45bps. Using standard frequencies of 2125Hz for 1 and 2295Hz for 0 (170Hz shift) means that it will work with any equipment set up to receive RTTY. Conventionally RTTY is sent by changing the carrier frequency by 170Hz. Receiving stations adjust the tuning until they hear the two tones at the correct frequency. That is called FSK. (Frequency Shift Keying) With the advent of FM transmitters, etc. it was useful to be able to simple send the tones, so AFSK (Audio Frequency Shift Keying) was created. All it means is that the tones are generated and sent as audio.
There is a great free program called MMTTY (check Google) which uses the PC sound card and some DSP code in software to detect RTTY tones and display the data on the screen. It works very well even with noisy or weak signals. This is the program that I use on the receiving end. It can transmit as well, if you have a Windows PC at both ends of your link. My project is designed for transmitting ends that require a minimal amount of equipment. It’s quite possibly one the simplest data modulators that can be made.
Description of the Modulator
My circuit uses a PIC18F252 microcontroller to receive serial data from a GPS receiver, store a message, and generate the AFSK tones. The only additional part is a chip to interface RS232 to/from the PIC. If you want to use my circuit to connect to other serial devices, you can change the code. My code is designed to interface with a Garmin GPS. You could also just generate data internally using other data pins or analog inputs to generate data. There are lots of applications.
Here is a simple description of what my circuit and code does:
- Receive signals from a GPS receiver. These are received at 4800bps. The GPS sends lines of text, so a line is buffered in RAM, and the end of line (CR or LF) is detected.
- Characters are added to the send buffer and converted into Baudot. Many ASCII characters are not supported in Baudot. My conversion code inserts spaces for invalid characters.
- Once a line is received, the RTTY send sequence is started. During sending, data from the GPS is ignored.
- The RTTY code uses two timers in the PIC to generate the bit timing and audio timing. The audio is generated in the PIC and the tones come out of RB0. RB1 is also used, and it sends out the raw data which can be used to drive an external tone encoder or some other sort of data transmitter if you like. It’s also handy for looking at the data on a scope.
- Once the message is sent, new data is received from the GPS. A counter keeps the unit from transmitting too frequently, saving battery power on the transmitter. A 2 second pilot tone is generated prior to each transmission to allow the radio vox circuit to key up the radio.
Circuit and Code
You can download the circuit diagram and the code. The code is written in C and is compiled with mcc18, which is available for free from Microchip. You notice that my circuit uses a MAX3084E chip for RS232. It’s actually for RS485, but I found that it works for RS232 as well. The speaker is a little cheap speaker out of a small LCD monitor.
- RTTY Modulator Circuit - the schematic of my circuit (PDF)
- rtty_modulator-1.0.tgz - the code
Please don’t email me with questions about compiling the code and burning the PIC. If you can’t figure that out by yourself then this project is too complicated for you.
Interfacing with FRS Radio
FRS radios are really cheap, and I have wanted a pair for a while. I got a pair of Sylvania radios that have NiMH batteries and audio in/out jacks. I found that the push to talk is implemented by applying a load across the mic input. The 1K resistor on the audio out is enough to make the radio key up. If you want to leave the radio keyed up, use the 1K resistor. If you want to use the VOX circuit in the radio to automatically key up the radio, leave out the resistor.
The audio is input to the radio through the mic jack, which is a sub-mini jack. I have an adaptor from 1/8″ to sub-mini. The audio level seems quite fine with this arrangement, and I have no had to use any sort of level control. The sound on the receiving radio doesn’t sound distorted. Too much distortion will cause the computer to have trouble copying the signal.
On the receiving side, the headphone jack on the receiving radio is used. My laptop only has a mic input jack, not a line input, so I made a special cable with a pot to act as a pad. Otherwise the audio level is far too high and the sampled audio is grossly distorted. With MMTTY running, the data from the PIC is copied perfectly!
Improvements
Feel free to suggest your own improvements, and send me changes to the code or circuit if you wish. Here are a few of mine:
- Support higher baud rates. I tried several higher rates, but they didn’t work as well. I’m not sure if my crude tone generation is not very good, or what. Using a simple timing loop calculation only works at fast rates. My tones have been carefully tweaked, because as the loop timing gets faster, the time that code takes to execute needs to be factored in. For 45bps, the loop time doesn’t take into account the code execution time, but at higher rates it might matter more.
- Complete the character conversions so that more ASCII characters are supported.
