RaspTTY: WEB to TTY Interface


Hardware

  • Schematic
  • Software

  • Distribution tgz archive
  • Details

    I started this project with the idea of giving a new life to my good old teletype machines.
    The 'RTTY.com' site operates an interesting AFSK modulation streaming service which can demodulated by any TU (Terminal Unit).
    However this requires to connect the audio line of your computer to a TU equipment in order to be able to decode and print the news feed.
    Another way would be to directly connects to the telegraphic interface - RON signal - and use the teletype as a teleprinter.

    I wanted to find the best of breed with a stand alone unit that would able either to play the 'iTTY' stream or to process a WEB page.
    Small units ARM are now available of which the 'Rapsberry PI Zero' that can do the trick.

    It tooks roughly more than a week to devise such a stand alone unit:
    RaspTTY is able to connect to any Internet site on its own in order to process a ressource such as a Web site or a Twitter Feed.
    The extracted data is then converted to 'a ready to print' ITA2 encoded text.
    It can also get the iTTY stream and play it on its audio output.

    The very first test was to print President Trump tweets the old fashion way on a real Post & Telegraph 'TELEX SERVICE' paper.
    The sound of the mechanics and oil smell brought me back more than 35 years ago with my first TTY setup....

    Everything is contained in a small case which exposes:
    - a telegraphic interface,
    - an audio output,
    - a 5V power supply jack,
    - two LEDs for the trafic activity display,
    - one LED for the processing activity,
    - two buttons.

    Utilities

    The software package includes the following Python utilities:

    Writer.py
    This stand alone utility sends all the data typed in the console to the teleprinter through the serial link or audio link ('-a option').
    Run via a commande line in a Linux console.

        


    Reader.py
    This stand alone utility prints all the data typed on the teleprintter to the console. Can only be used with the serial link.
    Printing of data is delayed by 3s due the the serial driver implementation under Linux (character buffering).
    Run via a commande line in a Linux console.

        


    Terminal.py
    This stand alone utility acts a small terminal to the teleprintter to the console. Can only be used with the serial link.
    Printing of data is delayed by 3s due the the serial driver implementation under Linux (character buffering).
    Run via a commande line in a Linux console.

        


    web/server.py
    This stand alone utility starts a terminal WEB server on port 8080.
    Run via a commande line in a Linux console.

        


    Service.py
    This utility can be started as a daemon or as a commande line.
    It offers four different services depending on the used link (serial or audio).

    A push-button generates an event that is linked to the raspbian 'halt' operation.
    Status or error information goes on the audio line as speech synthetised audio messages.

    A switch button allows for selecting one of the two configured services for each modes.
    • When directly connected to teleprinter via the serial link:
      • Starting a Terminal WEB server which listen on the TCP/8080 port:
      • One can send data to the teleprinter through any WEB device or read the text typed on the teleprinter.
      • Getting last news from one of the four defined WEB services:
      • Here the site text content is extracted, converted to ITA2 charset and then sent to the serial line as 5 bits words using the 50bds speed.
        The site can be selected through the 'config.ini' file.
      The serial line output (TX) has to be connected to the RON teletype input and the serial line input (RX) to the TRON teletype output.
      An opto-isolated interface is used.
      The Raspberry IO port 24 should be tied to the ground.

    • When directly connected to teleprinter via the audio output:
      • Reading the iTTY stream.
      • The 'iTTY' stream is played through the audio line. This can be used to feed an AFSK modem connected to the teletype.
        The RPI0 PWM0 and PWM1 outputs are used. They are filtered and connected to an audio amplifier.
        The site can be selected through the 'config.ini' file.
      • Getting last news from one of the four defined WEB services:
      • Here the site text content is extracted, converted to ITA2 charset and then sent to the audio line as FSK modulation.
        The site can be selected through the 'config.ini' file.
      The audio line output has to be connected to a Terminal Unit which will decode the FSK stream.
      The Raspberry IO port 24 should be left opened.

        

    Raspberry PI zero configuration

    Some modifications have to be made to the Raspberry configuration which are defined in the 'config.txt' file located under the 'sys' directory of the package:
    - Activity led routed outside the PI,
    - Audio PWM wiring modified,
    - Bluetooth disabled on PI Zero W as it uses the PL011 UART,
    - UART enabled.
    This file can be copy under the '/boot' directory on the SDCARD.

    Here is our config.txt which works on Rpi Zero and RPI Zero W:
    # ------------------------------------------------
    # minimal /boot/config.txt
    # ------------------------------------------------
    # Disable BT on pi0W as it uses serial
    dtoverlay=pi3-disable-bt
    # ------------------------------------------------
    # UART enabled
    enable_uart=1
    # ------------------------------------------------
    # Load for USB gadget and activity led route
    dtoverlay=dwc2
    dtoverlay=activityled.dtb
    # ------------------------------------------------
    # Enable audio and route PWM to alternate
    dtparam=audio=on
    dtoverlay=pwm-2chan,pin=18,func=2,pin2=19,func2=2
    # ------------------------------------------------
    
    Some useful scripts can be found under the 'sys' of the package.

    Installation

    Go to owner home directory, said 'pi':
     cd ~pi

    Copy then unpack the package in the directory using the following command:
     tar -zxvf Distrib-RaspTTY-V1.0.tgz .
     Symlinks should have been preserved.

    Get ownership of the files:
     chown -R pi:pi *

    Set permissions on python files:
     chmod -R 555 *.py

    Access to the 'audio', 'dialout' and 'tty' drivers has to be granted to the utilies owner:
     sudo usermod -a -G audio pi
     sudo usermod -a -G dialout pi
     sudo usermod -a -G tty pi
     sudo chmod 660 /dev/serial0

    Requirements

    The following packages are required and should installed:
    python3-pip sudo apt-get install python3-pip all utilities
    python3-lxml sudo apt-get install python3-lxml all utilities
    pyserial sudo python3 -m pip install pyserial all utilities
    minimodem sudo apt-get install minimodem all utilities
    omxplayer sudo apt-get install omxplayer Service.py
    tornado sudo python3 -m pip install tornado web/server.py and Service.py

    A modified version of the 'minimodem' can be used that allow disabling the internal ITA2 conversion.
    Such a modified version can be found under the 'sys' directory and can be installed as follow.

    Verify version, should return 'minimodem 0.24':
     minimodem -V

    Goto owner home directory:
     cd ~pi/sys

    Copy modified version:
     sudo cp-a minimodem /usr/bin/minimodem
    Verify version, should return 'minimodem 0.24a':
     minimodem -V

    Testing

    After configuration and installation steps have been done, the testing phase can be started:

    Go to the source directory:
     cd ~pi/src

    Test the serial communications:
     ./RTTY_Serial.py

        

    Test the audio processing:
     ./RTTY_Audio.py

        

    Test the print output:
     ./RTTY_Print.py

        

    Test the ITA2 converter:
     ./RTTY_ITA2.py

        

    Test the WEB converter:
     ./RTTY_WebPage.py

        

    Test the Stream connector:
     ./RTTY_Stream.py

        

    Test the FSK output:
     ./RTTY_FSK.py

        


    Go to the web directory:
     cd ~pi/web

    Starts the WEB server:
     ./server.py

    Then connects to the serveur from any browser:
     http://192.168.1.xxx:8080

    Provided all test are OK, you can now play with the other utilities....

    Pictures

    Controler
    RPI Hat details
    Output Sample

    Videos

    Internet News - Sagem SPE5 printing

    Internet News - Sagem SPE5 printing


    iTTY Stream - Sound output

    iTTY Stream - MPC-1000 demodulation

    iTTY Stream - MPC-1000 demodulation, Sagem SPE5 printing



    Last revision: 2018/01/14