TL;DR. A lab for STEM middle school students using vintage serial terminals to illustrate that:
- computers communicate by sending numbers,
- numbers arrive one by one in order (serial),
- numbers travel over wires (pipes).
These notes include links to materials and instructions that take you and a student through (1) connecting a serial terminal to a computer, (2) configuration, (3) playing with pipes by sending messages, and (4) logging into a serial Linux console to see how pipes scale!
This is the latest in our series of education-with-old-hardware posts beginning with “Build a 486 Bootloader with Your Kid“.
Required Materials
- A serial terminal like one of:
- A Wyse terminal (link to eBay). This is the best because it uses standard serial. You’ll need:
- A Dec VT420 (link to eBay). You’ll need:
- A keyboard if not included (I recommend the LK401)
- A DB9 Female to MMJ Female Adapter is available here
- A USB to serial interface
- A Linux computer with systemd and USB. We’re using Ubuntu 20
Preparing the Lab
1. Connect the Terminal to Linux Computer
Connect the USB end of the USB to serial interface to the Linux computer.
If a Wyse terminal, chain the USB serial to the NULL modem cable to the serial converter to the Serial 2 port of the terminal.
If a DEC, chain the null-modem to DEC MMJ adaptor to the end of the terminal’s MMJ wire and then to the serial end of the USB to serial interface.
2. Configure the Terminal
Turn the terminal on. If a Wyse terminal, turn it off and on until you get a blank screen with a blinking cursor top left. They’re fragile while the DEC’s are like Toyota Corolla’s.
If a Wyse, press the “Setup” button on the keyboard. Press “F4” and set “Host Port” to “Serial 2”. Then, press “F5” and set a series of options:
- Serial 2 baud rate to 19200
- Ser2 Data/Parity to 8/None
- S2 Recv Hsk to None
If DEC, press “F3” on the keyboard for setup. Navigate to the “Comm” menu and once inside make sure “Transmit” is 19200 and “No XOFF” is set.
2. Configure Linux
Assume a terminal as root:
- Verify the USB to serial device has been recognized by checking
ls /dev/ttyUSB0
- Set the baud rate to 19200 with
stty -F /dev/ttyUSB0 19200
- Test terminal log in by invoking the systemd service
sudo systemctl start serial-getty@ttyUSB0
. If working, you should get a login prompt on the terminal.
Stop the login service via systemctl stop serial-getty@ttyUSB0
. Disconnect the serial lines to the terminal. Turn the terminal off and then back on to clean the slate for the lab.
If the above worked, then we’re good for the lab! If things didn’t work, remember these things were built in the ’90s. Turn the terminals on and off and physically remove and re-insert serial lines. Warm terminals up by leaving them on even if in an errant state. They will eventually come around.
The Lab with the Student
1. The Terminal is a Dumb Computer
Note to the student that the terminal is called such because it only sends and receives numbers. Note that the terminal screen is blank. Like all computers, it does only what it is told.
1. The Wire is the Pipe
Instruct the student to connect the serial lines to the terminal. Note to the student that the wire they just connected is a “pipe” to the terminal. Numbers travel through it.
2. Turn the Terminal On
Note to the student that the terminal is empty. Just like any other computer, it does nothing because no instruction has been given.
3. Send the Terminal a Message
On the Linux computer (logged in as root), have the student send instructions via: echo "hello" > /dev/ttyUSB0
. Note the terminal does exactly as instructed.
4. Send the Computer a Message
On the Linux computer, listen for messages with cat /dev/ttyUSB0
. With the terminal keyboard, type hello
followed by the “Return” key. Note that nothing shows up on the terminal: the computer was never instructed to send the characters back! Finally, note the resulting message on the Linux computer.
5. Login to the Linux Machine
With messages back and forth underway, it’s time to scale the idea up. Start a login session on the Linux machine with systemctl start serial-getty@ttyUSB0
.
Login with any username/password combination valid for the Linux machine. Invoke something like htop
in the ensuing console. Note to the student that the entire spectacle constitutes numbers traveling back and forth over the serial wire – – “pipe” – – they connected.
The internet is the same thing on a larger scale beyond simple letters.