Skip to the content
PCBKitNew board
2 layers386.1 × 102 mmPetkn, the printed circuit board in 3D

Keyboard replacement solutions for the Commodore PET

Size
386.1 × 102 mm
Copper layers
2
Thickness
1.6 mm
Parts
227
Nets
270
Pads
1,215
Tracks, vias
6,575, 769
Pours
1
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
15 Jan 2025
Updated
18 Sep 2026

Overview

Petkn is an open-source printed circuit board by fachat, from the fachat/cbm_keyboard repository on GitHub. It is a 2-layer board of 386.1 × 102 mm with 227 parts on 270 nets, routed with 6,575 tracks and 769 vias.

It is built around the ATMEGA32A-AU, 74LS174DC and 74HCT00D, with the 74HCT85D among its other parts. Its parts include 81 diodes, 64 switches, 33 capacitors, 7 ICs and 5 resistors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

4

README

README.md

Commodore PET keyboards

Note: this is a part of a larger set of repositories, with upet_family as the main repository.

This is part of a re-incarnation of the Commodore PET computer(s) from the later 1970s.

This repo shows how to build a keyboard for the Commodore PET, mainly for my own re-incarnation, but potentially for original PET as well (untested).

Keyboards can be seen in the PETindex keyboard section.

N-Type

This keyboard is the typewriter-stlye keyboard used in most 40 column models, except for the originals with the chicklet keyboard.

PCB

Open source PCB by Steve Gray

For my builds I started by using the N-type keyboard PCB by Steve Gray from his MX replacement keyboards projects As Steve only has the PCB, I designed a 3D-printable base support for the PCB. It is available on tinkercad and the STL files are also available here.

Based on that I created a new R3 version of the board that includes options for backlit LEDs and keyboard controllers allowing key re-mapping independent from the PET's own editor ROM. You can find it in PET-N

NOTE: In R3.0A you need to fix some things:

  1. Connect the V33 and VCC33 lines - basically the oscillator for the Atmega controllers does not have power, so that needs to be supplied.
  2. There is an off-by-one error on the row multiplexer. It has rows R0-9, while the keys are connected to R1-10. For now you have to connect R0 and R10, and fix the issue in the controller software.

In the current R3.0B these two fixes have been applied, but the actual PCB is not tested yet (and probably never will). A future 3.1 fix this for good.

Programming the R3 PCB

The R3 PCB has (optionally) two Atmega32a microcontrollers on board, that implement two functions:

  1. mapping keys between the keyboard and the host
  2. controlling the LEDs.

To program the Microcontrollers you need an AVR programming tool like the AVRisp MkII that I use, or similar, that can program via the SPI interface (plus Reset) on the 6 pin programming header (which exists separately for each of the two Microcontrollers)

Both microcontrollers are connected to the I2C bus on the extended UPET keyboard interface.

Functions of the keyboard controller

Currently the keyboard controller maps the keys 1:1 from the keyboard matrix to the host keyboard interface.

In addition it sends the pressed keys (hardware key index) via I2C to address 0x10 (which is the LED controller).

Also, the keyboard mapping has these options:

  1. direct mapping - each key is directly mapped to the corresponding host key
  2. The top row of characters is remapped from the PET-N's characters (like $, %, etc) to the digits you'd normally expect in this place. The original chars are available with Shift, the originally shifted characters are available with Ctrl.

Note that in the future more mappings may be implemented.

Selection of the mapping is done by pressing the SRQ key a few seconds long. The keyboard will then send a menu text to the host that instructs the user how to switch the mapping. It is best if the menu is triggered e.g. on the BASIC prompt.

The mapping is stored in the Atmega's EEPROM, and thus retained when the machine is switched off.

Functions of the LED controller

The LED controller listens on the I2C address 0x10 for commands.

With these commands you can set the constant value of each key LED, but also trigger certain programs that involve either a single key, or multiple keys. For single keys you can let the colour slowly get dimmer until the LED is off, and then optionally restart with the original value.

The DILUTE program tries to do a simulated flow of the colour from the given key to the surrounding keys. It is not as good and smooth as it could be as the Atmega lacks memory to store the required precision of colour values.

The LOGO just sends the logo onto the keypad, and then lets it decay.

text
        // single LED programs. Followed by index, three colours, and a parameter
        LP_CONST        = 0,    // constant value, using the three parameters as RGB
        LP_LINDECAY     = 1,    // linear decay (note may change hue while getting lower)
        LP_LINDECAYLOOP = 2,    // linear decay with restart

        // single command program
        SP_KEYPRESS     = 64,   // just followed by the index to indicate a pressed key

        // multi-key programs
        KP_DILUTE       = 128,  // set initial value to given params, then let it flow off 
        KP_LOGO         = 129,  // C= logo on the keypad

All commands except KEYPRESS expect the key index, three colours, and a parameter after the command, i.e. six bytes in total. KEYPRESS only has the index and thus requires only two bytes.

