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-controllerIn 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.
scripts/render-schematic.mjs
/** Schematic-only preview. It is deliberately not evidence of PCB routing. */
import { Circuit } from "@tscircuit/core"
import { convertCircuitJsonToSchematicSvg, convertCircuitJsonToStackedSchematicSheetsSvg } from "circuit-to-svg"
import { Resvg } from "@resvg/resvg-js"
import { mkdirSync, writeFileSync, readdirSync, unlinkSync, readFileSync } from "node:fs"
import Board from "../index.circuit.tsx"
// A supplied build artifact avoids rendering the same circuit twice.
let json
if (process.argv[2]) {
json = JSON.parse(readFileSync(process.argv[2], "utf8"))
} else {
const circuit = new Circuit({ platform: { partsEngineDisabled: true, pcbDisabled: true, routingDisabled: true } })
circuit.add(Board({ routingDisabled: true, includeSystemDiagrams: false }))
await circuit.renderUntilSettled()
json = circuit.getCircuitJson()
}
const outputDir = ".tscircuit/schematics"
mkdirSync(outputDir, { recursive: true })
writeFileSync(`${outputDir}/circuit.json`, JSON.stringify(json, null, 2))
const sheets = json.filter(x => x.type === "schematic_sheet")
const expected = new Set(sheets.flatMap(s => ["svg", "png"].map(ext => `${String(s.sheet_index + 1).padStart(2, "0")}-${s.name}.${ext}`)))
for (const file of readdirSync(outputDir)) {
if (/^\d{2}-.*\.(svg|png)$/.test(file) && !expected.has(file)) unlinkSync(`${outputDir}/${file}`)
}
for (const sheet of sheets) {
const prefix = `${outputDir}/${String(sheet.sheet_index + 1).padStart(2, "0")}-${sheet.name}`
const page = convertCircuitJsonToSchematicSvg(json, { width: 2400, height: 1553, schematicSheetIndex: sheet.sheet_index })
writeFileSync(prefix + ".svg", page)
writeFileSync(prefix + ".png", new Resvg(page).render().asPng())
}
const svg = convertCircuitJsonToStackedSchematicSheetsSvg(json, { width: 1200, height: 777 })
writeFileSync(`${outputDir}/all-sheets.svg`, svg)
console.log(`Rendered ${sheets.length} native schematic sheets in ${outputDir}; ${process.argv[2] ? "from " + process.argv[2] : "PCB intentionally unrouted"}.`)
// Keep the browsable sheet index current whenever previews are regenerated.
await import("./create-schematic-gallery.mjs")