Generally I am very fascinated by devices which solve complex tasks automatically.
This includes teletypes, which just like a typical typewriters print text to paper but they do it by themselfes.
Sadly those machines are hard to come by and then they are often quite expensive, at least too expensive for just playing around.
Electrical typewriters are available now for quite some time. How hard can it be then to tell the microcontroller what to do from the outside?
Without too much thinking about it I bought an Brother AX-240 electrical Typewriter for 30 € on Ebay Kleinanzeigen, which was in perfect condition.
With it came two ribbon cartridges. After I had done fiddeling around with the various functions it was time to have a look at the inside.
There a circuit board with multiple IC's was found. The pins on the main microcontroller which could be assigned for serial communication were already used and configured for IO.
After some time thinking I decided to just simulate the keyboard.
It was build as a 9x8 matrix, which means that one part of the keyboard is scanned multiple times per second (pulled to ground).
If a key is pressed a corresponding row pin (0-8) will be pulled to ground as soon as the column (A-H) is checked.
By knowing which row and scanline was activated the controller knows the pressed key.
This is exactly what I was going to simulate with another separate microcontroller. This one will check the states of the scanlines and switch the needed row for a specific key at the right time with a BC547B NPN Transistor.
By tracing back the traces on the keyboard matrix I got the following.
A key needs to held down for at least three cycles, otherwise a potential internal software debounce would suppress the keypress.
If the keys are pressed faster than the dasywheel of the typewriter can handle, characters are stored in an internal buffer.
By using an STM32F103C8T6 ("Bluepill") and a serial connection with just 9600 Baud the buffer is full in no time.
Therefore it was necessary to recognize when the hammer is triggered to print the character on the paper. A darlighton array is used to power the electromagnet which drives the hammer mechanics.
On the input side of the M54587P Darlighton Array IC I was able to measure a signal at pin 6 and 7 everytime the hammer was fired. To be able to send the next character as soon as the last one has been printed a cable was routed from there to a interrupt enabled pin on the microcontroller.
The code for arduino (which I used to program the STM32) and a documentation in the comments can be found at the end of this page.
With this typewriter beeing able to be fed by a computer I am going to implement various things, like ASCII-art or realtime printing of the text from an IRC channel.
The original ribbon of the brother AX-240 is designed to be used only once and replaced after the 150m went trough.
To use the ribbon infinitely I had to exchange the nylon ribbon for one made out of fabric.
For this I bought a replacement ribbon for some random typewriter and cut an 8mm wide strip from it and glued it together to form a loop
Because the ribbon is no longer wound onto a take up spool it had to be replaced by a disc, which was needed to transport the ribbon along.
After some time the ribbon was used up on this rather short piece. I have read that ink for stamp pads can be used to re-ink a used typewriter ribbon.
This worked quite ok and also gave the printed letters a retro look.
With a FTDI serial - usb converter the typewriter can now be connected to a computer. Text can be sent directly and the machine tries to print everything it can. Some characters are missing on this pre-internet divice, like the "@" symbol.