aj0070/split-keyboard-half
A USB‑C–powered RP2040 keyboard controller board with 17-key diode-isolated matrix, QSPI flash, 12 MHz crystal, reset/boot controls, 3.3 V regulation, USB interface, and TRRS serial split connector.
- Version
- 1.0.0
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone aj0070/split-keyboard-half # download the package files into ./split-keyboard-half
tsci add aj0070/split-keyboard-half # add it to your project as @tsci/aj0070.split-keyboard-halfIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
index.circuit.tsx
PCB
Schematic
import React from "react"
import type { ChipProps } from "tscircuit"
import { CPG151101S11 } from "./imports/CPG151101S11"
import { HC_PJ_320A_4P_D } from "./imports/HC_PJ_320A_4P_D"
const rp2040PinLabels = {
pin1: "IOVDD6",
pin2: "GPIO0",
pin3: "GPIO1",
pin4: "GPIO2",
pin5: "GPIO3",
pin6: "GPIO4",
pin7: "GPIO5",
pin8: "GPIO6",
pin9: "GPIO7",
pin10: "IOVDD5",
pin11: "GPIO8",
pin12: "GPIO9",
pin13: "GPIO10",
pin14: "GPIO11",
pin15: "GPIO12",
pin16: "GPIO13",
pin17: "GPIO14",
pin18: "GPIO15",
pin19: "TESTEN",
pin20: "XIN",
pin21: "XOUT",
pin22: "IOVDD4",
pin23: "DVDD2",
pin24: "SWCLK",
pin25: "SWD",
pin26: "RUN",
pin27: "GPIO16",
pin28: "GPIO17",
pin29: "GPIO18",
pin30: "GPIO19",
pin31: "GPIO20",
pin32: "GPIO21",
pin33: "IOVDD3",
pin34: "GPIO22",
pin35: "GPIO23",
pin36: "GPIO24",
pin37: "GPIO25",
pin38: "GPIO26_ADC0",
pin39: "GPIO27_ADC1",
pin40: "GPIO28_ADC2",
pin41: "GPIO29_ADC3",
pin42: "IOVDD2",
pin43: "ADC_AVDD",
pin44: "VREG_IN",
pin45: "VREG_VOUT",
pin46: "USB_DM",
pin47: "USB_DP",
pin48: "USB_VDD",
pin49: "IOVDD1",
pin50: "DVDD1",
pin51: "QSPI_SD3",
pin52: "QSPI_SCLK",
pin53: "QSPI_SD0",
pin54: "QSPI_SD2",
pin55: "QSPI_SD1",
pin56: "QSPI_SS",
pin57: "GND",
} as const
const RP2040 = (props: ChipProps<typeof rp2040PinLabels>) => (
<chip
{...props}
pinLabels={rp2040PinLabels}
manufacturerPartNumber="RP2040"
footprint="qfn56_thermalpad3.1mmx3.1mm_p0.4001mm_w7.8999mm_h7.9001mm_pw0.2mm_pl0.85mm"
pinAttributes={{
IOVDD1: { requiresPower: true, mustBeConnected: true },
IOVDD2: { requiresPower: true, mustBeConnected: true },
IOVDD3: { requiresPower: true, mustBeConnected: true },
IOVDD4: { requiresPower: true, mustBeConnected: true },
IOVDD5: { requiresPower: true, mustBeConnected: true },
IOVDD6: { requiresPower: true, mustBeConnected: true },
DVDD1: { requiresPower: true, mustBeConnected: true },
DVDD2: { requiresPower: true, mustBeConnected: true },
VREG_IN: { requiresPower: true, mustBeConnected: true },
VREG_VOUT: { providesPower: true, mustBeConnected: true },
USB_VDD: { requiresPower: true, mustBeConnected: true },
ADC_AVDD: { requiresPower: true, mustBeConnected: true },
GND: { requiresGround: true, mustBeConnected: true },
RUN: { mustBeConnected: true },
XIN: { mustBeConnected: true },
XOUT: { mustBeConnected: true },
QSPI_SS: { mustBeConnected: true },
QSPI_SCLK: { mustBeConnected: true },
QSPI_SD0: { mustBeConnected: true },
QSPI_SD1: { mustBeConnected: true },
QSPI_SD2: { mustBeConnected: true },
QSPI_SD3: { mustBeConnected: true },
}}
/>
)
const COLS = [-48.5, -29.45, -10.4, 8.65, 27.7]
const ROW_BASE = [22, 2.95, -16.1]
const STAGGER = [-2, 0, 2, 1, -2]
type KeyDef = {
id: string
x: number
y: number
row: number
col: number
}
const gridKeys: KeyDef[] = ROW_BASE.flatMap((ry, r) =>
COLS.map((cx, c) => ({
id: `R${r}C${c}`,
x: cx,
y: ry + STAGGER[c],
row: r,
col: c,
})),
)
const thumbKeys: KeyDef[] = [
{ id: "T0", x: -8, y: -33, row: 3, col: 2 },
{ id: "T1", x: 10, y: -33, row: 3, col: 3 },
{ id: "T2", x: 28, y: -33, row: 3, col: 4 },
]
const keys: KeyDef[] = [...gridKeys, ...thumbKeys]
const keySchematic = (i: number) => ({
schX: -11.25 + (i % 6) * 4.5,
schY: 6 - Math.floor(i / 6) * 6,
})
const schFix: Record<string, { sx?: number; sy?: number; dx?: number; dy?: number }> = {
R2C2: { sx: 0.21, sy: -7.58, dx: 1.09, dy: -10.2 },
R2C3: { sx: -2.1, sy: -11.99 },
T0: { sx: 1.33, sy: -12.41, dx: -0.24, dy: -12.57 },
T1: { sx: 1.33, sy: -11.87 },
}
const decouplingX = [-7, -4.6, -2.2, 0.2, 2.6, 5, 7.4, 9.8, 12.2, 14.6, 17]
export default () => (
<board width="120mm" height="95mm" layers={2} title="Split Keyboard Left Half" schAutoLayoutEnabled={false} routeRemaining={true}>
<schematicsheet name="matrix" displayName="Key Matrix" sheetIndex={0} />
<schematicsheet name="mcu" displayName="RP2040, Clock, Flash" sheetIndex={1} />
<schematicsheet name="power" displayName="USB-C, Power, TRRS" sheetIndex={2} />
<schematicsection name="keymatrix" displayName="Key matrix" />
<schematicsection name="mcu_power" displayName="RP2040 supply" />
<schematicsection name="clock" displayName="12 MHz crystal" />
<schematicsection name="qspi" displayName="QSPI flash" />
<schematicsection name="reset" displayName="Reset and boot" />
<schematicsection name="usbc" displayName="USB-C" />
<schematicsection name="ldo" displayName="3.3 V LDO" />
<schematicsection name="trrs" displayName="TRRS split link" />
<net name="GND" isGroundNet nominalTraceWidth={0.4} />
<net name="V3_3" isPowerNet nominalTraceWidth={0.5} />
<net name="VBUS" isPowerNet nominalTraceWidth={0.5} />
<net name="V1_1" isPowerNet nominalTraceWidth={0.4} />
<net name="USB_DP" />
<net name="USB_DM" />
<net name="USB_DP_C" />
<net name="USB_DM_C" />
<net name="XIN" />
<net name="XOUT" />
<net name="XOUT_XTAL" />
<net name="QSPI_SS" />
<net name="QSPI_SCLK" />
<net name="QSPI_SD0" />
<net name="QSPI_SD1" />
<net name="QSPI_SD2" />
<net name="QSPI_SD3" />
<net name="RUN" />
<net name="BOOTSEL" />
<net name="SERIAL" />
<net name="COL0" />
<net name="COL1" />
<net name="COL2" />
<net name="COL3" />
<net name="COL4" />
<net name="ROW0" />
<net name="ROW1" />
<net name="ROW2" />
<net name="ROW3" />
{keys.map((k, i) => {
const s = keySchematic(i)
const f = schFix[k.id] ?? {}
return (
<React.Fragment key={k.id}>
<CPG151101S11
name={`SW_${k.id}`}
pcbX={k.x}
pcbY={k.y}
schSheetName="matrix"
schSectionName="keymatrix"
schX={f.sx ?? s.schX}
schY={f.sy ?? s.schY + 1}
/>
<diode
name={`D_${k.id}`}
manufacturerPartNumber="1N4148W"
footprint="sod123"
pcbX={k.x}
pcbY={k.y - 8.7}
pcbRotation={180}
schSheetName="matrix"
schSectionName="keymatrix"
schX={f.dx ?? s.schX}
schY={f.dy ?? s.schY - 1.5}
schRotation={90}
/>
</React.Fragment>
)
})}
{keys.map((k) => (
<React.Fragment key={`w_${k.id}`}>
<trace from={`SW_${k.id}.pin1`} to={`net.COL${k.col}`} />
<trace from={`SW_${k.id}.pin2`} to={`D_${k.id}.anode`} />
<trace from={`D_${k.id}.cathode`} to={`net.ROW${k.row}`} />
</React.Fragment>
))}
<hole name="MH1" diameter="2.2mm" pcbX={-38.975} pcbY={-7.575} />
<hole name="MH2" diameter="2.2mm" pcbX={-19.925} pcbY={-5.575} />
<hole name="MH3" diameter="2.2mm" pcbX={0.875} pcbY={-5.075} />
<hole name="MH4" diameter="2.2mm" pcbX={18.175} pcbY={-7.075} />
<RP2040
name="U1"
pcbX={-13}
pcbY={40.5}
schSheetName="mcu"
schSectionName="mcu_power"
schX={-4}
schY={2}
noConnect={[
"GPIO10",
"GPIO11",
"GPIO12",
"GPIO13",
"GPIO14",
"GPIO15",
"GPIO16",
"GPIO17",
"GPIO18",
"GPIO19",
"GPIO20",
"GPIO21",
"GPIO22",
"GPIO23",
"GPIO24",
"GPIO25",
"GPIO26_ADC0",
"GPIO27_ADC1",
"GPIO28_ADC2",
"GPIO29_ADC3",
"SWCLK",
"SWD",
]}
/>
<connector
name="J1"
standard="usb_c"
allowOffBoard
pcbX={-46}
pcbY={42.575}
pcbRotation={180}
schSheetName="power"
schSectionName="usbc"
schX={-10}
schY={4}
noConnect={["SBU1", "SBU2"]}
schWidth={1.575}
/>
<resistor
name="R1"
resistance="5.1k"
footprint="0402"
pcbX={-40.04}
pcbY={41.6}
pcbRotation={270}
schSheetName="power"
schSectionName="usbc"
schX={-6.5}
schY={2}
schRotation={270}
/>
<resistor
name="R2"
resistance="5.1k"
footprint="0402"
pcbX={-40.04}
pcbY={39.2}
pcbRotation={90}
schSheetName="power"
schSectionName="usbc"
schX={-6.17}
schY={0.2}
schRotation={270}
/>
<resistor
name="R3"
resistance="27"
footprint="0402"
pcbX={-22}
pcbY={46}
schSheetName="power"
schSectionName="usbc"
schX={-2.5}
schY={-1.2}
/>
<resistor
name="R4"
resistance="27"
footprint="0402"
pcbX={-24.5}
pcbY={46}
schSheetName="power"
schSectionName="usbc"
schX={-2.5}
schY={-2.8}
/>
<chip
name="U3"
manufacturerPartNumber="AP2112K-3.3TRG1"
footprint="sot23_5"
pinLabels={{ pin1: "VIN", pin2: "GND", pin3: "EN", pin4: "NC", pin5: "VOUT" }}
pinAttributes={{ VIN: { requiresPower: true }, VOUT: { providesPower: true } }}
noConnect={["NC"]}
pcbX={-36.5}
pcbY={44}
schSheetName="power"
schSectionName="ldo"
schX={-3}
schY={6}
/>
<capacitor name="C1" capacitance="10uF" footprint="0805" pcbX={-31.8} pcbY={44.3} pcbRotation={90} schSheetName="power" schSectionName="ldo" schX={-0.5} schY={7.2} schRotation={270} />
<capacitor name="C2" capacitance="100nF" footprint="0402" pcbX={-29.4} pcbY={44.3} pcbRotation={90} schSheetName="power" schSectionName="ldo" schX={0.9} schY={7.2} schRotation={270} />
<capacitor name="C3" capacitance="10uF" footprint="0805" pcbX={-26.8} pcbY={44.3} pcbRotation={90} schSheetName="power" schSectionName="ldo" schX={2.6} schY={7.2} schRotation={270} />
<capacitor name="C4" capacitance="100nF" footprint="0402" pcbX={-24.4} pcbY={44.3} pcbRotation={90} schSheetName="power" schSectionName="ldo" schX={4.0} schY={7.2} schRotation={270} />
<HC_PJ_320A_4P_D
name="J2"
pcbX={51.2}
pcbY={-8}
pcbRotation={180}
schSheetName="power"
schSectionName="trrs"
schX={8}
schY={-2}
/>
<crystal
name="X1"
frequency="12MHz"
loadCapacitance="15pF"
pinVariant="four_pin"
footprint="crystal4_px3.2mm_py2.5mm"
pcbX={-13.4}
pcbY={30.6}
pcbRotation={270}
schSheetName="mcu"
schSectionName="clock"
schX={3}
schY={-4}
/>
<capacitor name="C19" capacitance="15pF" footprint="0402" pcbX={-17.8} pcbY={31.0} pcbRotation={270} schSheetName="mcu" schSectionName="clock" schX={0.5} schY={-5} schRotation={270} />
<capacitor name="C20" capacitance="15pF" footprint="0402" pcbX={-7.5} pcbY={31.0} pcbRotation={270} schSheetName="mcu" schSectionName="clock" schX={5.5} schY={-5} schRotation={270} />
<resistor name="R7" resistance="1k" footprint="0402" pcbX={-10.1} pcbY={31.0} pcbRotation={90} schSheetName="mcu" schSectionName="clock" schX={6.5} schY={-4} />
<chip
name="U2"
manufacturerPartNumber="W25Q128JVSIQ"
footprint="soic8_p1.27mm"
pinLabels={{ pin1: "CS", pin2: "DO", pin3: "WP", pin4: "GND", pin5: "DI", pin6: "CLK", pin7: "HOLD", pin8: "VCC" }}
pinAttributes={{ VCC: { requiresPower: true }, GND: { requiresGround: true } }}
pcbX={7.8}
pcbY={42.5}
schSheetName="mcu"
schSectionName="qspi"
schX={8}
schY={4}
/>
<capacitor name="C18" capacitance="100nF" footprint="0402" pcbX={12.8} pcbY={42.5} pcbRotation={270} schSheetName="mcu" schSectionName="qspi" schX={10.8} schY={4} schRotation={270} />
<pushbutton name="SW2" footprint="smdpushbutton" pcbX={15} pcbY={37.5} schSheetName="mcu" schSectionName="reset" schX={-11} schY={5} />
<resistor name="R8" resistance="10k" footprint="0402" pcbX={10.8} pcbY={37.5} schSheetName="mcu" schSectionName="reset" schX={-14} schY={5} schRotation={270} />
<pushbutton name="SW1" footprint="smdpushbutton" pcbX={21} pcbY={37.5} schSheetName="mcu" schSectionName="reset" schX={-11} schY={2} />
<resistor name="R9" resistance="1k" footprint="0402" pcbX={25.7} pcbY={37.5} schSheetName="mcu" schSectionName="reset" schX={-14} schY={2} schRotation={270} />
{["100nF", "100nF", "100nF", "100nF", "100nF", "100nF", "100nF", "100nF", "1uF", "100nF", "100nF"].map(
(value, i) => (
<capacitor
key={i}
name={`C${i + 5}`}
capacitance={value}
footprint={value === "1uF" ? "0603" : "0402"}
pcbX={decouplingX[i]}
pcbY={i === 8 ? 34.2 : 34.6}
pcbRotation={90}
schSheetName="mcu"
schSectionName="mcu_power"
schX={-12 + i * 2.4}
schY={-2.6}
schRotation={270}
/>
),
)}
<trace from="J1.VBUS1" to="net.VBUS" />
<trace from="J1.VBUS2" to="net.VBUS" />
<trace from="J1.GND1" to="net.GND" />
<trace from="J1.GND2" to="net.GND" />
<trace from="J1.SHELL1" to="net.GND" />
<trace from="J1.SHELL2" to="net.GND" />
<trace from="J1.CC1" to="R1.pin1" />
<trace from="R1.pin2" to="net.GND" />
<trace from="J1.CC2" to="R2.pin1" />
<trace from="R2.pin2" to="net.GND" />
<trace from="J1.DP1" to="net.USB_DP_C" />
<trace from="J1.DP2" to="net.USB_DP_C" />
<trace from="J1.DM1" to="net.USB_DM_C" />
<trace from="J1.DM2" to="net.USB_DM_C" />
<trace from="net.USB_DP_C" to="R3.pin1" />
<trace from="R3.pin2" to="net.USB_DP" />
<trace from="net.USB_DM_C" to="R4.pin1" />
<trace from="R4.pin2" to="net.USB_DM" />
<trace from="net.USB_DP" to="U1.USB_DP" />
<trace from="net.USB_DM" to="U1.USB_DM" />
<trace from="net.VBUS" to="C1.pin1" />
<trace from="C1.pin2" to="net.GND" />
<trace from="net.VBUS" to="C2.pin1" />
<trace from="C2.pin2" to="net.GND" />
<trace from="net.VBUS" to="U3.VIN" />
<trace from="U3.EN" to="net.VBUS" />
<trace from="U3.GND" to="net.GND" />
<trace from="U3.VOUT" to="net.V3_3" />
<trace from="net.V3_3" to="C3.pin1" />
<trace from="C3.pin2" to="net.GND" />
<trace from="net.V3_3" to="C4.pin1" />
<trace from="C4.pin2" to="net.GND" />
<trace from="U1.IOVDD1" to="net.V3_3" />
<trace from="U1.IOVDD2" to="net.V3_3" />
<trace from="U1.IOVDD3" to="net.V3_3" />
<trace from="U1.IOVDD4" to="net.V3_3" />
<trace from="U1.IOVDD5" to="net.V3_3" />
<trace from="U1.IOVDD6" to="net.V3_3" />
<trace from="U1.VREG_IN" to="net.V3_3" />
<trace from="U1.USB_VDD" to="net.V3_3" />
<trace from="U1.ADC_AVDD" to="net.V3_3" />
<trace from="U1.GND" to="net.GND" />
<trace from="U1.TESTEN" to="net.GND" />
<trace from="U1.VREG_VOUT" to="net.V1_1" />
<trace from="U1.DVDD1" to="net.V1_1" />
<trace from="U1.DVDD2" to="net.V1_1" />
<trace from="U1.XIN" to="net.XIN" />
<trace from="net.XIN" to="X1.pin1" />
<trace from="X1.pin2" to="net.GND" />
<trace from="X1.pin4" to="net.GND" />
<trace from="U1.XOUT" to="net.XOUT" />
<trace from="net.XOUT" to="R7.pin1" />
<trace from="R7.pin2" to="net.XOUT_XTAL" />
<trace from="net.XOUT_XTAL" to="X1.pin3" />
<trace from="net.XIN" to="C19.pin1" />
<trace from="C19.pin2" to="net.GND" />
<trace from="net.XOUT_XTAL" to="C20.pin1" />
<trace from="C20.pin2" to="net.GND" />
<trace from="net.V3_3" to="R8.pin1" />
<trace from="R8.pin2" to="net.RUN" />
<trace from="net.RUN" to="U1.RUN" />
<trace from="net.RUN" to="SW2.pin1" />
<trace from="SW2.pin2" to="net.GND" />
<trace from="SW2.pin3" to="net.RUN" />
<trace from="SW2.pin4" to="net.GND" />
<trace from="net.QSPI_SS" to="U1.QSPI_SS" />
<trace from="net.QSPI_SCLK" to="U1.QSPI_SCLK" />
<trace from="net.QSPI_SD0" to="U1.QSPI_SD0" />
<trace from="net.QSPI_SD1" to="U1.QSPI_SD1" />
<trace from="net.QSPI_SD2" to="U1.QSPI_SD2" />
<trace from="net.QSPI_SD3" to="U1.QSPI_SD3" />
<trace from="net.QSPI_SS" to="U2.CS" />
<trace from="net.QSPI_SCLK" to="U2.CLK" />
<trace from="net.QSPI_SD0" to="U2.DI" />
<trace from="net.QSPI_SD1" to="U2.DO" />
<trace from="net.QSPI_SD2" to="U2.WP" />
<trace from="net.QSPI_SD3" to="U2.HOLD" />
<trace from="net.V3_3" to="U2.VCC" />
<trace from="U2.GND" to="net.GND" />
<trace from="net.V3_3" to="C18.pin1" />
<trace from="C18.pin2" to="net.GND" />
<trace from="net.QSPI_SS" to="R9.pin1" />
<trace from="R9.pin2" to="net.BOOTSEL" />
<trace from="net.BOOTSEL" to="SW1.pin1" />
<trace from="SW1.pin2" to="net.GND" />
<trace from="SW1.pin3" to="net.BOOTSEL" />
<trace from="SW1.pin4" to="net.GND" />
<trace from="U1.GPIO0" to="net.ROW0" />
<trace from="U1.GPIO1" to="net.ROW1" />
<trace from="U1.GPIO2" to="net.ROW2" />
<trace from="U1.GPIO3" to="net.ROW3" />
<trace from="U1.GPIO4" to="net.COL0" />
<trace from="U1.GPIO5" to="net.COL1" />
<trace from="U1.GPIO6" to="net.COL2" />
<trace from="U1.GPIO7" to="net.COL3" />
<trace from="U1.GPIO8" to="net.COL4" />
<trace from="U1.GPIO9" to="net.SERIAL" />
<trace from="J2.pin1" to="net.SERIAL" />
<trace from="J2.pin2" to="net.V3_3" />
<trace from="J2.pin3" to="net.GND" />
<trace from="J2.pin4" to="net.GND" />
</board>
)