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/drawings.circuit.tsx

/**
 * Exploded-view drawing BLDC-ENC-02 for the printed enclosure (A3), built separately:
 *   bun run enclosure:drawings  ->  docs/drawings/enclosure_exploded_view.svg
 *
 * Drawing views always show geometry in its fitted position, so this file uses a
 * drawing-only copy of the parts lifted by the same amounts as the 3D explosion stages
 * (explodedLift). Keeping the copy out of index.tsx keeps it out of the 3D model.
 * The three BLDC-ENC-01 sheets live in the product model (see drawing-sheets.tsx) and
 * appear on the package's Drawing tab; they are built and checked with build:package.
 */
import {assembly} from "tscircuit"
import {jscad} from "jscad-fiber/headless"
import {EnclosureParts,explodedLift} from "./enclosure.circuit"
import {drawingMeta} from "./drawing-sheets"
import {board,mountingHoles} from "./dimensions"
import {Box,Cylinder} from "./parts"

/** Bare PCB outline (91 x 90 x 1.6 mm with the four M3 holes), for reference only. */
function PcbReference({name,dz=0}:{name:string;dz?:number}){
 const t=board.thickness
 // Drawing-only reference body (not a printed part); printedpart is the element that accepts JSCAD.
 return <assembly.printedpart name={name} displayName="PCB (reference only, not printed)" jscad={
  <jscad.translate offset={[0,0,dz]}><jscad.colorize color="#2f7d4f"><jscad.subtract>
   <Box x={board.center.x} y={board.center.y} w={board.width} h={board.height} z0={-t/2} z1={t/2}/>
   {mountingHoles.map((h:any,i:number)=><Cylinder key={i} x={h.x} y={h.y} r={h.hole_diameter/2} z0={-2} z1={2}/>)}
  </jscad.subtract></jscad.colorize></jscad.translate>}/>}

export default function EnclosureDrawings(){return <assembly.device name="BLDC_ENCLOSURE_DRAWINGS">
 <assembly.subassembly name="CASE_EXPLODED" displayName="Exploded enclosure (drawing copy)">
  <EnclosureParts exploded/>
  <PcbReference name="PCB_REF" dz={explodedLift.base+12}/>
 </assembly.subassembly>
 <assembly.drawing.page name="enclosure_exploded_view" displayName="Enclosure / exploded view" size="iso_a3">
  <assembly.drawing.titleblock {...drawingMeta} title="BLDC controller enclosure / exploded view" identificationNumber="BLDC-ENC-02" sheetNumber={1} numberOfSheets={1}/>
  <assembly.drawing.partview name="EXPLODED_ISOMETRIC" displayName="Exploded / removal order: knob, screen door and holder, lid, caps" partRef=".CASE_EXPLODED" direction="isometric" width={200} height={265} centerX={-90} centerY={5}/>
  <assembly.drawing.partview name="EXPLODED_FRONT" displayName="Exploded / front view" partRef=".CASE_EXPLODED" direction="y+" width={120} height={190} centerX={125} centerY={35}>
   <assembly.drawing.dimension heightOfView/>
  </assembly.drawing.partview>
 </assembly.drawing.page>
</assembly.device>}