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.

encoder-board.circuit.tsx

PCBPCB preview for encoder-board.circuit.tsx
SchematicSchematic preview for encoder-board.circuit.tsx
import { AS5047P_ATSM } from "./imports/AS5047P_ATSM"
import { S5B_PH_SM4_TB_LF__SN_ } from "./imports/S5B_PH_SM4_TB_LF__SN_"

/**
 * Motor encoder board for J20. Wiring follows the AS5047P datasheet (v2-00); not yet fabricated or tested.
 *
 * AS5047P on-axis magnetic sensor, strapped for 3.3 V operation (VDD and VDD3V3 joined).
 * J30 is the same JST PH side-entry header and pin order as J20 on the controller, so a
 * straight 5-way PH cable (pin 1 to pin 1) connects the two with no soldering.
 * The chip centre is the board origin: it must sit on the motor shaft axis under a
 * 6 x 2.5 mm diametric magnet. Mounting-hole positions are provisional until the motor's
 * rear shaft and the bracket are measured.
 *
 * Reference names (U30, R300..., J30, TP30...) do not clash with the controller board, so both
 * boards can share one fabrication file (scripts/build-fabrication-with-encoder.mjs). Datasheet rules applied: VDD and VDD3V3 tied for 3.3 V
 * with 100 nF; TEST to ground; pull-up on CSn and pull-downs on CLK and MOSI because SPI is idle;
 * MISO and the unused U/V/W outputs left open. Outputs drive at most 1 mA into 50 pF, so keep the
 * cable short (40 cm or less).
 */
// Own net names (EB_...), so nothing shares a name with the controller's nets when both boards
// are in one fabrication file. The cable joins EB_3V3/EB_GND/EB_A/EB_B/EB_Z to J20.
const net = (name: string) => `net.EB_${name}`
const jlc = (part: string) => ({ supplierPartNumbers: { jlcpcb: [part] } })
// Parts already used on the controller board.
const R10K = { resistance: "10k", footprint: "0402", manufacturerPartNumber: "0402WGF1002TCE", ...jlc("C25744") } as const
const R27 = { resistance: "27", footprint: "0402", manufacturerPartNumber: "0402WGF270JTCE", ...jlc("C25100") } as const

export const encoderBoard = { width: 24, height: 38, centerY: -6.5, holeDiameter: 2.7, holes: [[-8.5, 8.5], [8.5, 8.5], [-8.5, -8.5], [8.5, -8.5]] } as const

// Left to right. The four signal pads follow the chip's pin order so their tracks do not cross.
const spiPads = [
  ["TP30", "GND", "GND"], ["TP31", "3V3", "3V3"], ["TP32", "MOSI", "SPI_MOSI"],
  ["TP33", "MISO", "SPI_MISO"], ["TP34", "CLK", "SPI_CLK"], ["TP35", "CS", "SPI_CSN"],
] as const
const plugLabels = ["3V3", "GND", "A", "B", "Z"] as const

