AMIGA 500/1000/2000 Keyboard Interface

Here is code for early A1000 keyboards with the MOS 6570-33/328191-01 keyboard controller IC! My tests have all been great so far.

I also figured out the reboot issue! The A1000 keyboard does not have a separate RESET signal wire, it only has 4 wires on the connector. Also the 4-wire reboot code in this sketch can be applied to my previous A2000 code to make it work on 4-wire A2000 keyboards.

sketch_a1000kbd.ino (6.95 KB)

And here is a version for A2000 4-wire keyboards. I have not tried it on A500/A2000 with extra Reset wire, but it very well may work.

Annoyingly, my 4-wire A2000 keyboard (and possibly others), ignore the first keystroke. What happens is the Leonardo waits for the first keystroke to sync with the keyboard, and during that sync phase misses the keypress. However it does get the key release, so I added code there to process it as a press-and-release. Because of that, held-down modifiers (shift, ctrl, alt) are ignored. I did get CTRL+Amiga+Amiga to work as the first keystroke though.

sketch_a2000_4wirekbd.ino (7.97 KB)

lagri:
I am a totally noob in Arduino,
i am trying program a Arduino Pro Micro with this code to use a spanish A2000 keyboard on a Raspberry Pi , when i connect the Arduino on the PC USB connector, the computer think that i has press CTRL+ALT+DEL,
Whats append?
Is problem of my Arduino Pro Micro?
I am doing something wrong?

Which code are you using? The original code by the original poster has this issue, but not my modified code. See the code attached to my latest posts.

I have discovered one more bug. The CTRL-ALT-DEL command is being sent on bootup and connection. I missed it because uploading the sketch and the reconnection/restart of the Arduino did not cause it. It is only when I boot up a PC, or when I plug the Arduino in to USB that the this happens. I discovered that I have no need for the CTRL+A+A reboot functionality, so I simply commented out the two lines that send it. They must be both commented out to avoid this issue. Not sure why both are being executed at connection, I will revisit this later.

This is the keyboard mapping (with wire colors) that worked for my Amiga 500 …

Amiga 500 wire harness Arduino pin

1 KBCLK (bronze wire) 9
2 KBDATA (black wire) 8
3 KBRST (red wire) 10
4 5v (orange wire) 5v
5 NC
6 GND (green wire) GND
7 LED1 (blue wire) 5v
8 LED2

First of all, thank you @Olaf and @DrRemulak for the work on this, much appreciated! :slight_smile:

Here is my version based on the latest 4-wire keyboard code by @DrRemulak. I included new code for joysticks based on the code by @Olaf but now there is no need to add HID descriptions in other files.

This version works fine on the MiSTer (Terasic DE10-Nano FPGA development board) with the Amiga core (joysticks included). I tested a CDTV keyboard and a A500 keyboard, the A500 keyboard works fine even if the RESET pin is not connected.

On this version CLOCK goes to pin 8 and DATA to pin 9, confusing. I included connection diagrams for joysticks and various Amiga keyboards in the code.

amiga_4wirekbd_joysticks.zip (4.74 KB)

Hi,

I am looking to use an Amiga 500 keyboard in a project I am working on. I am wondering if it would be possible to alter this code to work as a serial keyboard, All I am looking to do is take the keystrokes from the Amiga keyboard and display them in the serial console.

I would be using an Arduino Nano instead of a Leonardo.

Any help appreciated.

Thanks.

Hi all,

I noticed the Amiga keys don't work correctly with DrRemulak's script. The lines:

// modifiers: Shift left, Shift right, -, Crtl left, Alt left, Alt right, Amiga left, Amiga right
0x02, 0x20, 0x00, 0x01, 0x04, 0x40, 0xE3, 0xE7