Supports for PCB

The PCB needs some kind of support to be mounted into the PET or the Ulti-/Micro-PET cases. There are two versions for Steve's and my derived PCB, the first one for the extended that caters for the different connector, and the one better suitable for the original PCB.

Texelec Petskey keyboard

This is the PET N-type keyboard available from Texelec.

As this is the PCB only, I have created a support structure for this too. Note, however, as I now prefer Steve's PCB, I only have an old version of the supports on tinkercad.

Two of each of these supports make up a keyboard base plate, where you only need to clip in the PCB for the keyboard with the mounted key switches. Then they have about the same dimensions as a C64 keyboard, and you can use them on top of the C64 keyboard support stands.

Key caps

There are two options, either use standard key caps, or 3D-printed ones.

Standard Keycaps

As, for the self-built keyboards from option 1 or 2 some standard MX switches are used, standard key caps can be used as well. There is one caveat, however.

Newer key caps typically have a different inclination for each row of keys, that is the angle of the top key surface against the horizontal is different for each row. This is to facilitate easier typing. In fact even the C64 keyboard has this. The old PET keyboards, however, have the same angle - which is not zero! - for all rows. This makes it easier to use the same cap (in terms of physical dimensions) on all rows, and just print on a different character for each key. Read more on those key profiles.

I used two type of standard key caps:

  1. XDA profile, unmarked: this set of key caps does not have a print on it, and all keys have the same angle - zero. So it is possible to use any of the key caps in any row. Which is important, as you need a specific number of keys for each key width. Also, this set has space bars in different lengths, and there is one that fits the 6.25 character wide space bar for the petskey and sjg keyboards. For the markings I just used a pen...

  2. This one Glorious PC Gaming Race ABS Doubleshot black, ANSI layout GAKC-045 I actually bought more or less by accident. I only noticed that it has different angles per row when I tried it out. However, with the amount of caps I was able to only use a wrong angle on Shift Lock, left Shift, Return and "4" - but it's barely noticable. For the markings I used template from Steve's page, printed it on sticky paper, cut it out and glued it on the keys where the original did not fit.

Printed Keycaps

As a third option I used 3-D printed key caps that I designed myself.

The keycaps are made of three parts each:

  1. a key form created by a parametric generator,
  2. the top character print, extruded from the key form,
  3. the front character (mostly the shifted character), extruded from the key form.

I created all parts, and integrated them in the Tinkercad web tool.

The key form is created using OpenSCAD by a parametric generator (by Thingieverse user rsheldiii, published under the CC BY-SA 3.0 license). Here is the parameter file. Only the key width needs to be adapted, and the inversion of the top for the space key.

Most of the top character prints are made from a Microgramm font, converted to SVG using the Font Squirrel web page.

Some top characters, and especially the top words ("SHIFT", "RUN STOP" etc) are taken from Steve's github page. As SVG exported from inkscape did not work when imported into tinkercad, I had to make screenshots from each character, and convert these screenshots into SVGs using this online converter.

The front characters are all from an SVG file from wikipedia, from which I also took screenshots and converted to SVG as above.

You can find an oder version of the the STL files here, in four parts due to its size. The current version is linked from tinkercad below. Please note that it took me about 100+ hours just to print the full set of keys on my Snapmaker printer in high quality. After printing you have to remove the supports that anchor the stem to the outside of the keycaps so it does not break away when printing.

For your convenience there is an open project at PCBWay to print the key caps, see the links.

Switches

The PCBs work with standard Cherry-type/-compatible switches. I only tested Cherry brand switches, though. You may select depending on your preference regarding force needed, click noise etc.

I found the MX1A-C1NW a good compromise for me.

Gallery

Assembled keyboard with white resin printed caps Assembled keyboard with white resin printed caps, with key prints painted with black alcohol ink Assembled keyboard with black PLA printed caps Assembled keyboard with black PLA printed caps, with key prints painted with white alcohol ink Assembled keyboard with black PLA printed caps Assembled keyboard with black PLA printed caps

Parts

