GOLEM keyboard project

How to build a keyboard with KMK and Adafruit KB2040 in 2 minutes

In this short guide I will show you how to build a keyboard with KMK/CircuitPython as an alternative to the QMK firmware.

  1. Connect the KB2040 to your computer with a USB-C DATA(!) cable.
  2. Download the CircuitPython installer (a .UF2 file).
  3. Enter bootloader mode on the KB2040: press & hold BOOT then press RST.

    Pic: Entering KB2040 bootloader mode

    The board reboots and a new driver appears in Device Manager or your file manager: RP2 BOOT / RPI-RP2 (E:) (the drive label may be different in your case).

  4. Copy/drag the CircuitPython .UF2 file to the RPI-RP2 drive (In Windows Explorer or your favorite file manager.)
  5. Wait for CircuitPython to be installed. The board restarts automatically and appears as: KB2040 / Adafruit KB2040 USB Device in Device Manager. And also as a new drive: Instead of RPI-RP2 (bootloader mode) the drive should be CIRCUITPY now.
  6. Download KMK.
  7. Unzip and copy the KMK directory and the boot.py file to the root of CIRCUITPY (E: or similar). That's it! KMK is installed now.
  8. To test it, copy this example file to your board (CIRCUITPY drive), as a code.py file:

    import board

    from kmk.kmk_keyboard import KMKKeyboard from kmk.keys import KC from kmk.matrix import DiodeOrientation

    keyboard = KMKKeyboard()

    keyboard.col_pins = (board.D0, board.D1) keyboard.row_pins = (board.D2, board.D3) keyboard.diode_orientation = DiodeOrientation.COL2ROW

    keyboard.keymap = [ [ KC.A, KC.B, KC.C, KC.D, ] ]

    if __name__ == '__main__': keyboard.go()

  9. Short a column and row pin with a piece of wire, paperclip, screwdriver, whatever. Or hook up a switch.

Good job! You have a working keyboard controller with CircuitPython and KMK!

Shorting any column pin (TX=D0, RX=D1) with any row pin (D2, D3) should produce one of the characters defined in the keymap: A, B, C or D.

Now that KMK is working, all you have to do is edit the code.py file, update the row and column pins and extend the keymap according your keyboard. Alternatively, you can start by copying or editing an existing kb.py and main.py file in the boards directory of kmk.

–- If this guide was too quick, or you ran into an error, check this comprehensive guide with more explanation and debugging info: https://golem.hu/guide/kmk-firmware/