How to Design Mechanical Keyboard PCBs with KiCad: A Complete Step-by-Step Guide
Mechanical keyboards have evolved from specialized equipment to popular mainstream devices favored by programmers, gamers, writers, and custom PC enthusiasts. While many keyboard hobbyists start by modifying existing boards or swapping switches, the ultimate customization experience lies in designing your own mechanical keyboard PCB (Printed Circuit Board).
Designing a PCB may appear difficult at first, but with the right approach and tools such as KiCad (a free open-source EDA suite), the process becomes manageable and rewarding. This guide provides a complete walkthrough—from planning layouts to generating manufacturing files.
What is a Mechanical Keyboard PCB?
A mechanical keyboard PCB is the board responsible for:
- Detecting keypresses
- Managing matrix scanning
- Communicating with the controller (e.g., ATmega32U4, RP2040)
- Power routing and LED control (optional RGB/backlight)
It is the electrical backbone of any keyboard.
Why Use KiCad for Keyboard PCB Design?
KiCad is well-suited for custom keyboard design because:
| Feature | Benefit |
|---|---|
| Free & Open Source | No license fees, accessible for hobbyists |
| Large Community Support | Many community footprints, tutorials, open-source keyboard files available |
| Supports Custom Footprints | Required for switches, diodes, sockets |
| Integrated 3D Viewer | Helps visualize key and switch alignment |
| Easy Gerber File Export | Required for PCB fabrication |
Key Concepts You Must Know Before Designing
- Switch Footprints
Most keyboards use MX-compatible switches (Cherry, Gateron, Kailh).
Example: Kailh hot-swap socket footprints if designing hot-swappable keyboards. - Keyboard Matrix
Instead of wiring each key directly, switches are arranged in rows and columns to reduce microcontroller pin usage. - Microcontroller Choice
Common controllers:- ATmega32U4 (used in many open keyboards)
- STM32 MCUs
- Raspberry Pi RP2040 (popular for QMK + low cost)
- Firmware Compatibility
Ensure your PCB layout is compatible with:- QMK (most popular)
- VIA/VIAL (for real-time key remapping)
Step-by-Step Guide to Designing a Mechanical Keyboard PCB in KiCad
Step 1: Plan Your Keyboard Layout
You can use:
- Keyboard Layout Editor (KLE) → https://www.keyboard-layout-editor.com
Create a layout visually online.
Export the layout for reference (you’ll need measurements).
Step 2: Convert Layout to a Plate/PCB Reference
Use KLE to Plate or ErgoDox EZ Builder tools to generate switch spacing measurements.
Alternatively, download open-source PCB plates (e.g., from GitHub: ai03, otd, keebs projects) and reference them.
Step 3: Setup KiCad Project
- Open KiCad
- Create a New Project
- Enable recommended libraries:
- MX switch footprints
- Diode SMD footprints
- Kailh hot-swap sockets (if using)
- Controller footprint (ATmega32U4 or RP2040)
Step 4: Schematic Design
In KiCad Schematic Editor:
- Place the microcontroller
- Add rows and columns nets
- Add diodes (one per switch to prevent ghosting)
- Draw switch matrix connections
- Add:
- Crystal oscillator (if required)
- USB circuit and ESD protection
- Decoupling capacitors
- Reset button, programming pins
Example Matrix Layout:
Row0: SW1 SW2 SW3 ...
Row1: SW4 SW5 SW6 ...
Col0 Col1 Col2
Step 5: Assign Footprints to Components
Use Tools → Assign Footprints.
Important footprints:
- Cherry MX switch (e.g., MX-ALPS-CHERRY)
- SMD Diode SOD-123
- USB-C Port Footprint
- Voltage Regulator (if needed)
- MCU breakout footprint
Step 6: PCB Layout and Routing
Switch to PCB Editor.
- Import the schematic netlist.
- Position switches according to measurements.
- Align switch centers (usually 19.05 mm spacing).
- Place controller and diodes close to matrix traces.
- Route traces:
- Keep signal lines short and clean
- Avoid crossing layers excessively
- Use ground plane (Fill Zone → GND)
If adding RGB LEDs, follow manufacturer design guidelines.
Step 7: Check Design Rules
Run:
- DRC (Design Rule Check)
- Ensure tracks do not overlap
- Check pad clearances
Step 8: Generate Manufacturing Files
Go to:
File → Plot → Gerber Files
Also generate:
File → Fabrication Outputs → Drill Files
These files are sent to PCB manufacturers such as:
- JLCPCB
- PCBWay
- OSH Park
Step 9: Flashing Firmware
Once your PCB arrives and is soldered:
- Set up QMK environment
- Create a keymap configuration
- Compile and flash firmware using:
qmk compile qmk flash
Optional:
Enable VIA support for GUI key remapping.
Tips for Success
- Always print a 1:1 scale PCB paper mockup and place real switches to confirm alignment.
- Test one prototype before bulk ordering.
- Start with a small keyboard (40% or 60%) before bigger layouts.
Conclusion
Designing a mechanical keyboard PCB may appear complex, but it becomes manageable with the right workflow and practice. By using KiCad’s schematic editor, PCB layout tools, and open-source community footprints, hobbyists can design professional-grade keyboard PCBs compatible with QMK and VIA.
Creating your own PCB not only offers customization but also enriches your understanding of electronics and firmware—making the final typing experience more meaningful and personalized.