Should be changed (from Olaf's original script) to:
// modifiers: Shift left, Shift right, -, Crtl left, Alt left, Alt right, Win (amiga) left, Ctrl (amiga) right
0x02, 0x20, 0x00, 0x01, 0x04, 0x40, 0x08, 0x10

Or if you prefer having a Win Right on Amiga Right key, It should be:
// modifiers: Shift left, Shift right, -, Crtl left, Alt left, Alt right, Win (amiga) left, Win (amiga) right
0x02, 0x20, 0x00, 0x01, 0x04, 0x40, 0x08, 0x80

So I realise this is a very old post indeed now, but I've just tried to get this working with an Amiga 3000 keyboard and haven't got anywhere. If I try it on a PC then I just keep on getting the ctrl+alt+delete sent to the PC. If I try it on the Mac then it just gives out this constantly:

[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~[3;5~

As far as I know the keyboard works OK, but since I don't have a real Amiga knocking around any more I can't actually check it. I can get it onto my scope this evening and start to look at the data/clock, but I was wondering if anyone has tried it with an A3000 keyboard before.

@gavinsaxby: yes, the Amiga 3000 keyboard is exactly the same as the last A500/A2000/A4000 ones (and has the same controller as early A1000/A500/A2000 ones too). I suspect you mixed the connections. Here is the diagram :

// A2000/A3000 ---------
// Keyboard   Leonardo
// Connector  IO  
// 1 KBCLK    8
// 2 KBDATA   9
// 3 NC       -
// 4 GND      GND
// 5 5V       VCC (5V)

To all of you who arrived here to connect an Amiga 500/1000/2000/3000/4000 keyboard to an USB port on a modern PC/Mac/Raspberry Pi/whatever computer:

The Olaf-DrRemulak Arduino Leonardo script discussed here is quite obsolete now, since it missed the simpler functions from the Keyboard.h Arduino library, that are especially done for the purpose to convert old keyboards to USB ones.

Here is attached a better script from Janne Lof (I can't find anymore its original link on Internet, sorry).

I confirm this one works well with my A1000 keyboard and should work with all other Amiga keyboards with a controller onboard (so, all Amiga keyboards except the ones from A600 and A1200). I added a 'delay(300)' in the Caps Lock handling subroutine to make the caps lock comptatible with MacOS computers (and it still works with other computers).

sketch_ClavierAmigaV3.ino (11.3 KB)

Thank you yserra, this works great on my A500 keyboard with a leonardo. Could never get the older scripts to work properly.
The only thing i can't get working is the 2 joystick ports, i have tried with retropie and fsuae on linux, but i can not see the ports

That's awesome! I would like to build an Amiga laptop using a Raspberry Pi, and it will be great to be able to use an actual Amiga keyboard. Of which I have many.

Hello, first of all thank the people who have made this project possible. has someone designed a STL case for PRINT it?

Hello,

I wanted to do the amiga keyboard interface with one arduino pro micro.
I made the pcb and bought all the components. I used @yserra code (sketch_clavier_amigav3.I no", but when I insert the code inside the arduino software, I always have error on the code. If someone can help me?

For more information, i did this :

I ordered pcb and all components.

Made some Changes to the Pos #87 code (tried to repair)

Got Amiga 500 keyboard and and both of joy ports working. (In Windows)

Now I can make RPI and Amiga 500 keyboard working system :slight_smile:

(Amiga 500 case is still in transport :s )

Amiga_KeyboardJoys_2.ino (16.2 KB)

Keyboard not working for me and it's making my proper pc keyboard output mixed commands..

Pi can only see one joystick, windows can see two. not sue if its a name conflict on the pi ?

Will, investigate a bit more later...

fudmana:
Made some Changes to the Pos #87 code (tried to repair)

Got Amiga 500 keyboard and and both of joy ports working. (In Windows)

Now I can make RPI and Amiga 500 keyboard working system :slight_smile:

(Amiga 500 case is still in transport :s )

FYI, I rewrote the original code (fixing several bugs that are present in both this version and that version).

For example the handshake delay is wrong in both (waaaay too high, even according to the Amiga HRM). -- And they both handle the number pad wrong.

Additionally, I added Bluetooth support on ESP32 devices.

I chose to base it off of the original version since it was more portable (e.g. it used actual pin numbers instead of the raw PORT values). -- It's still super responsive on both the Leonardo/Pro-Micro and on ESP32s devices.

Code is here: Amiga500-Keyboard/AmigaKeyboard.ino at main · BrainSlugs83/Amiga500-Keyboard · GitHub

Thanks, that works really well! The only thing I have changed is the key mappings - however I realise this is personal preference! One thing I couldn't get working was for KEY_RIGHT_GUI to act as the right windows key (menu key). I guess sending a shifted F10 is almost the same...

MisterFPGA, which I'm using this with, needs F11 and F12 so I'm tempted to map HELP to F12, too.

Hi Guys - thanks for all the info. I've got my Leonardo ready to go but I can't for the life of me get Flip to connect to it so I can switch it into keyboard mode.

I keep getting the dreaded Atlibusbdfu.dll not found error.

The device driver for the board is loaded and it won't let me change it for the one in the flip/usb folder - looks like an error due to it being x64 Windows 10.

Any ideas would be appreciated. Cheers

** It's a keyestudio Leonardo r3 board - if ayone could suggest a better board then please do :slight_smile: