

KB USB Controller RP2040
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
2README
README.mdSTM32F072 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:
| Microcontroller | USB Architecture | External Flash Required | External Oscillator Required | Design Verdict |
|---|---|---|---|---|
| RP2040 | USB 2.0 FS | Yes (External QSPI NOR) | Yes (12 MHz Crystal) | Higher BOM count and routing density |
| CH552 | USB 2.0 FS | No (Internal) | No (Internal RC) | Low flash/RAM headroom, limited GPIO drive |
| STM32F072CBU6 | USB 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
CC1andCC2to 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-2SC6array 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-$) andPA12($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:
- QMK Firmware: Using the ChibiOS HAL for STM32F072 targets (
STM32F072xB). - ZMK Firmware: Via custom Zephyr board definitions.
- 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
- Pin 1:
- USB DFU Bootloader: Hold down the onboard
BOOT0button and toggleRESETto 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| Qty | Value | Footprint | References |
|---|---|---|---|
| 87 | D_Small_Filled | Diode_SMD:D_0603_1608Metric_Pad1.05x0.95mm_HandSolder | D10, D11, D12, D13, D14, D15, D16, D17, D18, D19, D20, D21, D22, D23, D24, D25 +71 |
| 87 | SW_Push_45deg | Button_Switch_Keyboard:SW_Cherry_MX_1.50u_Plate | SW10, SW11, SW12, SW13, SW14, SW15, SW16, SW17, SW18, SW19, SW20, SW21, SW22, SW23, SW24, SW25 +71 |
| 6 | 100n | Capacitor_SMD:C_0603_1608Metric_Pad1.08x0.95mm_HandSolder | C2, C3, C4, C5, C6, C9 |
| 3 | 1u | Capacitor_SMD:C_0805_2012Metric_Pad1.18x1.45mm_HandSolder | C1, C7, C8 |
| 3 | 200R | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R3, R4, R5 |
| 3 | LED | LED_SMD:LED_1206_3216Metric_Pad1.42x1.75mm_HandSolder | D1, D2, D108 |
| 2 | 10k | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R1, R2 |
| 2 | 5k1 | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R7, R8 |
| 2 | SW_MEC_5G | Button_Switch_SMD:SW_MEC_5GSH9 | SW1, SW2 |
| 1 | 10K | Resistor_SMD:R_0603_1608Metric_Pad0.98x0.95mm_HandSolder | R6 |
| 1 | AP2112K-3.3 | Package_TO_SOT_SMD:SOT-23-5 | U2 |
| 1 | Conn_01x04_Pin | Connector_Wire:SolderingWirePad_1x04_SMD_2x4mm | J2 |
| 1 | STM32F072CBUx | Package_DFN_QFN:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mm | U1 |
| 1 | USBLC6-2SC6 | Package_TO_SOT_SMD:SOT-23-6 | U3 |
| 1 | USB_C_Receptacle_USB2.0_16P | Connector_USB:USB_C_Receptacle_GCT_USB4105-xx-A_16P_TopMnt_Horizontal | J1 |
Similar boards
- 4 layers60.8 × 61.3 mm

- 2 layers390 × 120.2 mm

- 2 layers89 × 124 mm

Hub20
joshajohnson/Hub20
Hub20 is a numpad with a bunch of features you never knew you needed.
183 parts68 - 2 layers84.2 × 100 mm

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 mm

Stm32 dev
brainstorm/bbtrackball-rs
Experimenting with Blackberry trackball for keyboard ergonomics
61 parts34 - 2 layers46.8 × 52 mm

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 mm

- 2 layers114.1 × 94.7 mm

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.