Skip to the content
2 layers375 × 138.1 mmKB USB Controller RP2040, the printed circuit board in 3D

Hardware design files for a custom mechanical keyboard PCB powered by STM32F072 (crystal-less USB), featuring a 6x17 matrix, USB Type-C, USBLC6-2 ESD protection, and status LEDs in KiCad.

Size
375 × 138.1 mm
Copper layers
2
Thickness
1.51 mm
Parts
201
Nets
145
Pads
585
Tracks, vias
655, 41
Pours
5
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
6 Oct 2026
Updated
6 Oct 2026

Overview

KB USB Controller RP2040 is an open-source printed circuit board by 12Robert20, from the 12Robert20/STM32F072-Custom-Mechanical-Keyboard repository on GitHub. It is a 2-layer board of 375 × 138.1 mm with 201 parts on 145 nets, routed with 655 tracks and 41 vias.

It is built around the AP2112K-3.3 and USBLC6-2SC6. Its parts include 90 diodes, 89 switches, 9 capacitors, 8 resistors and 3 ICs. It belongs with the keyboards and input and lEDs and displays boards and the RP2040 and STM32 boards of this library.

Main components

2

README

README.md

STM32F072 Custom Mechanical Keyboard Controller

A custom hardware controller and switch matrix PCB designed in KiCad, powered by the STMicroelectronics STM32F072CBU6 microcontroller. Built for standard ANSI/ISO mechanical keyboard configurations with full N-Key Rollover (NKRO), native USB Type-C connectivity, and hardware-level ESD protection.

1. Project Overview

This project implements a self-contained mechanical keyboard controller and matrix layout. The architecture was developed to prioritize reliability, low Bill-of-Materials (BOM) complexity, and robust electrical protection without requiring external crystals or SPI flash memories.

Key Specifications

  • Microcontroller: STM32F072CBU6 (Arm Cortex-M0, 48 MHz, UFQFPN-48 package)
  • Switch Matrix: 6 rows $\times$ 17 columns (up to 102 switch positions)
  • Anti-Ghosting: Individual 0603 switching diodes per key (Full NKRO)
  • USB Interface: 16-pin USB Type-C with dual $5.1\ \text{k}\Omega$ CC pulldowns (UFP / Device mode)
  • ESD Protection: STMicroelectronics USBLC6-2SC6 low-capacitance TVS diode array on USB $D+$ and $D-$ lines
  • Power Regulation: Diodes Inc. AP2112K-3.3 LDO (3.3V, 600 mA output, high PSRR) with ceramic decoupling
  • Programming & Debug: 4-pin SWD interface (ST-Link compatible) plus hardware Reset and Boot0 pushbuttons
  • Status Indicators: 3 onboard 1206 LEDs for Caps Lock, Num Lock, and Scroll Lock
  • Impedance Control: Controlled $90\ \Omega$ differential impedance on USB 2.0 Full-Speed lines

2. Architecture & Design Rationale

During initial schematic capture and floorplanning, three controller platforms were evaluated:

MicrocontrollerUSB ArchitectureExternal Flash RequiredExternal Oscillator RequiredDesign Verdict
RP2040USB 2.0 FSYes (External QSPI NOR)Yes (12 MHz Crystal)Higher BOM count and routing density
CH552USB 2.0 FSNo (Internal)No (Internal RC)Low flash/RAM headroom, limited GPIO drive
STM32F072CBU6USB 2.0 FS (Native)No (128 KB On-Chip)No (Clock Recovery System)Selected: Clean single-chip layout, native DFU, robust tooling

The STM32F072 utilizes internal Clock Recovery System (CRS) hardware to synchronize its internal 48 MHz high-speed oscillator (HSI48) directly to USB Start-of-Frame (SOF) packets. This eliminates the need for an external quartz crystal or resonator, saving board real estate and reducing susceptibility to mechanical shock.

3. Hardware Subsystems

3.1. Matrix Architecture (6 x 17)

