The Teletype Corporation Model 15 "typebar page printer" is a beautiful piece of equipment from the 1930's. While the interface has much in common with modern serial communication standards - start bits and stop bits, asynchronous clocking, idle-high conditions -- in the teletype all of these are implemented purely mechanically. The mainshaft looks like something out of an automobile instead of a piece of computing. Just like a car, you have to keep it well oiled, check the gaps for proper clearances and be very wary of the spinning pieces while working on it.
The 5-bit Baudot words are clocked in synchronously with the mainshaft's rotation rate at 45.5 baud (22 ms per bit). This slow speed is difficult to generate with modern computers and serial ports, so many users bit-bang the port with Heavy Metal, which itself requires somewhat older machines to run. The 5-bit word has only thirty two entries, which is insufficient to simultaneously represent the entirety of the twenty six letters A-Z, ten digits 0-9 and punctuation. Instead there is a reserved code to switch to Figures and another code to switch to Letters. Space, carriage return and line feed are present in both the Letter and Figure sets. The interface must track which rail is currently selected and insert the correct shift sequences on the fly.
In slow motion the holding magnet can be seen pulling the selector during one-bits and not attracting it during the zero-bits. Each bit is latched via the "sword" mechanisms onto one of the rails, which select one of the twenty-eight hammers. During the fifth bit an extra gear cocks the mechanism and a latch lets the hammer fly during the stop bit. The coils are designed for 60 mA, but have a very high inductance (on the order of 4 Henries according to John Nagel). Most approaches to interfacing with the system use a large 100 VDC power supply and a current limiting resistor (that must dissipate 6 W of power!).
Both the high voltage and the custom baud rate issues are a bit cumbersome, so I thought there must be a better way. USB ports will output about 5 W, so I figured that would be close enough to drive the magnet if I could produce sufficiently high voltage. Using Adafruit's boost converter calculator, I came up with some rough numbers and built a circuit that handles both the slow baud rate and voltage required to interface with the teletype. It shows up as a normal USB serial port and handles the 7-bit ASCII to 5-bit Baudot translation, including tracking which of the two rails is selected, outputs the bits at the correct baud rate, and runs the PWM charge pump to generate the high voltage with the inductor. A second MOSFET is used to switch the high voltage through the current loop, allowing the holding magnet to turn on and off.
It's fully self-contained, fits in an Altoids tin and works with any software you want to run on the interface computer. If you want to run it with a Raspberry Pi, be sure to use a powered hub to avoid overloading the Pi's weak USB power circuitry. The schematics and source code are posted to here and it served in action as part of Future Crew at the digital archeology themed 2013 NYC Resistor Interactive Party.
Originally posted to the NYCR blog
2013 Teletype HV USB Devices Retrocomputing