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.
tools/layerzoom.ts
// keep only top-layer copper + pads + vias in region; render png
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg"
import { Resvg } from "@resvg/resvg-js"
import { readFileSync, writeFileSync } from "node:fs"
const [x0,y0,x1,y1] = process.argv.slice(2,6).map(Number); const out=process.argv[6]; const layer=process.argv[7]??"top"
const cj = JSON.parse(readFileSync(process.env.CJ ?? "dist/index/circuit.json","utf8"))
const ins=(x:number,y:number)=>x>=x0-2&&x<=x1+2&&y>=y0-2&&y<=y1+2
const keep=cj.filter((e:any)=>{
if(e.type==="pcb_trace"){ const r=e.route.filter((p:any)=>p.route_type==="wire"&&p.layer===layer&&ins(p.x,p.y)); if(r.length<2)return false; e.route=r; return true}
if(e.type==="pcb_smtpad") return e.layer===layer&&ins(e.x,e.y)
if(e.type==="pcb_via"||e.type==="pcb_plated_hole") return ins(e.x,e.y)
if(e.type==="pcb_silkscreen_text") return ins(e.anchor_position.x,e.anchor_position.y)
return false})
keep.push({type:"pcb_board",pcb_board_id:"z",center:{x:(x0+x1)/2,y:(y0+y1)/2},width:x1-x0,height:y1-y0,thickness:1.6,num_layers:6,material:"fr4"})
const svg=convertCircuitJsonToPcbSvg(keep,{width:1600,height:Math.round(1600*(y1-y0)/(x1-x0))} as any)
writeFileSync(out,new Resvg(svg).render().asPng())