7 March 2019

ZX-Key, External Keyboard For ZX81s and Other Micro Computers: Part 3

2 comments

The main goals of the ZX-Key project has been to build a mechanical keyboard usable on real ZX81s, PCs (particularly in emulators) and on the RC2014 or other computers with serial keyboard inputs. This entry we'll go over a couple of the details relating specifically to the Keyboard component of the build.

Final prototype ZX-Key ZX81 Keyboard
The ZX-Key Keyboard

The ZX-Key Keyboard

The keyboard layout is based around the 8x5 matrix format found on the Sinclair ZX81 and ZX Spectrums, which makes sense as that's what it's designed to be used with.

The main keyboard circuit is also almost identical to a ZX81s, with the addition of a Arduino Pro Micro enabling the ZX-Key to be used as a regular USB PC keyboard. Connection to the ZX-Key ZX81 expansion interface is facilitated by  a 16 pin IDC header.

Additional diodes have been added to the 5 row lines, these  prevent some issues found when testing the prototype keyboard with a ZXpand expansion card. When the ZXPand read an SD card, its current draw caused some instability with the Arduino. This problem was also addressed on the ZX-Key interface card by proving it with an independent voltage regulator.

A reset line has been brought out from the ZX-Key interface card, and is presented on the 16 IDC header so there is no need to turn the ZX81 off an on to restart the computer. Similarly the 6 pin IDC connector provided for TTL serial communication also provides a reset line broken out for using the keyboard in conjunction with a RC2014 micro.

The pull down 100k Resistor on Column 8 allows the Arduino to detect the presence of a ZX81. As the Arduino powers on or when reset it first tests the status of this column to determine what mode it should start in, either Standard USB / PC or ZX81 mode.

ZX-Key Keyboard Schematic

The Arduino Bit

While connected to a ZX81 the Arduino is essentially dormant, only handling some minor LED visual indicators. However when not connected to a ZX81 the Arduino Pro MIcro takes control, turning the keyboard into a fully functional USB HID (device).

In ZX81 mode with the ZX-key interface connected via an IDC ribbon cable, the ZX-Key will behave as a standard ZX81 keyboard, except with a much improved typing experience. When the keyboard is unconnected, plugged in via USB or serial port the keyboard will start in Standard PC mode.

Keyboard modes and selected layers are indicated by a cluster of three LEDs on the right hand side of the keyboard. There are three keyboard Layers, Standard, Emulator and ZX81. You can switch between Standard and Emulator layers by holding down SHIFT, FUNCTION (ENTER), and GRAPHICS (9) key combinations. The Standard layer has 3 main modes and each of these has a SHIFT layer, this gives access 98% of the keys to be found on a normal USB keyboard.

LED States
Layer & Mode Selected
ON
OFF
OFF
STANDARD
OFF
ON
OFF
STANDARD - FUNCTION
OFF
OFF
ON
STANDARD - GRAPHICS
ON
OFF
ON
EMULATOR
ON
ON
ON
ZX81 - INTERFACE CONNECTED
Standard Layers: Keyboard Mode and Function Selection
NormalNormal mode. All keys are in Standard US Keyboard configuration.
SHIFTWhen in Normal Mode: Symbols in Red are selected. Where these red keys are commands, for example 'EDIT or SLOW' they have been replaced by another symbol. All common symbols are present on the keyboard. Note that SHIFT keys effects vary in each of the other modes
SHIFT,FUNCTIONChanges to Function mode. This selects upper case characters. Pressing the SHIFT key in this mode will select symbols as normal.
SHIFT,GRAPHICSAll the number keys are now there equivalent 'Fx' key, ie. '1' becomes 'F1'. All Letter keys become 'CTRL Letter'. Holding down the SHIFT key in Graphics mode changes the letter keys to 'ALT Letter', number keys '1' and '2' become 'F11' & 'F12'.
Emulation Layer: For use with ZX81 or ZX Spectrum Emulators
SHIFT, FUNCTION, GRAPHICSKeyboard will enter the emulation mode. All Standard Layer mode functions are disabled. This allows Emulation packages to detect key presses as using a standard USB / PS2 keyboard.

You can go back to the Standard layers at any point for entering program Emulator menus with 'F' keys for example.
ZX81 Layer: For use with a real ZX81 plugged into the ZX-Key Interface
Auto DetectionThe ZX81 layer is selected automatically if the keyboard is connected to a ZX81 using the ZX-Key Interface. You can't deselect this mode.

Next time: I'll finalise with the 3D printed case, attach the software and more.

See more entries for this project: Part 1Part 2Part 3Part 4Part 5


If You Enjoyed This, Take 5 Seconds To Share It

2 comments:

  1. Looking forward to receiving mine, ordered today from sell my retro.

    ReplyDelete
    Replies
    1. Excellent, hope you get a lot of use and as much fun as I've had making it :-)

      Delete