Project Software
Software to control a Teletype with Raspberry Pi GPIO interface
Background
Since High School, I've surfed shortwave radio utility bands. These frequencies contain commercial and military traffic, which use "advanced modulation".My two specific areas of interest are Radio Teletype (RTTY) and Radio Facsimile (FAX) transmissions. During the late 70's and through the early 90's, the HF radio spectrum (3MHz-30MHz) was quite rich with many interesting utility band broadcasts.
Between 1979-1990, I amassed quite a collection of surplus military radio, RTTY and FAX equipment. Over time, I realized I was acquiring the "best of breed" equipment, mostly used by the Navy.
I've retained a small portion of that collection to this day. Today the HF utility bands are not as exciting to monitor, yet there still remains some weather FAX (WEFAX) and weather-related RTTY traffic.
Today's go-to technology for receiving this traffic is a computer. Equipped with an audio card, both RTTY and WEFAX can be easily rendered by laptop/desktop computers. In the early 80s, this was not true. Personal computers were very expensive, and beyond the reach of a teenager communications technologist.
My first teleprinter was a Model 15 Teletype. This was mostly a automated typewriter. Using a clever combination of electromagnets and mechanics, these devices implemented a "serial port" supporting 5-bit Baudot code. This equipment was acquired at a Ham Fest in Wheaton IL, one very cold winter weekend. The trick then was to bring this equipment to life, and actually print something. This is where my youthful interest in electronics and shortwave radio were further developed. This heavy, noisy equipment became my pride and joy when I finally was able to print news feeds from shortwave radio.
I quickly learned the Model 15 was limited, by only supporting 60WPM, or 45 baud, traffic. Most press outlets on the HF bands used 66WPM, or 50 baud traffic. Listening to the "tweedle-tweedle" frequency shift key (FSK) audio signals, you could tell the speed of the broadcast, with a little experience. There was obviously still faster traffic, which turned out to be 100WPM, or 75 baud, traffic.
By today's standards, these speeds are painfully slow. However, for mechanical teleprinters, 100WPM, or 10 characters per second, is actually quite impressive to see in action.
Model 28 ID Tag |
Images of my Model 28 printing a test pattern from my Raspberry Pi:
Model 28 Printing Test Pattern (close up) |
Front view of printing teletype:
Model 28 Printing (front view) |
Model 28 Selector Unit (front) |
Close up views of data selector unit, where binary 1's / 0's are converted mechanically to 5-bit codes. This is a mechanical serial port.
Model 28 Selector Unit (solenoid) |
The Project
The Raspberry Pi Teletype Project's goal is to bring back the press feed printed on the Model 28 Teletype I retain from my collection of surplus military radio gear. Using breaking news emails as a source of data, the Raspberry Pi is both an email filter and a teletype driver.The Raspberry Pi GPIO (General Purpose I/O) pins are ideal for such a project. The interface to any teletype is primitive: a single solenoid used to key 1's and 0's data into the mechanical data selector of the Teletype. Using one GPIO pin to send a stream of binary Baudot code data to the Teletype, with some simple electronics to interface the Raspberry Pi with the Teletype, this 50's vintage teleprinter is back in operation again.
Step One: RPi LED "Blink"
Having no Raspberry hardware programming experience, I searched for demo projects which expose this functionality. The WiringPi project an programming API to access to the GPIO / UART / PWM pins on the Raspberry Pi. Nice. Example one: "Blink".RPi Blink wiring |
Here is the full table of Raspberry Pi GPIO pin wiring.
Link to Raspberry Pi GPIO Heder Model A&B P1 Header (wiringPi Project)
Next test: Can the GPIO pins be cycled on/off quickly enough to control a Teletype. Just modify blink.c to delay 22ms, vs the 500ms value in this example. Running that code, you can't visually tell what is happening. So I tried 44ms, which is slow enough for my eye to see the LED is actually blinking. From this success, I assumed 22ms worked, I just couldn't see it. Yes, I could have hooked up an O-Scope, but this test seemed good enough.
Step Two: Controlling the Teletype Loop Current
GPIO Relay Control (Note: Wiring above is for NC relay!!) |
The final piece of this project is the Raspberry Pi software to convert input text to Baudot code. That ASCII to Baudot code conversion, and then finally to a bit stream to key the Teletype solenoid magnets is performed by this small software project. Github rtty-rpi Teletype driver project.
To build this project, you must have make and the GCC C compiler installed. Additionally, there is a dependency on the wiringPi project, which is simple to install:
sudo apt-get install wiringpi
Once these prerequisites are met, just run "make" in the rtty-rpi project.
To test, run this command:
sudo ./rtty-pi --test-data
This will print the following test pattern:
THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG'S BACK 1234567890
RYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRYRY
You can also type data from your computer in "real time" using this command:
sudo ./rtty-pi --keyboard
To exit the --keyboard option, you MUST type this sequence of keys: <ENTER>NNNN.
Please note: The default data rate sent by this project is 60WPM. Should you have a Teletype with a gear shift for other speeds, such as 66WPM, 75WPM or 100WPM, you should use the --wpm option.
Example: sudo ./rtty-pi --wpm 75 --test-data
Your other option: Set your Teletype gear speed selector to 60WPM.
You can investigate other options with the --help command.
Model 28 Teletype Operation Details
The incoming bits from the Baudot signal are decoded by the Teletype Selector Unit - essentially a serial modem mechanically implemented. The question that eluded me for years is just how does the Teletype decode the bits to a specific typing pallet on the type box?
This view is the front of the type box. The Teletype moves the type box left/right and up/down based on the incoming code value, and then the typing hammer "pecks" the back of the pallet to print a letter on the paper.
This is the font side of the type box:
Notice the rows are perfectly horizontal, but the vertical columns are not perfectly vertical, following a "curved arc" pattern. This curiosity hits at the complexity of the Model 28 operations, and now much engineering precision was involved in the development of this device.
For the seriously curious, here is a Navy training manual for a specific Model 28 Teletype. This link jumps to the section describing how a received code is converted mechanically to selecting a type box pallet.
Model 28 Navy training manual: Pallet selection
The full manual can be read. Warning: This document is very, very pedantic, and plodding reading. However, to truly understand how this mechanical wonder works, this is a great reference source.
No comments:
Post a Comment