export default function EncoderBoard() {
  return (
    // Four layers and 1.6 mm, like the controller: both are made as one physical board.
    <board width={encoderBoard.width} height={encoderBoard.height} outlineOffsetY={encoderBoard.centerY} thickness="1.6mm"
      layers={4} title="AS5047P motor encoder for J20">
      <AS5047P_ATSM name="U30" pcbX={0} pcbY={0} pcbRotation={180} schX={0} schY={0}
        noConnect={["pin8", "pin9", "pin10"]}
        connections={{
          pin1: net("SPI_CSN"), pin2: net("SPI_CLK"), pin3: net("SPI_MISO"), pin4: net("SPI_MOSI"),
          pin5: net("GND"), // TEST is tied to ground in normal use
          pin6: net("B_RAW"), pin7: net("A_RAW"), pin14: net("I_RAW"),
          pin11: net("3V3"), pin12: net("3V3"), // 3.3 V mode: supply both pins together
          pin13: net("GND"),
        }} />

      {/* Local supply decoupling */}
      <capacitor name="C300" capacitance="100nF" footprint="0402" manufacturerPartNumber="CL05B104KB5NNNC" {...jlc("C960916")}
        pcbX={0.65} pcbY={-4.8} schX={4} schY={2} connections={{ pin1: net("3V3"), pin2: net("GND") }} />
      <capacitor name="C301" capacitance="1uF" footprint="0402" manufacturerPartNumber="CL05A105KA5NQNC" {...jlc("C52923")}
        pcbX={0.65} pcbY={-6.1} schX={5.5} schY={2} connections={{ pin1: net("3V3"), pin2: net("GND") }} />

      {/* SPI is only used to change settings. Idle levels keep it inactive when nothing is attached. */}
      <resistor name="R300" {...R10K} pcbX={6.3} pcbY={6.2} pcbRotation={90} schX={-4} schY={3} connections={{ pin1: net("3V3"), pin2: net("SPI_CSN") }} />
      <resistor name="R301" {...R10K} pcbX={4.2} pcbY={5.2} schX={-4} schY={1.5} connections={{ pin1: net("SPI_CLK"), pin2: net("GND") }} />
      <resistor name="R302" {...R10K} pcbX={-2.6} pcbY={7.2} schX={-4} schY={0} connections={{ pin1: net("GND"), pin2: net("SPI_MOSI") }} />

      {/* Source resistors on the cable outputs */}
      <resistor name="R303" {...R27} pcbX={-5.6} pcbY={-6.5} pcbRotation={270} schX={4} schY={-1} connections={{ pin1: net("A_RAW"), pin2: net("A") }} />
      <resistor name="R304" {...R27} pcbX={-4.2} pcbY={-6.5} pcbRotation={270} schX={4} schY={-2.2} connections={{ pin1: net("B_RAW"), pin2: net("B") }} />
      <resistor name="R305" {...R27} pcbX={3.4} pcbY={-9.5} pcbRotation={270} schX={4} schY={-3.4} connections={{ pin1: net("I_RAW"), pin2: net("Z") }} />

      {/* Same header and pin order as J20: 1 = 3V3, 2 = GND, 3 = A, 4 = B, 5 = Z. Opens toward the board end. */}
      <S5B_PH_SM4_TB_LF__SN_ name="J30" pcbX={0} pcbY={-20} pcbRotation={180} schX={9} schY={-2}
        connections={{ pin1: net("3V3"), pin2: net("GND"), pin3: net("A"), pin4: net("B"), pin5: net("Z"), pin6: net("GND"), pin7: net("GND") }} />
      {plugLabels.map((text, i) => (
        <silkscreentext key={text} text={text} pcbX={-4 + i * 2} pcbY={-13.4} fontSize="0.7mm" pcbRotation={90} />
      ))}

      {/* Settings pads, 2.54 mm apart, for spring-pin access. Nothing is fitted here. */}
      {spiPads.map(([name, label, signal], i) => (
        <testpoint key={name} name={name} footprintVariant="pad" padShape="circle" padDiameter="1.5mm"
          pcbX={-6.35 + i * 2.54} pcbY={11} schX={-8} schY={3 - i * 1.2} doNotPlace connections={{ pin1: net(signal) }} />
      ))}
      {spiPads.map(([name, label], i) => (
        <silkscreentext key={`${name}-label`} text={label} pcbX={-6.35 + i * 2.54} pcbY={9.4} fontSize="0.6mm" />
      ))}

      {encoderBoard.holes.map(([x, y]) => <hole key={`${x},${y}`} diameter={encoderBoard.holeDiameter} pcbX={x} pcbY={y} />)}
      <silkscreentext text="ENCODER AS5047P" pcbX={7.6} pcbY={-3} fontSize="0.8mm" pcbRotation={90} />
      {/* Unbroken ground on the underside; the supply crosses there on short tracks. */}
      {/* Kept 1 mm back from the edge, clear of the break-off perforations along the top edge. */}
      <copperpour connectsTo={net("GND")} layer="bottom" clearance="0.2mm" boardEdgeMargin="1mm" />
    </board>
  )
}