227
QtyValueFootprintReferences
811N4448Diode_SMD:D_SOD-323_HandSolderingD1, D2, D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23 +65
22100uCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC1, C2, C15, C16, C18, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28, C29 +6
14SolderJumper_2_BridgedJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJC1, JC2, JC3, JC4, JC5, JC6, JC7, JC8, JP1, JP2, JP3, JP5, JP8, JP11
11100nCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC7, C8, C9, C10, C11, C12, C13, C14, C17, C30, C31
310kResistor_SMD:R_0603_1608MetricR3, R4, R5
3SolderJumper_3_Bridged12Jumper:SolderJumper-3_P1.3mm_Bridged12_RoundedPad1.0x1.5mm_NumberLabelsJP4, JP6, JP7
22k2Resistor_SMD:R_0603_1608MetricR1, R2
274LS174Package_SO:SO-16_3.9x9.9mm_P1.27mmU4, U6
2ATmega32A-APackage_QFP:TQFP-44_10x10mm_P0.8mmU2, U8
2AVR-ISP-6Connector_IDC:IDC-Header_2x03_P2.54mm_VerticalJ4, J7
2SolderJumper_2_BridgedJumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mmJP9, JP10
1"!"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW80
1"#"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW79
1"$"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW71
1"%"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW78
1"&"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW77
1"'"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW70
1"("petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW76
1")"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW68
1","petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW21
1":"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW36
1";"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW28
1"<"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW5
1">"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW12
1"?"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW20
1"@"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW15
1"A"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW48
1"B"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW30
1"C"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW31
1"D"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW47
1"E"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW63
1"F"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW39
1"G"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW46
1"H"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW38
1"I"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW53
1"J"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW45
1"K"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW37
1"L"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW44
1"M"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW29
1"N"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW22
1"O"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW60
1"P"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW52
1"Q"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW64
1"R"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW55
1"S"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW40
1"T"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW62
1"U"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW61
1"V"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW23
1"W"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW56
1"X"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW24
1"Y"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW54
1"Z"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW32
1"["petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW7
1"\"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW69
1"]"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW14
174HCT00Package_SO:SOIC-14_3.9x8.7mm_P1.27mmU9
174HCT85Package_SO:SO-16_3.9x9.9mm_P1.27mmU3
174LS145Package_SO:SO-16_3.9x9.9mm_P1.27mmU7
1ASE-xxxMHzOscillator:Oscillator_SMD_Abracon_ASE-4Pin_3.2x2.5mmY1
1B ARROWpetkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW75
1CLR/HOMEpetkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW74
1Extended_PET_keyboard_connectorpetkn:PET_Extended_Keyboard_ConnectorJ1
1INS/DELpetkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW65
1KP "*"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW33
1KP "+"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW17
1KP "-"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW9
1KP "."petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW2
1KP "/"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW49
1KP "0"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW10
1KP "1"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW26
1KP "2"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW18
1KP "3"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW25
1KP "4"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW42
1KP "5"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW34
1KP "6"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW41
1KP "7"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW58
1KP "8"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW50
1KP "9"petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW57
1KP "="petkn:SW_Cherry_MX_1.00u_PCB_with_RGB_LEDSW1
1L SHIFTpetkn:SW_Cherry_MX_2.00u_PCB_with_RGB_LEDSW16

The 213 most common of 227 parts.

Questions

How big is the Petkn PCB?

It measures 386.1 × 102 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Petkn use?

227 parts, built around the ATMEGA32A-AU, 74LS174DC, 74HCT00D and 74HCT85D. 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 Petkn KiCad files?

From the fachat/cbm_keyboard repository on GitHub, at the commit this page was made from: the board is PET-N/petkn.kicad_pcb and its schematic PET-N/connector.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Petkn design in my own project?

Its repository states no licence, so its author keeps all rights: ask fachat before reusing the design.

Similar boards

  • 4 layers170.2 × 170.2 mmMotherboard, the printed circuit board in 3D

    Motherboard

    MicroLind-Developers/microlind-hw

    Hardware repository for the microlind project

    149 partsCERN-OHL-P-2.0
  • 2 layers167.8 × 200.6 mmRandom Jazz Generator, the printed circuit board in 3D

    Random Jazz Generator

    telec16/modular-synth

    Little side project, don't expect much updates.

    132 parts16
  • 2 layers100 × 100 mmPPR Board, the printed circuit board in 3D

    PPR Board

    ab0tj/MiniSys

    Homebrew computer with an ISA-like bus

    38 parts7
  • 2 layers216.7 × 89.7 mmC-13X PCB, the printed circuit board in 3D

    C-13X PCB

    ramonimbao/C-13X-PCB

    A PCB for the C-13X

    135 parts16GPL-3.0
  • 2 layers150 × 97 mmController mega32l, the printed circuit board in 3D

    Controller mega32l

    dmogn/plc_controller_mega32l_pcb_scheme

    PLC controller hardware PCB scheme. ATMega32L, RS485 industrial bus interface, 8 ADC inputs, 8 PWM out, 6 GPIO

    82 parts7MIT
  • 2 layers100 × 100 mmKicadJE uP DAC, the printed circuit board in 3D

    KicadJE uP DAC

    promesoft/KicadJE_uP_DAC

    STM32 and ATMEGA32A - Eurorack DAC MCP4822 output - Use for Sub 400Hz DDS, LFO, ADSR, Effects - and a small 555 VCO - DDS1 DDS2

    275 parts7
  • 2 layers100 × 100 mmKicadJE ADSR Mega32, the printed circuit board in 3D

    KicadJE ADSR Mega32

    promesoft/KicadJE_ADSR_Mega32

    Envelope for ATMEGA32A - Formant VCO - PT2399 Reverb

    217 parts2MIT