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.

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import "./scripts/source-render-cache"
import { EncoderInterface } from "./circuit/encoder"
import { RearmInterlock } from "./circuit/rearm-interlock"
import { UserInterface } from "./circuit/user-interface"
import { CriticalRouting } from "./circuit/critical-routing"
import kelvinPours from "./circuit/kelvin-pour-outlines.json"
import { PowerSwitch } from "./circuit/power-switch"
import { AssemblyReferences } from "./circuit/assembly-references"
import { savedRouting } from "./circuit/saved-routing"
import { UsbPd, LogicPower } from "./circuit/power"
import { SeparateUsb } from "./circuit/usb-ports"
import { PdLoad } from "./circuit/pd-load"
import { Processor } from "./circuit/processor"
import { MotorControl, MotorBridge } from "./circuit/motor"
import type { BoardProps } from "@tscircuit/props"
import { Fragment } from "react"
import { RoutingPlan } from "./circuit/routing-plan"
import { SchematicNotes } from "./circuit/schematic-notes"
import { BoardSystemDiagrams } from "./circuit/system-diagram"

/** Configurable 5/9/15/20 V USB-PD motor supply, no battery, RP2040 USB data.
 * Saved routing is tied to the exact pad, net and rule input.
 * Engineering prototype; power integrity and fault behaviour need bench validation.
 */
