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

import {assembly} from "tscircuit"
import {jscad} from "jscad-fiber/headless"
import {Base,Lid,ButtonPlunger,SpeedKnob,ScreenHolder,ScreenDoor} from "./parts"
import {capButtons,design} from "./dimensions"

/** Part lift (mm, +Z) used by the 3D explosion stages and the exploded drawing copy. */
export const explodedLift={base:0,plungers:70,lid:120,screenHolder:135,screenDoor:143,knob:150}

type PartsOptions={
 /** Prefix for part names, so a drawing-only exploded copy can coexist with the real parts. */
 prefix?:string
 /** When true, each part is translated by explodedLift (drawing copy only). */
 exploded?:boolean
 /** Extra X shift for a drawing-only copy, keeping it clear of the assembled parts. */
 shiftX?:number
}

export function EnclosureParts({prefix="",exploded=false,shiftX=0}:PartsOptions={}){
 const at=(dz:number,child:any)=>(exploded||shiftX)?<jscad.translate offset={[shiftX,0,exploded?dz:0]}>{child}</jscad.translate>:child
 const L=explodedLift
 return <>
 <assembly.printedpart name={`${prefix}CASE_BASE`} displayName="Case base" jscad={at(L.base,<jscad.colorize color="#37454e"><Base/></jscad.colorize>)}/>
 <assembly.printedpart name={`${prefix}CASE_LID`} displayName="Case lid" jscad={at(L.lid,<jscad.colorize color="#dde4df"><Lid/></jscad.colorize>)}/>
 {capButtons.map(b=><assembly.printedpart key={b.ref} name={`${prefix}PLUNGER_${b.ref}`} displayName={`${b.label} button cap`} jscad={at(L.plungers,<jscad.translate offset={[b.x,b.y,0]}><jscad.colorize color={b.ref==="SW3"?"#e7a64f":"#3b4043"}><ButtonPlunger/></jscad.colorize></jscad.translate>)}/>) }
 <assembly.printedpart name={`${prefix}SPEED_KNOB`} displayName="SPEED knob" jscad={at(L.knob,<jscad.colorize color="#e7a64f"><SpeedKnob fitted/></jscad.colorize>)}/>
 <assembly.printedpart name={`${prefix}SCREEN_DOOR`} displayName="Screen door" jscad={at(L.screenDoor,<jscad.colorize color="#dde4df"><ScreenDoor/></jscad.colorize>)}/>
 <assembly.printedpart name={`${prefix}SCREEN_HOLDER`} displayName="Screen holder" jscad={at(L.screenHolder,<jscad.colorize color="#dde4df"><ScreenHolder/></jscad.colorize>)}/>
 </>}

/**
 * Service explosion for the fitted case, in removal order. tscircuit checks every
 * move's swept path for collisions, so these stages prove the parts come apart.
 * 1. Pull the knob straight off the D-shaft.
 * 2. Undo the two door screws and lift the screen door with its holder straight out
 *    (unplug the display flex before moving it away).
 * 3. Separate the door from the holder.
 * 4. Lift the lid with the button caps it retains.
 * 5. Lift the lid clear of the caps.
 */
export function EnclosureExplosion(){
 const L=explodedLift
 const caps=capButtons.map(b=>`PLUNGER_${b.ref}`)
 return <>
 <assembly.explosion.stage name="remove_knob" nextStageRef="lift_screen_door">
  <assembly.explosion.move targetRef="SPEED_KNOB" offZ={L.knob}/>
 </assembly.explosion.stage>
 <assembly.explosion.stage name="lift_screen_door" prevStageRef="remove_knob" nextStageRef="separate_screen_door">
  <assembly.explosion.move targetRefs={["SCREEN_DOOR","SCREEN_HOLDER"]} offZ={L.screenHolder}/>
 </assembly.explosion.stage>
 <assembly.explosion.stage name="separate_screen_door" prevStageRef="lift_screen_door" nextStageRef="lift_lid_group">
  <assembly.explosion.move targetRefs={["SCREEN_DOOR"]} offZ={L.screenDoor-L.screenHolder}/>
 </assembly.explosion.stage>
 <assembly.explosion.stage name="lift_lid_group" prevStageRef="separate_screen_door" nextStageRef="separate_lid">
  <assembly.explosion.move targetRefs={["CASE_LID",...caps]} offZ={L.plungers}/>
 </assembly.explosion.stage>
 <assembly.explosion.stage name="separate_lid" prevStageRef="lift_lid_group">
  <assembly.explosion.move targetRefs={["CASE_LID"]} offZ={L.lid-L.plungers}/>
 </assembly.explosion.stage>
 </>}

/** Fitted case as one subassembly with its service explosion. */
export function EnclosureAssembly(){return <assembly.subassembly name="ENCLOSURE" displayName="Printed enclosure">
 <EnclosureParts/>
 <EnclosureExplosion/>
</assembly.subassembly>}

export default function Enclosure(){return <assembly.device name="BLDC_ENCLOSURE"><EnclosureAssembly/></assembly.device>}