I'm converting a Sinclair Spectrum 128 ZX +2 into a Raspberry Pi-powered computer and I'm using a Teensy 3.2 USB Development Board for mapping the original keyboard with the original membrane and get a normal USB keyboard. I'm not planning to maintain the original key mapping, probably I'll buy some stickers and I'll convert it in a UK keyboard.
I've reused the original ribbon connectors in this way:
- 5 Rows > Teensy Pins 1 to 5
- 8 Columns > Teensy Pins 6 to 13
(I noticed the disconnected cables after I took the photo, now fixed)
I've found a Teensy code for something similar online (thanks Chad Boughton) and I've tried to adapt it for the Sinclair, the first attempt was to simply check if all the keys were working.
Here the code: https://gist.github.com/federicocappelli/7f61d6bc2095cbc278df12519b721435
Briefly, I've created a fake keys matrix:
const byte ROWS = 5;
const byte COLS = 8;
char keys[ROWS][COLS] = {
{KEY_1,KEY_2,KEY_3,KEY_4,KEY_5,KEY_6,KEY_7,KEY_8},
{KEY_9,KEY_0,KEY_A,KEY_B,KEY_C,KEY_D,KEY_E,KEY_F},
{KEY_G,KEY_H,KEY_I,KEY_J,KEY_K,KEY_L,KEY_M,KEY_N},
{KEY_O,KEY_P,KEY_Q,KEY_R,KEY_S,KEY_T,KEY_U,KEY_V},
{KEY_W,KEY_X,KEY_Y,KEY_Z,KEY_ENTER,KEY_TILDE,KEY_DELETE,KEY_BACKSPACE}
};
byte rowPins[ROWS] = {1,2,3,4,5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {6,7,8,9,10,11,12,13}; //connect to the column pinouts of the keypad
But the result is not what I was expecting, for instance, pressing
- spacebar the keyboard prints
12345678
- u the keyboard prints
5cs
- graph the keyboard prints
6d4b
I expected 1 character for one keypress. What I am doing wrong?
Here the Sinclair service manual with the keyboard membrane explanation
if you're still interested by this topic,
I wrote a code to handle the ZXSpectrum+ specific Keyboard (compared to Legacy Spectrum) with an Arduino MICRO MCU.
only SYMBOL+A combo does still not work
based on the PDF that you sent... ZXKeyb with arduino micro