Custom Keyboard Firmware Development: QMK, ZMK, Keymaps, and Flashing

Updated on
9 min read

Custom keyboard firmware lets you change what a keyboard does, not just how its keycaps look. This guide explains how a key press travels from a switch to an application, how QMK and ZMK differ, and how to build and flash a first keymap without guessing at board compatibility. It is for keyboard hobbyists and developers who want custom layers, macros, split layouts, or more accessible input.

What Is Custom Keyboard Firmware?

Firmware is the program that runs on a keyboard’s microcontroller. It reads electrical input from the switches, applies the keyboard’s rules, and reports key events to a computer or mobile device. A keymap is the set of actions assigned to physical key positions, often across several layers; it is one part of the firmware configuration, not a separate kind of hardware.

The controller is the microcontroller and board that run the firmware. A bootloader is a small program that can receive a firmware image and write it to the controller. These details matter: a keymap must target the correct keyboard definition, controller, and bootloader.

QMK and ZMK are open-source firmware projects. VIA is different: it is a graphical tool for changing settings at runtime on keyboards whose firmware supports it. VIA can make remapping easier, but it does not replace the firmware or make unsupported hardware compatible.

Why Customize Keyboard Firmware?

The layout printed on keycaps is only a starting point. Firmware can put navigation keys on a layer, turn a key into a tap-or-hold control, add macros, change how an encoder behaves, or adapt a layout for a compact or split keyboard. These changes can reduce hand movement, make frequently used actions easier to reach, and support different workflows on the same device.

Custom firmware also has constraints. A board needs a compatible firmware target and enough flash and memory for the features enabled. Keyboard designs differ in matrix wiring, pin assignments, controller, and bootloader, so a firmware image for a similar-looking board is not necessarily safe to flash. Confirm the exact model and revision before building.

How Custom Keyboard Firmware Works

Switch press → matrix scan → debouncing → key position and layer lookup → behavior or keycode → USB or Bluetooth HID report

Many keyboards connect switches in a row-and-column matrix so the controller can check many keys using fewer pins. Firmware scans the matrix and filters very short electrical changes (debouncing) so one physical press is not interpreted as several. Direct-wired designs and hardware details vary, so the board definition describes how the controller reads its actual inputs.

Once a press is stable, firmware maps that physical position to a key or behavior. A layer changes the mapping while active: a key can send an arrow on a navigation layer and a letter on the base layer. Tap-hold behavior can send one action on a tap and activate a layer or modifier when held. Timing and layer priority affect these behaviors, so make one change at a time and keep an escape path back to the base layer.

The firmware then reports the result using a standard host interface, commonly USB HID over a cable or Bluetooth HID for wireless keyboards. Split designs may also need to coordinate events between halves. QMK and ZMK share these broad stages, but their configuration formats and implementation details differ.

Firmware, Tools, and Components

Option What it is Good fit Trade-offs
QMK A feature-rich keyboard firmware configured and commonly compiled locally Supported boards, wired keyboards, and users who want fine-grained control over layers and behaviors Requires the exact keyboard target and a working build environment; hardware support varies
ZMK A Zephyr-based firmware with declarative keymaps and a separate user configuration Many split and Bluetooth keyboards, power-aware designs, and users comfortable with a configuration repository The keyboard and shield must be supported or defined; its Devicetree-style configuration differs from QMK
VIA A runtime configuration interface used with compatible firmware Quick remapping through a graphical interface without rebuilding for every change Only exposes features and options already enabled by the firmware; it is not a firmware project

QMK is often chosen for wired boards, while ZMK is widely used for wireless and split keyboards. That is a practical tendency, not a strict wired-versus-wireless rule: check the current support for your exact keyboard and controller. Read the QMK layer guide for its layer model and the ZMK keymap documentation for bindings and behaviors.

The main components to identify are:

  • Keyboard PCB and revision: Determines the matrix, layout, controller pins, and supported firmware target.
  • Microcontroller: Runs the firmware; flash size and peripherals constrain available features.
  • Switch matrix and diodes: Connect key positions to controller inputs and affect how simultaneous presses are detected.
  • Keymap and behaviors: Define layers, keycodes, tap-hold actions, macros, and encoder bindings.
  • Bootloader and flashing method: Control how the compiled image is transferred to the board.

