Skip to the content
2 layers83 × 127 mmNumpad, the printed circuit board in 3D

Hand-wired 17-key USB numpad on Pi Pico W. CircuitPython, diode matrix, event-driven scanning.

Size
83 × 127 mm
Copper layers
2
Thickness
1.6 mm
Parts
120
Nets
96
Pads
505
Tracks, vias
1,167, 134
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
2 Jul 2026
Updated
10 Sep 2026

Overview

Numpad is an open-source printed circuit board by blafr103, from the blafr103/pico-numpad repository on GitHub, published under the MIT licence. It is a 2-layer board of 83 × 127 mm with 120 parts on 96 nets, routed with 1,167 tracks and 134 vias.

It is built around the RP2040, 74AHCT1G125SE and W25Q128JVSIQ, with the USBLC6-2SC6, 1N4148W and BSS138 among its other parts. Its parts include 36 capacitors, 35 diodes, 11 resistors, 5 ICs and 3 connectors. It belongs with the lEDs and displays boards and the RP2040 boards of this library.

Main components

6

README

README.md

pico-numpad

Custom-built 17-key USB HID numpad powered by a Raspberry Pi Pico W, featuring a hand-wired switch matrix, 16×2 LCD interface, host-integrated PC monitoring, weather display, and onboard calculator.

The enclosure, electronics, and firmware were designed specifically for this project using CircuitPython with event-driven matrix scanning via keypad.KeyMatrix.

This README documents the hand-wired prototype. A custom two-layer PCB successor built around a bare RP2040 is documented in hardware/.

Features

  • USB HID numeric keypad
  • Event-driven matrix scanning (keypad.KeyMatrix)
  • 16x2 LCD with switchable views:
    • Clock + weather (current conditions and local time for one of four preset Canadian locations; date + time synced from the host)
    • PC stats, 4 cycling pages: overview (CPU/GPU utilization, temperature, package power), memory (RAM utilization, DIMM temperatures, VRAM), clocks (P/E-core max, GPU, TjMax distance), and voltages
    • Calculator (+ - * / with standard precedence; expression on row 0, result on Enter; keys are captured while active and send nothing to the PC)
    • Lifetime keypress statistics
  • NumLock doubles as a momentary Fn key:
    • Fn+0: Clock view; pressed again while on it, cycles the weather location
    • Fn+1: PC stats view; pressed again while on it, cycles the stat pages
    • Fn+2: Calculator view; pressed again while on it, clears
    • Fn+3: Statistics view
    • Fn+'+': Increase keypad LED brightness
    • Fn+'-': Decrease keypad LED brightness
  • Persistent settings (lifetime key counter and LED brightness) are stored in the CircuitPython filesystem (/count.txt on internal flash).
  • Automatic LCD backlight/LED timeout after 300 seconds of inactivity
  • Optional Python companion application providing local time, weather (Environment Canada API), and PC hardware monitoring.


Finished Device

Hand-Wired Matrix

Physical Construction

This prototype is entirely hand-built rather than assembled on a PCB. The hand-wired construction allowed the electrical design, firmware, and enclosure to be developed and validated before committing to a dedicated PCB. That board now exists as rev A and is documented in hardware/.

Enclosure

  • Designed from scratch in Autodesk Fusion 360
  • 3D printed on a Bambu Lab X1 Carbon using PETG for the structural components and translucent polycarbonate (PC) for the light-diffusing enclosure
  • Two-piece printed enclosure with integrated LCD mount and switch plate
  • Translucent white PC diffuses the per-key LEDs

Switches & Keycaps

  • Switches: Gateron KS-9 G Pro Black linear switches
  • Keycaps: Ranked POM Jelly Premium Translucent keycaps

Key Matrix

The keypad is wired as a 5×4 switch matrix with one diode per key to eliminate ghosting.

Color coding throughout the wiring:

ColorFunction
RedMatrix columns
YellowMatrix rows
OrangeLED power distribution
BlackLED ground

