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.

enclosure/enclosure.circuit.tsx

import { assembly } from "tscircuit"
import { jscad } from "jscad-fiber/headless"
import { Base, Lid, StopCap } from "./parts"

/** Part lift (mm, +Z) for the service explosion. */
export const explodedLift = { base: 0, lid: 60, cap: 90 }

/** Printed parts at their fitted positions, in the board's own 3D frame (board top at z = 0.8). */
export function EnclosureParts() {
  return <>
    <assembly.printedpart name="CASE_BASE" displayName="Case base" material="petg" jscad={<jscad.colorize color="#c9cbc4"><Base /></jscad.colorize>} />
    <assembly.printedpart name="CASE_LID" displayName="Case lid" material="petg" jscad={<jscad.colorize color="#cfd1ca"><Lid /></jscad.colorize>} />
    <assembly.printedpart name="STOP_CAP" displayName="Stop button cap" material="petg" jscad={<jscad.colorize color="#c8261d"><StopCap /></jscad.colorize>} />
  </>
}

/**
 * Service explosion, in removal order: pull the stop cap off the switch post, then undo the four
 * M2 screws from under the base and lift the lid (the screws are not modelled).
 */
export function EnclosureExplosion() {
  const L = explodedLift
  return <>
    <assembly.explosion.stage name="remove_stop_cap" nextStageRef="lift_lid">
      <assembly.explosion.move targetRef="STOP_CAP" offZ={L.cap} />
    </assembly.explosion.stage>
    <assembly.explosion.stage name="lift_lid" prevStageRef="remove_stop_cap">
      <assembly.explosion.move targetRef="CASE_LID" offZ={L.lid} />
    </assembly.explosion.stage>
  </>
}

export function EnclosureAssembly() {
  return <assembly.subassembly name="ENCLOSURE" displayName="Printed enclosure">
    <EnclosureParts />
    <EnclosureExplosion />
  </assembly.subassembly>
}

export default function Enclosure() {
  return <assembly.device name="PD_HUB_ENCLOSURE"><EnclosureAssembly /></assembly.device>
}