Skip to the content
2 layers46.8 × 18 mmPs2 to amiga, the printed circuit board in 3D

Ps2 to amiga

dylangageot/pakia5

PS/2 to Amiga Keyboard Interface Adapter

Size
46.8 × 18 mm
Copper layers
2
Thickness
1.6 mm
Parts
6
Nets
9
Pads
28
Tracks, vias
54, 0
Pours
1
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
7 Apr 2024
Updated
2 Jun 2024

Overview

Ps2 to amiga is an open-source printed circuit board by dylangageot, from the dylangageot/pakia repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 46.8 × 18 mm with 6 parts on 9 nets, routed with 54 tracks and 0 vias.

It is built around the ATTINY85-20SU. Its parts include 3 connectors, 1 capacitor and 1 IC. It belongs with the retro computing and games and interfaces and adapters boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

1

README

README.md

PS/2 to Amiga Keyboard Interface Adapter (PAKIA)

Standalone Amiga keyboards are more than ever difficult to find, especially due to the increased perceived value of Amiga computers and peripherals on the second-hand market.

Unfortunately, the keyboard interface used by Commodore is proprietary, see the Amiga keyboard interface documentation. Even though it uses the same 5-pin DIN 41524 connector as IBM AT keyboards, the keyboard interface is still different and therefore not compatible with any easy-to-find PC-compatible keyboards.

PAKIA is yet another adapter circuit, taking a PS/2 keyboard interface in input, and translating it into the Amiga keyboard interface in output.

Features

  • Convert PS/2 scancode to Amiga scancode,
  • Handle lost synchronization and corresponding recovery,
  • Handle the reset combo (Ctrl + Left Amiga + Right Amiga) with the two reset warnings,
  • Interact with PS/2 keyboard to set Caps Lock LED,
  • Use the Menu modifier key to type a key that has been absorbed by a larger key on the PS/2 keyboard but is present on an Amiga keyboard,
  • PCB with:
    • on-board DIN socket for AT and PS/2 keyboards connection, with the later usable with a mini-DIN to DIN adapter cable,
    • strain relief for wire coming from the Amiga.

Under the hood

Despite being different, both PS/2 and Amiga keyboard interfaces share similarities: they use the same KDAT and KCLK signal pair. In either case, the keyboard is responsible for generating the clock and preparing 8 data bits to be read on the KDAT signal a falling or rising edge of the KCLK signal.

Leveraging multiple timers and interrupt service routines, an ATtiny85 captures frames sent out from an input PS/2 keyboard, interprets them, and then converts them to the Amiga keyboard interface using a look-up table written in Flash memory.

In contrast to other solutions, signal timings for the Amiga keyboard interface are driven by discrete time events instead of being driven by blocking delays. One hardware timer generates periodic interrupt requests that once the corresponding ISR runs, the signal is taught to evolve its state through a software-based finite state machine, hence changing pins levels for both KDAT and KCLK.

This asynchronous philosophy makes it possible to incorporate this piece of software in a busier system, without introducing blocking delay when Amiga commands are being sent, minus interrupt service routines execution time of course.

You might think that this is overengineering and that other solutions got it right enough by using blocking delays to handle their signal timings, and you are probably right! The solution I have implemented was way more stimulating for me to develop, so here we are!

The binary currently weighs 3.2KB, in that regard, one could choose to use an ATtiny45 instead of an ATtiny85, it might be enough even in case of additional features coming in future updates.

The project uses C++ mainly to benefit from namespaces.

Build and deploy

[!WARNING] The build system is only available on Linux.

Required: avr-gcc and avrdude, respectively 5.4.0 and 6.3-20171130 on my setup.

  1. Specify the programmer to use with avrdude in the Makefile, with the variable PROGRAMMER,
  2. Build with make,
  3. Deploy with make flash while your programmer is wired to the ISP connector on the PCB.

Edit the translation map

The lookup table to convert PS/2 scancode to Amiga ones is hard-coded in src/translation_map.hh. A tool called translation-map-generator can be built from the tools directory. By modifying the source code, one can generate other hard-coded LUT from a readable code:

bash
(cd tools && make)
tools/translation-map-generator > src/translation_map.hh

Schematic and PCB

The schematic and PCB were drawn in KiCAD. The project is available in the hardware directory.

Other solutions

"yet another adapter circuit", is there are other adapter circuits?

Yes, there are other adapter circuits!