Each switch includes a 1N4148 diode (anode toward the row, cathode toward the column), matching the firmware configuration (columns_to_anodes=False). The matrix layout and diode orientation were verified using the included tools/matrix_map_test.py and tools/diode_test.py utilities.

Note that the rev A PCB in hardware/ uses the opposite orientation (cathode to row).

Lighting

  • One discrete white LED beneath each key
  • LEDs share a common PWM-controlled supply, with each LED using its own 100 Ω current-limiting resistor
  • Brightness is adjustable in 12.5% increments using Fn + '+' and Fn + '-'
  • The selected brightness is persisted across power cycles
  • LEDs turn off together with the LCD backlight after the inactivity timeout and are restored automatically on activity

Electronics

  • Raspberry Pi Pico W mounted internally
  • HD44780-compatible 16×2 LCD with PCF8574 I²C backpack

Hardware

  • Raspberry Pi Pico W (RP2040), CircuitPython 9.2.1
  • 16×2 HD44780-compatible LCD with PCF8574 I²C backpack (0x27)
  • 17 Gateron KS-9 G Pro Black switches
  • Ranked POM Jelly translucent keycaps
  • 17 white discrete LEDs
  • Rows: GP2–GP6
  • Columns: GP12–GP15
  • Key LEDs (PWM): GP11
  • I²C: SDA GP0 · SCL GP1

Install

  1. Flash CircuitPython 9.x to the Pico.
  2. Copy code.py, boot.py, and lib/ to the CIRCUITPY drive, then power cycle (boot.py changes only apply at power-up).
    • On first boot, the firmware creates /count.txt to store persistent settings (currently the lifetime keypress count and LED brightness).
  3. Install adafruit_hid from the CircuitPython 9.x library bundle into lib/.
  4. Optional, for the clock, weather, and PC stats: pip install pyserial requests env_canada on the PC and run python host/companion.py. The pad is fully functional without it; the clock shows UNKNOWN, weather shows "no weather", and PC stats show "no data" until first contact.
    • The Pico exposes two serial ports; the script auto-detects the data port, or set PORT in the script manually.
    • PC stats additionally require LibreHardwareMonitor running as administrator with its web server enabled (Options - Remote Web Server - Run). Time and weather work without it.
    • Weather locations are configured in companion.py as label + coordinates + IANA timezone.
    • For hands-off startup on Windows (Task Scheduler setup, logging, troubleshooting), see host/README.md.

Design

Matrix scanning and debouncing run in C in the background (keypad.KeyMatrix, 10 ms interval); the main loop only consumes queued edge events, so a busy loop delays input rather than dropping it. HID output uses press()/release() on edges so the host sees real held keys and handles auto-repeat. A hand-written equivalent of the scanner (polling, per-key debounce state machine) is kept in reference/ with a comparison of the two approaches.

columns_to_anodes=False is required for this board's diode orientation; the default silently reads all keys as dead.

boot.py remounts the filesystem to allow the firmware to save the persistent key counter. Holding NumLock while connecting the Pico starts a development mode that leaves the drive writable from the host and disables persistence.

The LCD is driven with no sleep() in the main loop: dirty-flag rendering (I²C writes only on state change), fixed-width line overwrites instead of clear(), and edge-triggered backlight control. A full LCD line write costs ~50 ms over I²C, so unconditional redraws would starve input latency.

The LCD is organized as switchable views (splash on boot, clock, PC stats, calculator, statistics). Holding NumLock acts as a momentary Fn key: tapping a digit while held switches views without typing it. A plain NumLock tap is deferred until release so tap and hold can be distinguished without affecting normal typing. Each view owns its input: most pass keys through to the PC as normal typing, while the calculator captures digits and operators entirely (including suppressing their release events), so nothing leaks to the host while it is active.

The calculator stores the expression as typed (row 0, scrolling left past 16 characters) and evaluates on Enter with standard precedence: tokens are reduced in two passes, folding * and / left-to-right first, then summing the remaining +/- terms. Divide-by-zero shows Error, cleared by the next digit. After a result, a digit starts a fresh expression and an operator continues from the result. Results too wide for the row use scientific notation. Leaving the view clears it.

