Dan Lyke [1] linked to several manual typewriters used as computer keyboards [2] (the ElectriClerk [3] perhaps being the coolest of the three, going all Brazil [4] with an old Macintosh SE [5]). As I'm reading about the typewriter-keyboard conversion [6], I was struck that the person doing it might now know how keyboards work:
Like I said earlier, each key is a connection between two terminals. Some terminals have lots of keys connected to them. For example, connecting terminal 4 and terminal 19 might produce “A” but connecting terminal 9 and terminal 19 might produce “F”. Since 1-13 always connected to 14-26 and vice versa (i.e. no terminal from 1 to 13 connects to any other terminal from 1 to 13), I arbitrarily decided that the levers would all connect to 1 13 and the crossbar would connect to 14-26.
“putting it together [7]”
A keyboard is basically a matrix of switches. Here's the schematic of the keyboard used on the Color Computer 2 [8] (a very simple 53-key keyboard):
[Schematic of Color Computer 2 keyboard interface] [9] [10]
(“EN” is the Enter key, “CL” is the Clear key, “BR” is the Break key, “SP” is the Spacebar and “SH” are the Shift keys)
You would write a “0” to each column (so, to read the rightmost column, you would write a value of 254 (in binary—11111110) and then read the rows. In each case where there is a 0 there is a key being held down along that row. So, again, for the right most column, if you read in 187 (or 10111011 in binary) the Shift key (either one, since they're wired together) and the “W” key are being pressed.
There's a bit more to it than that—the code to read the keyboard would scan through each column, and it would have to know to flag the Shift key as being up or down, and once it detected a key (or two) being down, it would have to pause for a bit, then re-scan for that key (which is called “debouncing”—as you press the key the electrical contact may switch on and off as the key is being hit)—but that's basically how all computer keyboards work (more or less—your standard PC keyboard these days are very simple computers themselves that scan the keyboard matrix and send a standardized code for each key to your computer).
[2] http://www.flutterby.com/archives/comments/8665.html
[3] http://www.ahleman.com/Props/ElectriClerk.html
[4] http://www.imdb.com/title/tt0088846/
[5] http://www.lowendmac.com/compact/se.shtml
[6] http://www.multipledigression.com/type/
[7] http://www.multipledigression.com/type/together.html
[8] http://www.tcp.com/~lgreenf/cocopage.htm
[9] /boston/2006/02/18/thumb.schematic.png