PS/2 Encoder


PS/2 Encoder interfaces industry standard PS/2 PC-compatible keyboards to devices requiring TTL-level RS232, parallel data , and/or PC XT signaling.  All ASCII key sequences are decoded, as well as common keyboard sequences like “CTRL-ALT-DEL”.  To provide maximum flexibility for various uses while retaining ease of operation, the unit’s configuration can be modified in-circuit using the PS/2 keyboard itself.


The PS/2 Encoder can be purchased as a bare PCB, minimal kit (PCB, uC only), full kit with DIP 24 pin header, full kit with 2×12 IDC header, or assembled with either type of connector.


  • A PS/2 compatible keyboard (USB keyboards with PS/2 converters may not work) with a Mini-DIN6 plug.
  • Regulated 5VDC Power source.
  • For RS232 operation, a TTL to RS232 level converter.


PS/2 Encoder models can be purchased at the RETRO Innovations Online Store.

Image Gallery

Technical Details

PS/2 Encoder consists of an Atmel ATMEGA168 AVR microcontroller and associated connectors.  The GPLv2-licensed C firmware reads data from a PS/2 compliant keyboard, converting PS/2 scan codes into ASCII values that are presented via an 8-bit parallel and 5V RS232 connections and converting scancodes to XT compatible keyboard scan codes.  The PCB features include:

  • Supports 24 pin .6″ IC socket connection as well as 2×12 header connection.
  • Crystal footprint included on PCB
  • PS/2 connector footprint included on PCB
  • Through hole design makes “do-it-yourself” construction easy.


Bill of Materials

X1Mini-DIN6 PS/2 Connector
R110K 1/8W resistor
IC1Atmel ATMEGA48/88/168/328 uC
C1,C218pF ceramic capacitor
C3.1uF ceramic capacitor
Q18MHz crystal
SV1DIP24 IC header
SV22×12 breakaway header
CONFIG1×2 .1″ breakaway header

Assembly Details

  1. Populate and trim C1,C2,C3 (install C3 from the bottom of the board)
  2. Populate and trip R1
  3. Populate IC1 with socket if desired
  4. Populate and trim Q1
  5. If SV1 desired, populate on bottom of PCB
  6. If SV2 desired, populate from top of PCB
  7. Populate X1
  8. (Optional) populate CONFIG or simply solder pads


IC pinIDC pinDescription
11RS232 Receive
23RS232 Send
35PS/2 Clock
47PS/2 Data
1324XT Data
1422XT Clock


  1. Connect VCC to regulated +5VDC
  2. Connect GROUND to appropriate ground line.
  3. Data connection
    1. For parallel operation, connect D0-7 and STROBE to appropriate parallel keyboard input lines.
    2. For serial operation, connect keyboard 5V SND line to PS/2 Encoder RS232 Receive pin, and keyboard 5V RCV line to PS/2 Encoder RS232 Send pin.
    3. For XT operation, connect XT Clock and Data to appropriate pins on DIN5 plug, adding Vcc and GND to the plug as well.
  4. If desired, /INTERRUPT can be connected to active low wired-or IRQ line on target system.
  5. Apply power to system


Configuration mode can only be accessed when the CONFIG jumper is present (or the pins are otherwise connected). To enter configuration mode, hold CTRL and ALT and press the Backspace key on the keyboard.  Once in configuration mode, only certain keys will respond to keypresses:

Shift + ENTERENTER will send CRLF via Parallel and RS232
&Set RS232 to 7-bit data length
*Set RS232 to 8-bit data length
TIncrease inter-character delay
RIncrease keyboard typematic rate
DIncrease keyboard typematic delay
PIncrease STROBE length
SIncrease oscillator speed (on units without crystal)
ENTERENTER will send CR only via Parallel and RS232
tDecrease inter-character delay
rDecrease keyboard typematic rate
dDecrease keyboard typematic delay
sDecrease oscillator speed (on units without crystal)
lSet STROBE as active-low
hSet STROBE as active-high
0Set RS232 to 110bps
1Set RS232 to 300bps
2Set RS232 to 600bps
3Set RS232 to 1200bps
4Set RS232 to 2400bps
5Set RS232 to 4800bps
6Set RS232 to 9600bps
7Set RS232 to 19200bps
8Set RS232 to 38400bps
9Set RS232 to 57600bps
oSet RS232 to ODD parity
eSet RS232 to EVEN parity
nSet RS232 to NONE parity
BackspaceBS sends Backspace via Parallel and RS232
DeleteBackspace sends Delete via Parallel and RS232
PDecrease STROBE length
qPrint current configuration
wSave current configuration

Once the desired configuration is set, pressing ‘w’ will save the settings, and CTRL+ALT+BS will exit configuration mode and apply the new settings. If configuration mode is exited without saving, settings will last only until power is removed.

Project Files

Source code, EAGLE v7+ schematics, and EAGLE v7+ PCB files are available at the GitHub repository.

Planned Enhancements

  • Add functionality for B2B3,C0,and AUX pins
  • Add support for various escape sequences

Leave a Reply

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