Time, weather, and PC stats come from an optional host script (host/companion.py, setup and operation in host/README.md) over a second USB CDC serial port enabled in boot.py. The protocol is newline-terminated ASCII key:value lines; the Pico is a pure listener and the host broadcasts unsolicited (time on connect and every 30 s, stats every 2 s, weather every 10 min). The clock free-runs on the crystal between syncs and re-anchors on every message, bounding drift to one broadcast interval. The RP2040 has no battery-backed RTC, so time is lost at power-off and shows UNKNOWN until the first sync.

Weather comes from Environment Canada via the env_canada package (nearest site to each configured coordinate). The clock view shows one location's conditions on row 0 and its local date/time on row 1; the host sends each location's UTC-offset delta computed fresh with zoneinfo, so DST is handled entirely host-side. Weather older than 30 minutes displays as stale (LABEL --); PC stats older than 15 seconds display as "no data".

PC stat rows are composed entirely on the host: companion.py reads LibreHardwareMonitor's JSON endpoint, selects sensors by hardware prefix and display name (numeric sensor indices shift between LHM versions), and sends each page row as a finished 16-character line. The Pico renders these verbatim, apart from substituting * with the LCD's degree symbol, so adding or reworking a stat page is a host-only change. Missing sensors render as --; the sensor names target this machine's hardware and need adjusting for others.

Persistent settings (currently the lifetime keypress count and LED brightness) are stored in /count.txt. To minimize flash wear, writes are batched (100 keypresses by default) and also occur immediately after brightness changes and when the device transitions to the idle state.

The firmware is organized into independent subsystems for input handling, LCD rendering, view management, HID output, persistent settings, and host communication.

Future Improvements

  • User-configurable key mapping and macros
  • More robust persistent configuration storage

The custom PCB, integrated USB-C, and per-key RGB lighting items previously listed here are addressed by the rev A board in hardware/.

Tools

  • tools/matrix_map_test.py prints (row, col) per keypress; used to build/verify the keymap
  • tools/diode_test.py is a bidirectional scan; verifies diode presence and orientation per key

Run either by copying to CIRCUITPY as code.py (back up first) and watching the serial console. Run in dev mode (NumLock at plug-in) so the drive is writable.

Credits

LCD driver (lib/lcd.py, lib/i2c_pcf8574_interface.py): dwhall/circuitpython_lcd, original license headers retained.

Parts

120
QtyValueFootprintReferences
27100nCapacitor_SMD:C_0603_1608MetricC10, C12, C13, C14, C17, C18, C19, C20, C21, C22, C23, C24, C25, C26, C27, C28 +11
181N4148WDiode_SMD:D_SOD-123D1, D2, D3, D4, D5, D6, D7, D10, D11, D12, D13, D14, D15, D16, D17, D18 +2
17MX_SK6812MINI-EPCM_marbastlib-mx:LED_MX_6028RLED1, LED2, LED3, LED4, LED5, LED6, LED7, LED8, LED10, LED11, LED12, LED13, LED14, LED15, LED16, LED17 +1
31uCapacitor_SMD:C_0603_1608MetricC3, C5, C11
210kResistor_SMD:R_0603_1608MetricR3, R4
210uCapacitor_SMD:C_0805_2012MetricC1, C2
21kResistor_SMD:R_0603_1608MetricR5, R8
222uCapacitor_SMD:C_0805_2012MetricC35, C36
227Resistor_SMD:R_0603_1608MetricR6, R7
227pCapacitor_SMD:C_0603_1608MetricC15, C16
24k7Resistor_SMD:R_0603_1608MetricR10, R11
25k1Resistor_SMD:R_0603_1608MetricR1, R2
2BSS138Package_TO_SOT_SMD:SOT-23Q1, Q2
10PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX15
11PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX12
112MHzCrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1
12PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX13
13PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX14
14PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX9
1470Resistor_SMD:R_0603_1608MetricR9
15PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX10
16PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX11
17PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX5
174AHCT1G125Package_TO_SOT_SMD:SOT-23-5U5
18PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX6
19PCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX7
1BOOTSELButton_Switch_SMD:SW_SPST_PTS645Sx43SMTR92SW1
1Conn_01x03Connector_PinHeader_2.54mm:PinHeader_1x03_P2.54mm_VerticalJ2
1Conn_01x04Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalJ3
1DIVPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX2
1ENTERPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX17
1MINPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX4
1MULTPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX3
1NCP1117-3.3_SOT223Package_TO_SOT_SMD:SOT-223-3_TabPin2U1
1NUMPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX1
1PERIODPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX16
1PLUSPCM_marbastlib-mx:SW_MX_HS_CPG151101S11_1uMX8
1RESETButton_Switch_SMD:SW_SPST_PTS645Sx43SMTR92SW2
1RP2040Package_DFN_QFN:QFN-56-1EP_7x7mm_P0.4mm_EP3.2x3.2mmU3
1RotaryEncoder_SwitchRotary_Encoder:RotaryEncoder_Alps_EC11E-Switch_Vertical_H20mmSW3
1USBLC6-2SC6Package_TO_SOT_SMD:SOT-23-6U2
1USB_C_Receptacle_USB2.0_16PConnector_USB:USB_C_Receptacle_HRO_TYPE-C-31-M-12J1
1W25Q128JVSPackage_SO:SOIC-8_5.3x5.3mm_P1.27mmU4

The 113 most common of 120 parts.

Similar boards

  • 2 layers446.9 × 141.7 mmPerson keyboard, the printed circuit board in 3D

    Person keyboard

    jtljac/person-keyboard

    My personal Keyboard Design

    374 parts
  • 2 layers347.9 × 119.3 mmSupport All PCBS, the printed circuit board in 3D

    Support All PCBS

    Jubakuba/Keycult-TKL-Kicad

    Keycult TKL PCB Replacement with per key rgb.

    401 parts
  • 2 layers308.8 × 99.3 mmHem, the printed circuit board in 3D

    Hem

    marcocampione/Hem-keyboard

    A 65% ANSI keyboard PCB with an RP2040 on the board

    302 partsMIT
  • 4 layers50 × 50 mmFlightController Drone, the printed circuit board in 3D

    FlightController Drone

    damnitzhemanth-oss/Flight_Controller

    Custom STM based flightcontroller designed from scratch.

    157 parts
  • 4 layers100 × 142.5 mmKeeb4x4, the printed circuit board in 3D

    Keeb4x4

    TheRealBluesun/keeb4x4

    4x4 macropad: STM32G431, per-key RGB, ScreenKey display keycaps, encoder. KiCad + Rust/Embassy firmware, USB bootloader, host CLI, printable base.

    127 partsCERN-OHL-P-2.0
  • 2 layers248.6 × 81.9 mmAlpha curISO, the printed circuit board in 3D

    Alpha curISO

    calvin-mcd/alpha-curISO

    The Alpha CurISO is a community pcb for the Curio. It supports two different Alpha Staggers and Ortho Layouts. This is a collaboration between jadethemaid, airuei, galvy0 and calvin.

    241 parts2
  • 4 layers70 × 68 mmSssata fluxpad Fluxpad, the printed circuit board in 3D

    Sssata fluxpad Fluxpad

    punkfab/pcb-corpus

    235 real KiCad boards from open-source hardware repositories, prepared as a placement and routing benchmark

    78 parts1
  • 4 layers95 × 95 mmAgentDeck, the printed circuit board in 3D

    AgentDeck

    Brillar0101/agentdeck

    RP2040 macropad for supervising AI coding agents: 13 hot-swap keys with per-key RGB status, encoder, joystick, 4-layer PCB, CircuitPython firmware, printable enclosure

    101 partsMIT

Questions

How big is the Numpad PCB?

It measures 83 × 127 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Numpad use?

120 parts, built around the RP2040, 74AHCT1G125SE, W25Q128JVSIQ 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 Numpad KiCad files?

From the blafr103/pico-numpad repository on GitHub, at the commit this page was made from: the board is hardware/numpad/numpad.kicad_pcb and its schematic hardware/numpad/01_power_usb.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Numpad design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).