Amstrad CPC 464 USB Keyboard

The project

As I was not completely satisfied coding with my ZX Spectrum + keyboard, I decided to implement the same with an Amstrad CPC 646 without altering the original parts, and leaving it steal useful.

So I decided to buy some connectors, solder them in a small PCB and pin the rows and columns into an Arduino Leonardo that is able to send keboard codes to a computer through the HID USB interface.

Don’t leave your old computer in your storage!! Transform it into a useful retro USB keyboard!

How to start?

Yo need:

  • Old Amstrad CPC 464 o CPC8162
  • One arduino Leonardo
  • FCB Connectors (Flex Circuit Board conennector)
  • Some cables
  • USB cable
  • Solder

 

First, make it easy by soldering the connector and some cables to a board.

You can still reuse the Arduino Leonardo board and connect both the Keyboard cols and rows of the FCB to the Leonardo, and to the Amstrad mainboard, too:

Please take note of the connectors that are confronted (contacts face to face) to connect them easily to the main board.

Yo need two connector (9 pins for the columns and 10 for the rows). The first row and comumn is dedicated to the DEL key!!

Here I show you the Spanish keyboard matrix. Please take care of the equivalent keys when using different layout:

You have to include the Keypad and Keyboard libs.

#include <Keypad.h>
#include <ctype.h>
#include <Keyboard.h>

Define the number of cols and rows:

const byte ROWS = 10; //ten rows
const byte COLS = 9; //nine columns

And finaly the “normal” keys and “special” keys.

I am defining two layouts that are commuted when CAPS Lock key is pressed:

char alphaKeys[ROWS][COLS] = {
{ KEY_BACKSPACE,' ',' ', ' ', ' ', ' ', ' ', ' ', ' '}, //1 
{ ' ','1','2', KEY_ESC, 'q', KEY_TAB, 'a', 0x04, 'z'}, //11 0x04 => KEY_CAPS_LOCK = Map change
{ ' ','4','3', 'e', 'w', 's', 'd', 'c', 'x'}, //12 
{ ' ','6','5', 'r', 't', 'g', 'f', 'b', 'v'}, //13
{ ' ','8','7', 'u', 'y', 'h', 'j', 'n', ' '}, //14
{ ' ','0','9', 'o', 'i', 'l', 'k', 'm', ','}, //15
{ ' ',KEY_INSERT,'=', '@', 'p', ';', ':', '/', '.'}, //16
{ ' ',KEY_DELETE,'[', KEY_RETURN, ']', '4', 0x02, '\\', 0x01},//17 0x7e (ª), 0x01 = KEY_LEFT_CTRL, 0x02 = KEY_LEFT_SHIFT
{ ' ',KEY_LEFT_ARROW,0x03, '7', '8', '5', '1', '2', '0'}, //18 0x81 = COPY = Ctrl +c
{ ' ',KEY_UP_ARROW,KEY_RIGHT_ARROW, KEY_DOWN_ARROW, '9', '6', '3', KEY_RETURN, '.'} //19
};
char specialKeys[ROWS][COLS] = {
{ KEY_BACKSPACE,' ',' ', ' ', ' ', ' ', ' ', ' ', ' '}, //1 
{ ' ','!',0x22, KEY_ESC, 'Q', KEY_TAB, 'A', 0x04, 'Z'}, //11 0x04 => KEY_CAPS_LOCK = Map change
{ ' ','

The pins mapping for Arduino Leonrdo :

byte rowPins[ROWS] = {9, 10, 11, 12, A0, A1, A2, A3, A4, A5}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; //connect to the column pinouts of the keypad

 

And the photos of the inside:

And the outside

A small video with CAPS Shift and Control Shift functions

 

I will continue soon …

 

 

,'#', 'E', 'W', 'S', 'D', 'C', 'X'}, //12 { ' ','&','%', 'R', 'T', 'G', 'F', 'B', 'V'}, //13 0x26 (&) { ' ','(','\'', 'U', 'Y', 'H', 'J', 'N', ' '},//14 { ' ','-',')', 'O', 'I', 'L', 'K', 'M', '<'}, //15 { ' ',0x80,'_', '|', 'P', '+', '*', '?', '>'}, //16 0x80 (€) { ' ',KEY_DELETE,'*', KEY_RETURN, '+', '4', 0x02, '\\', 0x01},//17 0x7e (ª), 0x01 = KEY_LEFT_CTRL, 0x02 = KEY_LEFT_SHIFT { ' ',KEY_HOME,0x03, '7', '8', '5', '1', '2', '0'}, //18 0x81 = COPY = Ctrl +c { ' ',KEY_PAGE_UP,KEY_END, KEY_PAGE_DOWN, '9', '6', '3', KEY_RETURN, '.'} //19 };

The pins mapping for Arduino Leonrdo :

 

 

And the photos of the inside:

And the outside

A small video with CAPS Shift and Control Shift functions

 

Special mappings

I use special keycodes, not printable (0x01, 0x02, .. 0x06), for sending the HID a combination of keys or special Function Keys (F1-F12).

When the special key is pressed, in the PRESSED state, I call a special function: modKey

case 0x05: 
              if (debug) Serial.println("KEY_LEFT_SHIFT+KEY_LEFT_ALT");
              modKey(KEY_LEFT_SHIFT, KEY_LEFT_ALT);            
              break;
void modKey(char key, int mod)
 {
  Keyboard.press(mod);
  delay(200);
  Keyboard.press(key);
  delay(200);
  Keyboard.releaseAll();
  delay(200);
 }
8 comments
  1. Hello. Very interesting project ! I wish to do the same for a cpc 6128 but i’m unable to find the FCB connectors you used. Could you please give me a link or exact reference ? Thanks 🙂

    1. You can buy them in Telstore shop https://www.telstore.it/ or Ebay, bronto46

      These are the references and links:
      B7177 ( 162079012854 ) Connettore FFC / FPC dritto PIN 5 NON-ZIF THT stagnato 20m ohm TELS
      https://www.telstore.it/catalogsearch/result/?q=B7218
      https://www.ebay.es/sch/m.html?_ssn=bronto46&LH_PrefLoc=&_from=R40&_trksid=m570.l1313&_nkw=B7177&_sacat=0

      B7218 ( 162079013133 ) Connettore FFC / FPC dritto PIN 8 NON-ZIF THT stagnato 20m ohm TELS
      https://www.telstore.it/catalogsearch/result/?q=B7177
      https://www.ebay.es/itm/32pcs-Conector-FFC-FPC-recto-PIN-8-NON-ZIF-THT-estaneado-20m/162791682438?hash=item25e723f186:g:E04AAOSwPIhaKDim

      Good luck

  2. There is noticeably a bundle to know about this. I assume you made certain nice points in features also.

  3. Great work! I’m going to try this myself as the CPC was my very first computer.

    I’m a little confused about the wiring. I’ve found the correct FCB connectors, but I can see those are going into some sort of PCB which you haven’t mentioned. Also, some of the pictures are a little blurry so it’s unclear why it’s been wired up the way it has. Could you provide some insight into this part of the project, please? 🙂

    1. Hi.
      I soldered a bridge to let the keyboard be also used by the original CPC board.
      But you have to be careful wit the voltage. You can damage the input chip.
      I will search for some pictures.

  4. I’m still trying to get my head around this. It would be helpful to see the full Arduino sketch. Would that be possible please?

  5. Hi,
    excellent project!
    Would it be complicated to use the keyboard of an Amstrad 464 Plus or a 6128 plus?
    Thanks,
    Paolo

Leave a Reply to mavalero Cancel reply

Your email address will not be published. Required fields are marked *