The board routes 6 row lines (ROW_0 through ROW_5) and 17 column lines (COLS_0 through COLS_16).

  • Standard keyboard rows: Function row, Number row, QWERTY, Home row, Bottom row, and Space/Modifier row.
  • Each switch footprint is paired with a surface-mount 0603 diode oriented from row to column to prevent back-feeding and ghosting during simultaneous multi-key presses.

3.2. Power Supply (VBUS to +3.3V)

  • Input: $5\ \text{V}$ nominal supplied via USB VBUS.
  • Regulation: AP2112K-3.3 SOT-23-5 low-dropout linear regulator capable of supplying up to $600\ \text{mA}$ with low quiescent current and drop-out voltage of $\sim 250\ \text{mV}$ at full load.
  • Decoupling: $1\ \mu\text{F}$ input and output MLCC ceramic capacitors supplemented by local $100\ \text{nF}$ decoupling caps adjacent to all MCU $V_{DD}$ pins.

3.3. USB-C Entry and Protection

  • Connector: 16-pin USB Type-C receptacle (USB 2.0 signal lines only).
  • Configuration Channel: Two independent $5.1\ \text{k}\Omega$ ($1%$) pulldown resistors tied to CC1 and CC2 to request $5\ \text{V}$ at up to $3\ \text{A}$ from standard Type-C and Type-C PD source devices.
  • Transient Voltage Suppression (TVS): An STMicroelectronics USBLC6-2SC6 array placed directly adjacent to the USB receptacle clamps electrostatic discharge events up to $15\ \text{kV}$ air / $8\ \text{kV}$ contact without degrading $12\ \text{Mbps}$ Full-Speed differential signal integrity ($C_{I/O} < 3.5\ \text{pF}$).

3.4. Status Indicators

  • 3 GPIO-driven indicator channels (CAPS_LED, NUM_LED, SCRL_LED).
  • Output lines feature dedicated $200\ \Omega$ series current-limiting resistors paired with 1206 package status LEDs.

4. PCB Layout and Differential Routing

The PCB is implemented on a standard 2-layer FR-4 substrate ($1.6\ \text{mm}$ thickness):

  • USB Differential Pair: Calculated and routed for a $90\ \Omega \pm 10%$ differential impedance target ($Z_{\text{diff}}$):
    • Trace width: $0.28\ \text{mm}$
    • Differential spacing: $0.20\ \text{mm}$
    • An unbroken ground plane on Layer 2 directly references the pair from the receptacle through the TVS diode up to MCU pins PA11 ($D-$) and PA12 ($D+$).
  • Ground Return Paths: Top and bottom layers utilize copper fills tied together with regular via stitching to minimize loop area across switch matrix column returns.
  • Mechanical Tolerances: Solder mask expansions and component keep-outs are verified against mechanical plate cuts and switch housing footprints.

5. Firmware Support

The hardware is compatible with several embedded keyboard firmware ecosystems:

  1. QMK Firmware: Using the ChibiOS HAL for STM32F072 targets (STM32F072xB).
  2. ZMK Firmware: Via custom Zephyr board definitions.
  3. Bare-metal STM32Cube / Custom C: Direct USB HID implementation using standard ST USB Device Middleware.

Programming & Flashing

  • Initial Flashing (SWD): Connect an ST-Link V2/V3 programmer to header J2:
    • Pin 1: +3.3V
    • Pin 2: SWDIO (PA13)
    • Pin 3: SWCLK (PA14)
    • Pin 4: GND
  • USB DFU Bootloader: Hold down the onboard BOOT0 button and toggle RESET to enter the internal ST factory system memory bootloader directly over USB Type-C.

6. Fabrication & Assembly Notes

  • Layer Count: 2 layers
  • Minimum Trace / Space: 0.2 mm / 0.2 mm
  • Minimum Via Size: 0.3 mm drill / 0.6 mm annular ring
  • Surface Finish: ENIG recommended (or Lead-free HASL)
  • Passive Packages: 0603 (diode array and decoupling) / 1206 (indicator LEDs)
  • SMD IC Footprint: UFQFPN-48 with central exposed thermal ground pad

