MustafaMulla29/rp2040-bldc-motor-controller

Hardware assembly metadata and PCB geometry for a controller board with a snap-off rotary-encoder section, plus four parallel 150 µF/50 V bulk electrolytic capacitors filtering the motor supply.

Version
2.0.40
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone MustafaMulla29/rp2040-bldc-motor-controller  # download the package files into ./rp2040-bldc-motor-controller
tsci add MustafaMulla29/rp2040-bldc-motor-controller    # add it to your project as @tsci/MustafaMulla29.rp2040-bldc-motor-controller

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.

scripts/pcb-audit/geometry.py

import os
from pathlib import Path
import shapely
from shapely.geometry import Point,LineString,Polygon,box
BASE=Path(os.environ.get("PCB_AUDIT_OUTPUT",Path(__file__).resolve().parents[2]/"assembly/dist/results"))
BASE.mkdir(parents=True,exist_ok=True)
LAYERS=["top","inner1","inner2","bottom"]
xy=lambda q:(q["x"],q["y"])
def padshape(p):
 x,y=p.get('x',0),p.get('y',0);kind=p['shape']
 if kind=='polygon':return Polygon([xy(q) for q in p['points']])
 if kind=='circle':return Point(x,y).buffer(p.get('outer_diameter',p.get('radius',0)*2)/2,quad_segs=32)
 w,h=p.get('outer_width',p.get('width')),p.get('outer_height',p.get('height'))
 if kind in ['pill','rotated_pill']:
  r=min(w,h)/2;g=LineString([(x-max(0,w-h)/2,y-max(0,h-w)/2),(x+max(0,w-h)/2,y+max(0,h-w)/2)]).buffer(r,quad_segs=32)
  return shapely.affinity.rotate(g,p.get('rect_ccw_rotation',p.get('ccw_rotation',0)),origin=(x,y))
 return shapely.affinity.rotate(box(x-w/2,y-h/2,x+w/2,y+h/2),p.get('rect_ccw_rotation',p.get('ccw_rotation',0)),origin=(x,y))