I have started this project blindly, without searching if anyone made one before. Frankly, it was appealing to my eye, so why not! I have found documentation on both keyboard interfaces and started developing a proof of concept on an Arduino Uno board, based on an ATmega328p.

I have discovered many of them once I had finished the prototype for PAKIA and wanted to design a PCB for it, with eventually a lighter microcontroller than the ATmega328p. Here is a list of related open-source projects and their respective solutions:

  • AKAB by hkzlabnet
    • uses an ATmega328p as a microcontroller (32KB Flash, 2KB SRAM),
    • leverages a pure AVR development environment,
    • provides a KiCAD project with schematic and PCB design,
    • PCB based on both through-hole DIP-28 ATmega328p and mini-DIN socket,
    • see a photo of the adapter board in the dedicated blog article,
    • implements Amiga Ctrl-Amiga-Amiga reset combo keys,
  • PS2toAmiga by Jartza
    • uses an ATtiny85 as a microcontroller (8K Flash, 512B SRAM),
    • leverages the Arduino development environment,
    • provides a KiCAD project with schematic and PCB design,
    • PCB based on SMD SOIC8 ATtiny85 and pads to solder wires on for both PS/2 and Amiga keyboard wires,
    • designed to fit inside a keyboard,
    • see photos of the adapter board on the repository README.md,
    • implements Amiga Ctrl-Amiga-Amiga reset combo keys,
    • two different keyboard layouts selectable from the Scroll Lock key.

There is also the Lyra 3 adapter sold by Individual Computers. This one is very complete feature-wise, but I did not want to buy one as I thought that it would spoil my pleasure of developing my own, I'm sure you get it, right?

Parts

6
QtyValueFootprintReferences
1100nFCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC1
1ATtiny85-20SPackage_SO:SOIC-8W_5.3x5.3mm_P1.27mmU1
1AVR-ISP-6Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ2
1Conn_01x05Library:AMIGA_KB_PADSJ1
1DIN-5_180degreeLibrary:DIN_5PIN_180d_FemaleJ4

The 5 most common of 6 parts.

Similar boards

  • 2 layers65 × 56.5 mmSuperPower RPi KiCAD, the printed circuit board in 3D

    SuperPower RPi KiCAD

    SensorsIot/SuperPower

    Here you should find the best power supplies for your low-power projects

    122 parts600
  • 2 layers18.8 × 8.1 mmDell charger emulator, the printed circuit board in 3D

    Dell charger emulator

    KivApple/dell-charger-emulator

    Emulator of original Dell charger using ATTINY85

    6 parts154
  • 2 layers14 × 17.3 mmSnopf, the printed circuit board in 3D

    Snopf

    snopf/snopf

    snopf USB password token

    18 parts145GPL-2.0
  • 2 layers43.9 × 29 mmC64Saver2-addon, the printed circuit board in 3D

    C64Saver2-addon

    bwack/C64-Saver-bwack

    C64 Saver v1 and v2 - Overvoltage protection for the C64 and its power brick.

    43 parts124
  • 2 layers61 × 36.8 mmKeebcard, the printed circuit board in 3D

    Keebcard

    rsheldiii/Keebcard

    Home of the KeebCard project - Kicad files, code, and more!

    15 parts112
  • 2 layers200 × 100 mmRegalodilara, the printed circuit board in 3D

    Regalodilara

    valerionew/very-good-uc-doggos

    A special graduation present for a special friend. Six microcontrollers in one devboard

    91 parts50
  • 2 layers134.3 × 140 mmAerospace badge, the printed circuit board in 3D

    Aerospace badge

    AerospaceVillage/avBadge_2020

    Aerospace Village Badge 2020

    20 parts28
  • 2 layers50 × 25 mmLoRa Environmental Sensors, the printed circuit board in 3D

    LoRa Environmental Sensors

    spielhuus/LoRa-Environmental-Sensors

    ATtiny85 based LoRa atmospheric sensor board with BME280

    5 parts28

Questions

How big is the Ps2 to amiga PCB?

It measures 46.8 × 18 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Ps2 to amiga use?

6 parts, built around the ATTINY85-20SU. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Ps2 to amiga KiCad files?

From the dylangageot/pakia repository on GitHub, at the commit this page was made from: the board is hardware/ps2_to_amiga.kicad_pcb and its schematic hardware/ps2_to_amiga.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Ps2 to amiga design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).