MustafaMulla29/rp2040-bldc-motor-controller-new

A USB‑C PD–powered RP2040 BLDC motor controller PCB with 3.3 V logic, MCT8329A sensorless commutation, three MOSFET half-bridges, protected power switching, USB data, controls, and motor connectors.

Version
0.3.82
License
unset
Stars
0

imports/AOD4184A.tsx

import type { ChipProps } from "@tscircuit/props"

const pinLabels = {
  pin1: ["G"],
  pin2: ["D"],
  pin3: ["S"]
} as const

// G is the control input; D/S are passive switched terminals, not fixed supply pins.
const pinAttributes = {
  pin1: { isInput: true },
  pin2: { isPassive: true },
  pin3: { isPassive: true },
} as const

export const AOD4184A = ({ symbolMirrorX = false, ...props }: ChipProps<typeof pinLabels> & { symbolMirrorX?: boolean }) => {
  // Custom symbol paths need explicit rotation in this pinned core release.
  const angle = Number(props.schRotation ?? 0) * Math.PI / 180
  const rotate = (points: Array<{x: number; y: number}>) => points.map(({x,y}) => ({
    x: 0.1 + (symbolMirrorX ? -1 : 1) * 1.8 * ((x - 0.1) * Math.cos(angle) - y * Math.sin(angle)),
    y: 1.8 * ((x - 0.1) * Math.sin(angle) + y * Math.cos(angle)),
  }))
  const direction = (d: "up" | "right" | "down" | "left") => {
    const order = ["right", "up", "left", "down"] as const
    const rotated = order[(order.indexOf(d) + Math.round(angle / (Math.PI / 2)) + 8) % 4]
    return symbolMirrorX && (rotated === "left" || rotated === "right") ? (rotated === "left" ? "right" : "left") : rotated
  }
  return (
    <mosfet
      channelType="n" mosfetMode="enhancement"
      pinLabels={pinLabels}
      pinAttributes={pinAttributes}
      symbol={
        <symbol>
          <schematictext text="{NAME}" schX={0.85} schY={0.5} fontSize={0.22} anchor="left" />
          <schematictext text="AOD4184A" schX={0.85} schY={0.16} fontSize={0.18} anchor="left" />
          <schematicpath points={rotate([{"x":-0.1,"y":0},{"x":0.02,"y":-0.04},{"x":0.02,"y":0.04},{"x":-0.1,"y":0}])} strokeColor="#880000" isFilled fillColor="#880000" />
          <schematicpath points={rotate([{"x":0.3,"y":0.04},{"x":0.24,"y":-0.06},{"x":0.36,"y":-0.06},{"x":0.3,"y":0.04}])} strokeColor="#880000" isFilled fillColor="#880000" />
          <schematicpath points={rotate([{"x":-0.1,"y":0.14},{"x":0.1,"y":0.14},{"x":0.1,"y":0.2},{"x":0.3,"y":0.2},{"x":0.3,"y":0.04}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":-0.1,"y":0},{"x":0.1,"y":0},{"x":0.1,"y":-0.2},{"x":0.3,"y":-0.2},{"x":0.3,"y":-0.06}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":0.1,"y":-0.14},{"x":-0.1,"y":-0.14}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":-0.14,"y":0.18},{"x":-0.14,"y":-0.18}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":-0.1,"y":0.18},{"x":-0.1,"y":0.1}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":-0.1,"y":-0.04},{"x":-0.1,"y":0.04}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":-0.1,"y":-0.18},{"x":-0.1,"y":-0.1}])} strokeColor="#880000" />
          <schematicpath points={rotate([{"x":0.38,"y":0.04},{"x":0.34,"y":0.04},{"x":0.26,"y":0.04},{"x":0.22,"y":0.04}])} strokeColor="#880000" />
          <port name="pin2" pinNumber={2} aliases={["D"]} direction={direction("up")} schX={rotate([{x:0.1,y:0.4}])[0].x} schY={rotate([{x:0.1,y:0.4}])[0].y} schStemLength={0.36} />
          <port name="pin1" pinNumber={1} aliases={["G"]} direction={direction("left")} schX={rotate([{x:-0.3,y:0}])[0].x} schY={rotate([{x:-0.3,y:0}])[0].y} schStemLength={0.288} />
          <port name="pin3" pinNumber={3} aliases={["S"]} direction={direction("down")} schX={rotate([{x:0.1,y:-0.4}])[0].x} schY={rotate([{x:0.1,y:-0.4}])[0].y} schStemLength={0.36} />
        </symbol>
      }
      supplierPartNumbers={{
  "jlcpcb": [
    "C99124"
  ]
}}
      manufacturerPartNumber="AOD4184A"
      footprint={<footprint>
        <smtpad portHints={["pin2"]} pcbX="2.3669625mm" pcbY="0mm" width="6.5000124mm" height="5.999988mm" shape="rect" />
<smtpad portHints={["pin1"]} pcbX="-4.2169715mm" pcbY="2.272792mm" width="2.7999944mm" height="1.2999974mm" shape="rect" />
<smtpad portHints={["pin3"]} pcbX="-4.2169715mm" pcbY="-2.272792mm" width="2.7999944mm" height="1.2999974mm" shape="rect" />
<silkscreenpath route={[{"x":-2.3812626999999793,"y":3.3395920000000103},{"x":-2.3812626999999793,"y":-3.352800000000002}]} />
<silkscreenpath route={[{"x":3.5861625000000004,"y":-3.352800000000002},{"x":-2.3812626999999793,"y":-3.352800000000002}]} />
<silkscreenpath route={[{"x":3.5861625000000004,"y":3.3395920000000103},{"x":-2.3812626999999793,"y":3.3395920000000103}]} />
<silkscreentext text="{NAME}" pcbX="-0.0120015mm" pcbY="4.349244mm" anchorAlignment="center" fontSize="1mm" />
<courtyardoutline outline={[{"x":-5.8754015000000095,"y":3.5992439999999988},{"x":5.851398500000016,"y":3.5992439999999988},{"x":5.851398500000016,"y":-3.580955999999958},{"x":-5.8754015000000095,"y":-3.580955999999958},{"x":-5.8754015000000095,"y":3.5992439999999988}]} />
      </footprint>}
      cadModel={{
        objUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C99124.obj?uuid=5cc2a31718c943a193855315af1a2fab",
        stepUrl: "https://modelcdn.tscircuit.com/easyeda_models/assets/C99124.step?uuid=5cc2a31718c943a193855315af1a2fab",
        pcbRotationOffset: 270,
        modelOriginPosition: { x: 2.284810799999991, y: 4.905692000000021, z: 0 },
      }}
      {...props}
      connections={Object.fromEntries(Object.entries(props.connections ?? {}).map(([pin,net]) => [{ G: "pin1", D: "pin2", S: "pin3" }[pin] ?? pin, net]))}
      schRotation={0}
    />
  )
}