astra/nema17-stepper-motor-controller-spring-clamp-rp2040

A 4-layer RP2040 controller board that negotiates USB‑C PD motor power and drives a NEMA17 stepper via a DRV8825, with current sensing, thermal shutdown, RGB status LED, buzzer alarm, optional AS5600 encoder, protection/filtering, and test points.

Version
1.4.0
License
unset
Stars
0

scripts/render-pcb.ts

import { readFileSync, writeFileSync } from "node:fs";
import { convertCircuitJsonToPcbSvg } from "circuit-to-svg";
import { Resvg } from "@resvg/resvg-js";
const json = JSON.parse(readFileSync(process.argv[2] ?? "dist/index/circuit.json", "utf8"));
for (const layer of ["top", "inner1", "inner2", "bottom"] as const) {
  const svg = convertCircuitJsonToPcbSvg(json, {
    layer, width: 1400, matchBoardAspectRatio: true,
    shouldDrawErrors: true, showErrorsInTextOverlay: true,
  });
  writeFileSync(`${process.argv[3] ?? "dist/index"}/pcb-${layer}.svg`, svg);
  writeFileSync(`${process.argv[3] ?? "dist/index"}/pcb-${layer}.png`, new Resvg(svg).render().asPng());
}