7. Author & Inquiries

Designed by an independent hardware engineer specializing in KiCad PCB layout, embedded hardware design, and DFM optimization.

Open for freelance inquiries regarding schematic capture, board redesigns, and layout for prototype or production hardware. Direct messages can be sent via LinkedIn or GitHub issues.

Parts

201
QtyValueFootprintReferences
87D_Small_FilledDiode_SMD:D_0603_1608Metric_Pad1.05x0.95mm_HandSolderD10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25 +71
87SW_Push_45degButton_Switch_Keyboard:SW_Cherry_MX_1.50u_PlateSW10, SW11, SW12, SW13, SW14, SW15, SW16, SW17, SW18, SW19, SW20, SW21, SW22, SW23, SW24, SW25 +71
6100nCapacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolderC2, C3, C4, C5, C6, C9
31uCapacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolderC1, C7, C8
3200RResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR3, R4, R5
3LEDLED_SMD:LED_1206_3216Metric_Pad1.42x1.75mm_HandSolderD1, D2, D108
210kResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR1, R2
25k1Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR7, R8
2SW_MEC_5GButton_Switch_SMD:SW_MEC_5GSH9SW1, SW2
110KResistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolderR6
1AP2112K-3.3Package_TO_SOT_SMD:SOT-23-5U2
1Conn_01x04_PinConnector_Wire:SolderingWirePad_1x04_SMD_2x4mmJ2
1STM32F072CBUxPackage_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mmU1
1USBLC6-2SC6Package_TO_SOT_SMD:SOT-23-6U3
1USB_C_Receptacle_USB2.0_16PConnector_USB:USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_HorizontalJ1

Similar boards

  • 4 layers60.8 × 61.3 mmOS3M Mouse, the printed circuit board in 3D

    OS3M Mouse

    spoter368/os3m-hardware

    All the hardware needed to build your own OS3M Mouse!

    51 parts399
  • 2 layers390 × 120.2 mmKeyboard, the printed circuit board in 3D

    Keyboard

    joshajohnson/entropy

    Strange keyboard with a left hand numpad

    334 parts97
  • 2 layers89 × 124 mmHub20, the printed circuit board in 3D

    Hub20

    joshajohnson/Hub20

    Hub20 is a numpad with a bunch of features you never knew you needed.

    183 parts68
  • 2 layers84.2 × 100 mmFabpack out v5 8, the printed circuit board in 3D

    Fabpack out v5 8

    yuz207/agentpad13

    agentpad13 — open-source 13-key macropad for agentic work (RP2040, vial-qmk, planar joystick, Raw HID agent-status protocol)

    126 parts41
  • 2 layers80.8 × 30 mmStm32 dev, the printed circuit board in 3D

    Stm32 dev

    brainstorm/bbtrackball-rs

    Experimenting with Blackberry trackball for keyboard ergonomics

    61 parts34
  • 2 layers46.8 × 52 mmUsb dev board, the printed circuit board in 3D

    Usb dev board

    cs2dsb/stm32-usb.rs

    A dev board designed to facilitate the development of USB firmware for STM32

    57 parts30Apache-2.0
  • 2 layers64.3 × 25.4 mmFranzininho WiFi, the printed circuit board in 3D

    Franzininho WiFi

    Franzininho/Franzininho-WiFi

    Franzininho WiFi is a board with ESP32-S2.

    38 parts24

Questions

How big is the KB USB Controller RP2040 PCB?

It measures 375 × 138.1 mm and has 2 copper layers, 1.51 mm thick.

What parts does the KB USB Controller RP2040 use?

201 parts, built around the AP2112K-3.3 and USBLC6-2SC6. 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 KB USB Controller RP2040 KiCad files?

From the 12Robert20/STM32F072-Custom-Mechanical-Keyboard repository on GitHub, at the commit this page was made from: the board is KB-USB-Controller-RP2040.kicad_pcb and its schematic KB-USB-Controller-RP2040.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the KB USB Controller RP2040 design in my own project?

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