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/port-positions.ts

/**
 * 90 x 98 mm board: all motor connectors in one column on the right edge (power/data pitch 11.6/10.4 mm).
 *
 * Ports are numbered from the BOTTOM of that edge upward: port 1 is the lowest, port 4 the highest
 * (renumbered 2026-11-30; before, port 1 was at the top). Reason: laid out on one layer without crossing,
 * the USB hub's downstream pairs reach the connectors bottom-first.
 * Since 2026-12-02 the hub is a CH338F, whose pins go round the chip in the order 1, 2, 5, 4, 3: USB 1, 2 and 4
 * are hub ports 1, 2 and 4, "USB 3" is hub port 5 and "CAM" is hub port 3 (HUB_PORT_OF in circuit/usb.tsx).
 * Linux names the ports from that table.
 */
export const PORT_X = -7
/** Centre Y of each port's power stage. */
export const PORT_Y: Record<number, number> = { 1: -27.8, 2: -5.8, 3: 16.2, 4: 38.2 }
/** Y of each port's DATA connector (directly below its power connector). */
export const DATA_Y: Record<number, number> = { 1: -38.8, 2: -16.8, 3: 5.2, 4: 27.2 }
/** Supervisor A (left of the board) runs the two upper ports, supervisor B (bottom) the two lower ones. */
export const supervisorOf = (i: number): "A" | "B" => (i >= 3 ? "A" : "B")