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-motherboardIn 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.
lib/common.tsx
import type { ReactNode } from "react"
import { schematicPlacement } from "./schematic-placement"
type At = { x?: number; y?: number; r?: number }
type Two = { name: string; a: string; b: string; fp?: string; at?: At; sch?: { x: number; y: number; r?: number } }
/**
* JLC parts pinned by value (0402, 1 %), because the part picked automatically for these values was nearly out of
* stock on 2026-12-02 (docs/bom-stock-cost-2026-12-02.md): 150k had 5, 180k had 6, 120k had 17, and the 0.1 %
* 40.2k / 59k parts had under 1000. Each pinned part had over 100,000 in stock. 1 % is enough at every use:
* supply feedback dividers, the CH224Q voltage-select resistor, OVLO dividers and the TPS55288 current-limit resistor.
*/
const JLC_RESISTOR_0402: Record<string, string> = { "150k": "C25755", "180k": "C25760", "120k": "C2909314", "40.2k": "C25893", "59k": "C32297",
// 4.7M (hub crystal, RHUBX): the automatic pick, C2773926, has no footprint in JLCPCB's library, so its placement
// could not be checked; C3013173 has one and 150,000 in stock (2026-12-02).
"4.7M": "C3013173" }
/** Resistor with explicit pin1/pin2 nets. Values follow datasheet calculations noted at the call site. */
/** `dnp`: keep the pads/copper but do not fit the part (doNotPlace: left out of BOM / pick-and-place). */
export const R = ({ name, v, a, b, fp = "0402", at, sch, dnp }: Two & { v: string; dnp?: boolean }) => (
<resistor name={name} resistance={v} footprint={fp} doNotPlace={dnp}
supplierPartNumbers={fp === "0402" && JLC_RESISTOR_0402[v] ? { jlcpcb: [JLC_RESISTOR_0402[v]] } : undefined}
pcbX={at?.x} pcbY={at?.y} pcbRotation={at?.r}
schX={sch?.x ?? schematicPlacement(name).schX} schY={sch?.y ?? schematicPlacement(name).schY} schRotation={sch?.r ?? schematicPlacement(name).schRotation}
connections={{ pin1: a, pin2: b }} />
)
/** Capacitor with explicit pin1/pin2 nets; voltage ratings are given by `rating`. */
export const C = ({ name, v, a, b = "net.GND", fp = "0402", rating, at, sch }: Omit<Two, "b"> & { v: string; b?: string; rating?: string }) => (
<capacitor name={name} capacitance={v} footprint={fp} maxVoltageRating={rating}
pcbX={at?.x} pcbY={at?.y} pcbRotation={at?.r}
schX={sch?.x ?? schematicPlacement(name).schX} schY={sch?.y ?? schematicPlacement(name).schY} schRotation={sch?.r ?? schematicPlacement(name).schRotation}
connections={{ pin1: a, pin2: b }} />
)
export const n = (name: string) => `net.${name}`
export const Frag = ({ children }: { children: ReactNode }) => <>{children}</>