export default function PicoPdMotorLab({ routingAlgorithm = savedRouting, includeSystemDiagrams = true, ...props }:
  Partial<BoardProps> & { routingAlgorithm?: typeof savedRouting; includeSystemDiagrams?: boolean } = {}) {
  return <board width={91} height={90} outlineOffsetX={-12.5} outlineOffsetY={18.5} layers={4} thickness="1.6mm"
    autorouter={{ local: true, algorithmFn: routingAlgorithm }} autorouterVersion="latest" autorouterEffortLevel="1x"
    routeRemaining
    minTraceWidth={0.1} minTraceToPadEdgeClearance={0.1}
    minViaEdgeToPadEdgeClearance={0.1} minViaHoleEdgeToViaHoleEdgeClearance={0.3}
    minViaHoleDiameter="0.3mm" minViaPadDiameter="0.45mm"
    pcbStyle={{ viaHoleDiameter: "0.3mm", viaPadDiameter: "0.45mm" }}
    isViaInPadAllowed={false} allowBlindAndBuriedVias={false}
    schTraceAutoLabelEnabled schMaxTraceDistance={12} {...props}>
    <RoutingPlan />
    <CriticalRouting />
    <UserInterface />
    <group name="pcb_power_switch" pcbX={0} pcbY={0} schX={0} schY={0}><PowerSwitch /></group>
    <AssemblyReferences />
    {/* Standard through-vias outside solder lands; 0.30 mm drill / 0.45 mm pad. */}
    {[
      [-17.15,-19],[-17.15,-17],[-12.85,-19],[-12.85,-17],
      [-16,-20.4],[-14,-20.15],[-16,-15.85],[-14,-15.85],
      [-4.15,15.8],[-3.5,16.15],[-2.65,6.125],[-4.6,6.2],
      [-18.3,-5.85],[-17.6,-5.85],
    ].map(([x,y],i) => <Fragment key={i}><via name={`GND_STITCH_${i+1}`} pcbX={x} pcbY={y}
      fromLayer="top" toLayer="bottom" layers={["top","inner1","inner2","bottom"]}
      holeDiameter="0.3mm" outerDiameter="0.45mm" tented connectsTo="net.GND" /></Fragment>)}
    {/* U11 thermal pad: copper on both faces and eight through-vias outside the solder land. */}
    {[[-.7,-1.8],[0,-1.8],[.7,-1.8],[-.7,1.8],[0,1.8],[.7,1.8],[-1.9,0],[1.9,0]].map(([x,y],i) =>
      <Fragment key={`power-${i}`}><via name={`POWER_GND_${i+1}`} pcbX={-5.5-y} pcbY={19.3+x}
        fromLayer="top" toLayer="bottom" layers={["top","inner1","inner2","bottom"]}
        holeDiameter="0.3mm" outerDiameter="0.45mm" tented connectsTo="net.GND" /></Fragment>)}
    {/* Top pours stop 0.2 mm from the isolated SN copper. L2 stays continuous. */}
    {kelvinPours.powerTop.map((outline,i) => <Fragment key={`power-top-${i}`}><copperpour name={`POWER_GROUND_top_${i}`}
      connectsTo="net.GND" layer="top" clearance={0.2} useThermalReliefs={false} outline={outline} /></Fragment>)}
    <copperpour name="POWER_GROUND_bottom" connectsTo="net.GND" layer="bottom" clearance={0.2} useThermalReliefs={false}
      outline={[{x:-10.5,y:15.65},{x:0.5,y:15.65},{x:0.5,y:24.65},{x:-10.5,y:24.65}]} />
    <SchematicNotes />
    <copperpour name="GROUND_BOTTOM" connectsTo="net.GND" layer="bottom" clearance={0.25} useThermalReliefs={false}
      outline={[{x:-57.5,y:-26},{x:32.5,y:-26},{x:32.5,y:63},{x:-57.5,y:63}]} />
    <copperpour name="GROUND_PLANE" connectsTo="net.GND" layer="inner1" unbroken clearance={0.2} useThermalReliefs={false}
      outline={[{x:-57.5,y:-26},{x:32.5,y:-26},{x:32.5,y:63},{x:-57.5,y:63}]} />
    {/* Local ground copper spreads driver heat and closes bypass loops. */}
    {kelvinPours.motorTop.map((outline,i) => <Fragment key={`motor-top-${i}`}><copperpour name={`MOTOR_GROUND_TOP_${i}`}
      connectsTo="net.GND" layer="top" clearance={0.2} useThermalReliefs={false} outline={outline} /></Fragment>)}
    <copperpour name="MOTOR_GROUND_BOTTOM" connectsTo="net.GND" layer="bottom" clearance={0.2} useThermalReliefs={false}
      outline={[{x:-8.8,y:2.5},{x:1.5,y:2.5},{x:1.5,y:15.8},{x:-8.8,y:15.8}]} />
    <copperpour name="LOGIC_GROUND_BOTTOM" connectsTo="net.GND" layer="bottom" clearance={0.2} useThermalReliefs={false}
      outline={[{x:-27,y:-7},{x:-8,y:-7},{x:-8,y:2.5},{x:-27,y:2.5}]} />
    <copperpour name="PROCESSOR_GROUND_TOP" connectsTo="net.GND" layer="top" clearance={0.2} useThermalReliefs={false}
      outline={[{x:-19.1,y:-22.3},{x:-10.9,y:-22.3},{x:-10.9,y:-13.9},{x:-19.1,y:-13.9}]} />
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_usb_pd"><UsbPd /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_logic_power"><LogicPower /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_pd_load"><PdLoad /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_processor"><Processor /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_motor_control"><MotorControl /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_bridge"><MotorBridge /></group>
    <group pcbX={0} pcbY={0} schX={0} schY={0} name="pcb_separate_usb"><SeparateUsb /></group>
    {[[-54.5,-23],[29.5,-23],[-54.5,60],[29.5,60]].map(([x,y], i) =>
      <Fragment key={i}><hole name={`H${i+1}`} diameter={3.2} pcbX={x} pcbY={y} /></Fragment>)}
    <silkscreentext text="POWER" pcbX={-52} pcbY={38.7} fontSize={1} pcbRotation={90} />
    <silkscreentext text="OFF" pcbX={-55.5} pcbY={41.1} fontSize={1} />
    <silkscreentext text="ON" pcbX={-55.5} pcbY={29.8} fontSize={1} />
    <silkscreentext text="RP2040 FOC BLDC V2" layer="bottom" pcbX={-3.5} pcbY={17} fontSize={1.2} />
    <silkscreentext text="USB PD: 5 / 9 / 15 / 20 V" layer="bottom" pcbX={-3.5} pcbY={14} fontSize={1.2} />
    {/* Back-side evaluation notice, shared by the PCB and integrated assembly entrypoints. */}
    <silkscreentext text="For evaluation only;" layer="bottom" pcbX={-3.5} pcbY={9} fontSize={2} />
    <silkscreentext text="not FCC approved for resale." layer="bottom" pcbX={-3.5} pcbY={5.5} fontSize={2} />
    {/* tscircuit2024 has no semicolon glyph: native artwork completes its reserved character cell. */}
    <silkscreenpath layer="bottom" strokeWidth={0.18} route={[{x:-16.38,y:9.15},{x:-16.50,y:9.15}]} />
    <silkscreenpath layer="bottom" strokeWidth={0.18} route={[{x:-16.50,y:8.53},{x:-16.30,y:8.28}]} />
    <silkscreentext text="MOTOR" pcbX={14.6} pcbY={43.5} fontSize={1} />
    <silkscreentext text="DATA" pcbX={-53.5} pcbY={-16.5} fontSize={1.2} isKnockout knockoutPadding={0.25} />
    <silkscreentext text="USB PD" pcbX={-53.5} pcbY={10.5} fontSize={1.2} isKnockout knockoutPadding={0.25} />
    {[-3.108,8.892,20.892].map((x,i) => <Fragment key={i}><silkscreentext text={"UVW"[i]} pcbX={x} pcbY={43} fontSize={1} /></Fragment>)}
    {[
      ["SWD TEST",-44,-8.5], ["RESET",2.55,21.6],
      ["ARM",-53,21.6], ["BOOT",13.55,21.6], ["PD TEST",-45,10.5],
      ["SPEED",-48.5,58.5],
      ["BUS",5.77,30.2], ["STATUS",-49,30.1],
      
    ].map(([label,x,y],i) => <Fragment key={i}><silkscreentext text={String(label)} pcbX={Number(x)} pcbY={Number(y)} fontSize={1} /></Fragment>)}
    {["UP","DOWN","OK","BACK"].map((label,i) => <Fragment key={`nav-${i}`}><silkscreentext text={label} pcbX={-41.45+11*i} pcbY={28.6} fontSize={1} /></Fragment>)}
    <silkscreentext text="FOC TEST" pcbX={-45.5} pcbY={3} fontSize={1} pcbRotation={90} />
    {/* Local VREG bypass connectivity; the saved plan contains its short physical path. */}
    <trace name="MCF_REGULATOR_BYPASS" from=".U7 > .VREG" to=".C80 > .pin1" thickness={0.2}
      pcbPath={[".U7 > .VREG", ".C80 > .pin1"]} />
    <EncoderInterface />
    <RearmInterlock />
    <silkscreentext text="ENC/HALL" pcbX={32.2} pcbY={37} fontSize={1} pcbRotation={90} />
    {["Z","B","A","G","3V3"].map((label,i)=><Fragment key={`enc-pin-${i}`}><silkscreentext text={label} pcbX={20+2*i} pcbY={41.15} fontSize={1} /></Fragment>)}
    {includeSystemDiagrams && <BoardSystemDiagrams linkToPcb />}
  </board>
}