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.

enclosure/uv-artwork.ts

import { body, buttons, component, design, motorPorts, pinholeRefs } from "./dimensions"

// UV-only graphic layout. Coordinates use the board's top-view axes; y is the
// text baseline. Physical controls and the earlier sticker fallback are unchanged.
export type UvLabel = {
  text: string; x: number; y: number; height: number; tracking: number; center?: boolean; centerY?: number
}
export const encoderPortY = component("J20").center.y
if (Math.abs(encoderPortY - design.encoder.y) > .01) throw Error("Recheck ENCODER label: J20 and enclosure opening no longer align")
export const uvLabels: UvLabel[] = [
  { text: "SPEED", x: design.knob.x, y: 62, height: 2.5, tracking: .25, center: true },
  { text: "OFF", x: -61.3, y: 40.8, height: 1.9, tracking: .08, center: true },
  { text: "ON", x: -61.3, y: 30.5, height: 1.9, tracking: .08, center: true },
  // Capped buttons carry the main labels. RESET and BOOT are pinholes: smaller lettering, close above each hole.
  ...buttons.map(b => pinholeRefs.includes(b.ref)
    ? { text: b.label, x: b.x, y: 30.6, height: 1.6, tracking: .1, center: true }
    : { text: b.label, x: b.x, y: 33.6, height: 2.1, tracking: .12, center: true }),
  { text: "ENCODER", x: body.x + body.width / 2 - 10.7, y: encoderPortY, centerY: encoderPortY, height: 1.7, tracking: .12, center: true },
  { text: "BLDC", x: body.x, y: -5, height: 11, tracking: .65, center: true },
  { text: "MOTOR CONTROLLER", x: body.x, y: -10.3, height: 1.9, tracking: .35, center: true },
  { text: "RP2040", x: body.x, y: -15, height: 1.7, tracking: .25, center: true },
  ...motorPorts.map((p, i) => ({ text: ["U", "V", "W"][i], x: p.x, y: 67, height: 1.8, tracking: .12, center: true })),
  { text: "PWR", x: -59.5, y: -3, height: 2, tracking: .15 },
  { text: "DATA", x: -59.5, y: -16, height: 2, tracking: .15 },
]

export function uvGraphics(x0: number, y1: number): { name: string; path: string }[] {
  const x = -61.3 - x0, y = y1 - design.power.y
  const p = (r: number, angle: number) => [x + r * Math.sin(angle), y - r * Math.cos(angle)].map(n => n.toFixed(4)).join(" ")
  // Filled outline, not a font glyph: 270-degree ring and a rounded power stem.
  const a = Math.PI / 4, r = 1.55, inner = 1.18, w = .185
  const ring = `M${p(r, a)} A${r} ${r} 0 1 1 ${p(r, -a)} L${p(inner, -a)} A${inner} ${inner} 0 1 0 ${p(inner, a)} Z`
  const stem = `M${x-w} ${y-1.85} Q${x} ${y-2.035} ${x+w} ${y-1.85} L${x+w} ${y-.05} Q${x} ${y+.135} ${x-w} ${y-.05} Z`
  const tip = body.width - 1.5, cy = y1 - encoderPortY
  const portArrow = `M${tip-2.2} ${cy-.15} H${tip-.8} V${cy-.65} L${tip} ${cy} L${tip-.8} ${cy+.65} V${cy+.15} H${tip-2.2} Z`
  return [{ name: "power icon", path: `${ring} ${stem}` },
    { name: "encoder port direction arrow", path: portArrow }]
}