MustafaMulla29/usb-pd-motherboard

4-layer USB-C PD hub motherboard with 20 V USB-C input, Linux T113-S3 computer, CH338F USB hub, four individually controlled 5–20 V PD outputs, USB data/camera ports, regulated rails, and hardware watchdog/E-stop safety interlock.

Version
1.0.24
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/usb-pd-motherboard  # download the package files into ./usb-pd-motherboard
tsci add MustafaMulla29/usb-pd-motherboard    # add it to your project as @tsci/MustafaMulla29.usb-pd-motherboard

In 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.

circuit/planes.tsx

/**
 * 4-layer stack (2026-11-30, was 6):
 *   L1 top     parts, signals, local power pours
 *   L2 inner1  GND plane, solid
 *   L3 inner2  power: VIN_SYS and V5V0, side by side
 *   L4 bottom  signals, GND pour in the gaps
 *
 * Why inner2 is split: two rails share the one power layer, and each gets the area under its own loads.
 *   VIN_SYS (5 A input current): behind the PD input (top left) plus a strip x 0..18.5 down the board. That
 *     strip is where every motor stage takes VIN (input caps and high-side FET at x 0..5, controller VIN pin
 *     at x 14..16). Nothing right of x 18.5 uses VIN_SYS.
 *   V5V0 (up to 4 A, docs/power-budget.md): the left half (SoC supplies, 5 V buck output, camera port) and the
 *     right column x >= 19.5 (the four motor DATA ports), joined below motor stage 4 (y < -36).
 * The split is a layer-saving choice, not an electrical requirement: one more layer would let each rail have
 * a full plane. The outlines do not overlap (1 mm gap) and nothing has to cross the gap on this layer.
 * VDD / V3V3 (<= 1 A) are routed as traces. Pour clearance 0.253 mm (see POUR_CLEARANCE).
 * Outlines live in data/planes.json because the router (tools/router/) needs them too.
 */
import planes from "../data/planes.json"
/**
 * 0.253, not 0.25: traces sit on a 0.05 mm grid, so with a 0.25 mm clearance pour corners land exactly in line
 * with the edges of other traces. tscircuit's pour-short check then misreads a far-away pour corner as inside
 * the trace (a point-in-polygon edge case) and reports a short that is not there. 3 um off the grid avoids it.
 */
export const POUR_CLEARANCE = 0.253
const outline = (name: keyof typeof planes) => planes[name].outline.map(([x, y]) => ({ x, y }))
export const Planes = () => (
  <>
    <copperpour name="PLANE_GND_L2" connectsTo="net.GND" layer="inner1" outline={outline("GND")} clearance={POUR_CLEARANCE} unbroken />
    <copperpour name="POUR_GND_L4" connectsTo="net.GND" layer="bottom" outline={outline("GND")} clearance={POUR_CLEARANCE} unbroken />
    <copperpour name="PLANE_VIN_SYS" connectsTo="net.VIN_SYS" layer="inner2" clearance={POUR_CLEARANCE} unbroken outline={outline("VIN_SYS")} />
    <copperpour name="PLANE_V5V0" connectsTo="net.V5V0" layer="inner2" clearance={POUR_CLEARANCE} unbroken outline={outline("V5V0")} />
  </>
)