Real-World Use Cases

  • Compact layouts: Put arrows, function keys, and navigation on a momentary layer instead of adding a full-size cluster.
  • Programming and editing: Place common shortcuts or editor navigation near the home row, then switch back to a standard layout when needed.
  • Split and wireless keyboards: Configure each half, communication, and power-related behavior for the exact supported hardware.
  • Accessible input: Move difficult combinations to easier-to-reach keys, provide alternatives to rapid chords, or pair custom layouts with other assistive input. Firmware is one part of accessibility; test the complete setup with the people who will use it.
  • Dedicated devices: Give a macropad, encoder, or small control surface a focused set of actions for a particular application.

Practical Guide: Build and Flash a Keymap

Check the board first

Record the keyboard model and PCB revision, microcontroller, firmware project, and bootloader. Check the keyboard maker’s documentation and the project’s current supported-keyboard list. Save a copy of the original keymap and, when available, a known-good firmware image and recovery instructions. Never select a target just because its name or shape looks similar.

Build a QMK keymap

On Windows, QMK recommends its packaged QMK MSYS environment for setting up the build tools; other operating systems have their own setup steps in the QMK getting-started guide. In QMK MSYS, initialize the repository, select the exact keyboard target, and create a copy of its default keymap:

qmk setup
qmk list-keyboards
qmk new-keymap -kb <keyboard>

Edit the generated keymap in a text editor. The keyboard name is the target path returned by QMK, and the keymap name is the one created in the previous step:

qmk compile -kb <keyboard> -km <keymap>
qmk flash -kb <keyboard> -km <keymap>

Compile first and confirm it succeeds. Then follow the board’s instructions to enter its bootloader before flashing. The required image type, bootloader, and reset sequence vary; the QMK flashing guide describes common methods. qmk flash can build and flash a target, but it cannot make an incorrect target or bootloader safe.

Configure a ZMK keyboard

ZMK’s user setup guide walks through installing its CLI, creating a configuration repository, and adding a supported keyboard. Its keymaps use Devicetree syntax. For example, this is the binding list for a documented six-key macropad; a real keymap must match the number and order of positions in its keyboard definition:

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>

/ {
    keymap {
        compatible = "zmk,keymap";

        default_layer {
            bindings = <
                &kp Z &kp M &kp K
                &kp A &kp B &kp C
            >;
        };
    };
};

With the default setup, committing and pushing configuration changes triggers the configured GitHub Actions workflow to build firmware. Review the generated image and its target before flashing it using the keyboard’s documented procedure.

Keep flashing recoverable and secure

Use firmware built from a trusted source and verify that it matches the exact board revision. Keep the original configuration and recovery steps somewhere accessible, and avoid replacing or changing a bootloader unless the board’s documentation explains how to recover it. If a keyboard stops responding, check its reset or bootloader procedure and reflash a known-good image for that target rather than trying random images.

Treat firmware configuration as software: review changes before building, especially third-party modules and CI workflows, and do not put passwords, API tokens, or other secrets in a keymap or public configuration repository. NIST’s firmware resiliency guidance is broader than keyboards, but its principles of protecting updates and planning recovery are useful when thinking about firmware risk.

Common Misconceptions

  • “QMK is only wired and ZMK is only wireless.” Their common use cases differ, but capabilities depend on the supported board, controller, and project configuration.
  • “A keymap is the firmware.” The keymap describes mappings and behaviors; the firmware also contains the code that scans the hardware and communicates with the host.
  • “VIA can add any feature.” VIA can change only the options exposed by compatible firmware. A feature not present in the firmware usually needs a firmware change and rebuild.
  • “Hot-swappable switches mean any firmware will work.” Hot-swap sockets simplify replacing switches; they do not identify the PCB revision, controller, matrix, or bootloader.
  • “A successful compile means flashing is safe.” Compilation checks that a target builds. It does not prove that the target matches the board connected to the computer.
TBO Editorial

About the Author

TBO Editorial writes about the latest updates about products and services related to Technology, Business, Finance & Lifestyle. Do get in touch if you want to share any useful article with our community.