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.

tools/bbox.py

"""Print pad + courtyard extents (relative to component center) for named components."""
import json,sys
d=json.load(open(sys.argv[1])); names=set(sys.argv[2:])
src={e['source_component_id']:e['name'] for e in d if e['type']=='source_component'}
pc={e['pcb_component_id']:(src.get(e['source_component_id']),e) for e in d if e['type']=='pcb_component'}
ext={}
for e in d:
    if e['type'] in('pcb_smtpad','pcb_plated_hole') and e.get('pcb_component_id') in pc:
        nm,c=pc[e['pcb_component_id']]
        if nm not in names: continue
        w=e.get('width',e.get('outer_diameter',e.get('outer_width',0))) or 0; h=e.get('height',e.get('outer_diameter',e.get('outer_height',0))) or 0
        if e.get('shape')=='polygon': continue
        r=ext.setdefault(nm,[1e9,-1e9,1e9,-1e9,c['center']])
        r[0]=min(r[0],e['x']-w/2);r[1]=max(r[1],e['x']+w/2);r[2]=min(r[2],e['y']-h/2);r[3]=max(r[3],e['y']+h/2)
    if e['type']=='pcb_courtyard_outline' and e.get('pcb_component_id') in pc:
        nm,c=pc[e['pcb_component_id']]
        if nm in names:
            xs=[p['x'] for p in e['outline']]; ys=[p['y'] for p in e['outline']]
            print(nm,'courtyard x',round(min(xs)-c['center']['x'],2),round(max(xs)-c['center']['x'],2),'y',round(min(ys)-c['center']['y'],2),round(max(ys)-c['center']['y'],2))
for nm,(x0,x1,y0,y1,c) in ext.items():
    print(nm,'pads x',round(x0-c['x'],2),round(x1-c['x'],2),'y',round(y0-c['y'],2),round(y1-c['y'],2),'rot',[e['rotation'] for _,e in [pc[k] for k in pc] if _==nm][:1])