AnasSarkiz/rp2040-bldc-servo-controller
RP2040-based motor-control board integrating a DRV8316 three-phase gate driver, AS5047P magnetic position sensor, USB-C power/communications, STUSB4500 USB-PD controller, SPI flash, and THVD1450 RS-485 transceiver.
- Version
- 0.0.5
- License
- unset
- Stars
- 0
README.md
# RP2040 BLDC servo controller - WIP engineering prototype
**The hardware design is incomplete. Do not fabricate, assemble, or power this revision. FOC is not implemented or tested.**
The current `index.circuit.tsx` is an unconnected inspection fixture for seven JLCPCB imports. It is not a controller schematic. Revision **0.0.5** retains the **42 × 42 mm target canvas, four layers and TOP-only placement** while updating the toolchain and repeating inspection checks. Exact motor fit is unverified. No mounting holes have been guessed. U6 is shown for import inspection; the eventual AS5047P belongs on an external shaft-mounted assembly.
The sourcing review selects **C131025 for the same W25Q16JVSSIQ flash**. C165948 remains unapproved because of footprint/electrical metadata defects. Official JLCPCB stock and available-order quantities were verified on 2026-10-26 for all seven fixture parts, both connector choices and four Basic passive candidates. Basic candidates remain unallocated pending manufacturer footprint/per-use review. A new TPS55340RTER/C169167 boost screening candidate has an import defect: two manufacturer-grounded pins are incorrectly marked do-not-connect. See [SOURCING.md](SOURCING.md), [candidate list](SOURCING-CANDIDATES.csv) and [issue.md](issue.md).
The earlier missing-A4-frame report was incorrect and has been retracted. All three native frames and component membership are checked. The supported native stacked renderer now provides an [all-sheet preview](dist/index/schematic-all-sheets.svg). This improves inspection; it does not complete the electrical design.
## Requested hardware
- [STEPPERONLINE 42BSA46-24-01 motor](https://www.omc-stepperonline.com/24v-3000rpm-0-08nm-25w-1-80a-42x42x46mm-brushless-dc-motor-42bsa46-24-01): 24 V, 25 W, 1.80 A, 3 phases, 8 poles, Hall sensors.
- RP2040, DRV8316R, STUSB4500, W25Q16JVSSIQ, USB4215-03-A and THVD1450DR. External AS5047P interface and optional daughterboard.
- USB-C PD is the sole primary power source, including motor power. Target contract 20 V / 5 A using a compatible source and electronically marked 5 A cable; negotiate 5/9/15/20 V as applicable.
- Regulated 24 V boost motor bus and separate 3.3 V logic supply. USB programming and communication, SWD, Hall and SPI encoder inputs, current feedback, fault monitoring, hardware disable and RS-485.
- Four copper layers; 42 × 42 mm target; TOP-only assembly; exact rear motor fit using existing rear bolts remains required and unverified.
## Architecture under review - not implemented
USB-C VBUS -> PD-controlled, reverse-blocking, inrush/current-limited input -> 24 V boost -> protected motor bus -> DRV8316R -> U/V/W.
A separate converter must supply logic during initial 5 V attachment and through PD voltage transitions. The Hall interface needs a suitable 5 V rail: the motor drawing identifies Hall red as +5 V, not 3.3 V. Hall signals must not expose RP2040 pins to 5 V. The external encoder can use its documented 3.3 V configuration with local decoupling and suitable cable protection.
The motor enable path must default disabled and require valid PD contract, adequate contracted current, input voltage window, regulated motor voltage, no electrical/thermal fault and explicit MCU enable. PD loss and brownout must disable the driver independently of running application code. Input current must respect the actual negotiated contract, not a nominal 100 W charger label. A 20 V contract alone does not establish permission to draw 5 A.
STUSB4500 stores **three sink PDOs**, including mandatory 5 V. Supporting all four requested voltages requires documented MCU-controlled PDO reconfiguration/renegotiation; it cannot be represented as four static NVM profiles. USB data capability must be configured and checked. A charger need not be a USB data host.
LM5122 is a candidate synchronous boost controller reviewed at the datasheet level, not a selected/imported/finalized converter. A complete boost design still needs exact imported FETs, inductor, current sensing, input/output capacitors, compensation, soft-start, disconnect/protection and verified startup/transient behavior. Ordinary boost shutdown does not guarantee output disconnection. Regenerative braking must have a defined local energy sink; the USB source must not be back-fed. No converter efficiency, thermal rating, stall capability or braking energy rating has been verified.
See [POWER-REVIEW.md](POWER-REVIEW.md) for calculations and remaining requirements. The new tolerance-aware screening shows why a nominal 100 W label cannot guarantee a 24 V / 3 A surge across the assumed board-input range. TPS55288 was screened out because its specified output range ends at 22 V. No boost converter is finalized or startup-qualified.
## Schematic, pin mapping and BOM
The three native A4 sheets in the source are explicitly labeled as unconnected import reviews. No functional schematic sheets are complete. See [PIN-REVIEW.md](PIN-REVIEW.md) for verified device pin groups and a proposed GPIO allocation; this is a planning record, not implemented connectivity.
[BOM.csv](BOM.csv) inventories every placed fixture part with real supplier numbers, MPNs, quantities, packages, primary stock snapshot/date, available-order quantity, tier, assembly side and import status. **It is not a complete controller assembly BOM.** Functional support circuitry and quantities remain unfinished; six unallocated candidates are separate. All seven current parts are Extended; no Promotional designation was shown. The CSV preserves `0402` as a package identifier. C131025 retains the reviewed same-MPN flash choice. No invented codes or component definitions are included. Remaining complete-controller work is listed in [SOURCING.md](SOURCING.md).
## Reproduce inspection
Use Bun 1.3.9 and the pinned dependencies in `bun.lock`. The local CLI is `@tscircuit/cli` 0.1.2414; the tscircuit library is 0.0.3028; `tsci --version` prints a tscircuit library version and must not be mistaken for the CLI package version.
```sh
bun install --frozen-lockfile
bun run typecheck
bun run format:check
bunx --no-install tscircuit-cli check netlist index.circuit.tsx
bunx --no-install tscircuit-cli check pin_specification index.circuit.tsx
bunx --no-install tscircuit-cli check source index.circuit.tsx
bunx --no-install tscircuit-cli check schematic-placement index.circuit.tsx
bunx --no-install tscircuit-cli check placement index.circuit.tsx
bunx --no-install tscircuit-cli build index.circuit.tsx --pcb-png --pcb-svgs --schematic-svgs --3d
python3 scripts/check-sourcing.py
bun run render:sheets
bun run test:schematic-sheets
python3 scripts/power-envelope.py
```
Run `bun run render:sheets` after the failed-build JSON is generated to render all individual sheets and the native stacked preview. The sheet test checks presentation coverage, not electrical correctness. `checks/tps55340-import-defect.circuit.tsx` reproduces an import/data problem; it is not a boost converter design.
Routing remains disabled. An inspection build or successful software command does not validate an unconnected hardware design. Final copper, shorts checks, snapshot acceptance and fabrication exports must wait for the electrical and placement gates.
## Evidence and release status
[VALIDATION.md](VALIDATION.md) records stage status and exact check results. [issue.md](issue.md) records reproduction steps, errors and attempted resolutions. Downloaded manufacturer PDFs are in `datasheets/`; URLs, checksums and download failures are in `evidence/`. Some datasheet and motor CAD downloads remain unavailable; those files are not presented as reviewed or archived.
GitHub and registry destinations are `AnasSarkiz/rp2040-bldc-servo-controller`. A visible version number alone is not proof of a complete package or validated board. CLI 0.1.2414 fixes configuration-based publication exclusion; registry publication verification for this revision is recorded in VALIDATION.md. The hardware build remains failed and this is only an inspection prototype. No fabrication package, physical measurements, firmware performance, working FOC, exact motor fit or hardware-tested status is claimed.
The original import audit was pushed in [commit 6c8db5d](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller/commit/6c8db5d07f03ca8d3ad408babe7f5ef01e341f19). Current source and generated artifacts are published to the same [existing GitHub repository](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller). Revision-specific push/hash verification is recorded in `VALIDATION.md` and `evidence/`. The [public tscircuit package](https://tscircuit.com/AnasSarkiz/rp2040-bldc-servo-controller) received a partial 0.0.4 upload. CLI 0.1.2414 fixes I-002; I-021 records that upload's size failure. The current revision uses supported remote encoder models and individual upload mode. See the [GitHub validation record](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller/blob/main/VALIDATION.md) for actual release completion and hash verification.
Sourcing revision 0.0.2 is in [commit d7f16d3](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller/commit/d7f16d34411995b04f663e9e61aa56bf0f7f4f9d). Its three Circuit JSON artifacts, both sourcing CSVs and the new manufacturer PDF were fetched anonymously and verified against local SHA-256 hashes. Main build failure and all hardware blockers remain explicit.
Engineering review 0.0.3 is pushed in [commit c50d7c5](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller/commit/c50d7c546784ac6c886ce0e4f897dd171cc6e504). All four inspection Circuit JSON files, the sourcing CSVs, new TI PDFs, issue log and all-sheet SVG were fetched anonymously and matched local hashes. New tscircuit defects I-016/I-017/I-018 have reproductions and evidence in `issue.md`; the earlier missing-sheet-frame claim is corrected. The main build still fails on 13 unconnected required pins. Registry publication, complete circuitry, exact motor fit, startup/thermal qualification and fabrication approval remain blocked.
## Toolchain update 0.0.4 — 2026-10-27
Updated tscircuit **0.0.3016 → 0.0.3028** and local CLI **0.1.2408 → 0.1.2414**, pinned exactly with the refreshed Bun lockfile. Formatting, TypeScript, all five pre-routing check commands, native sheet coverage and BOM consistency complete successfully at the command level. Netlist still reports 169 NOT_CONNECTED ports. The main build **fails with 13 required-pin errors**, and all checked PCB/CAD/schematic geometry is unchanged. All three isolated qualification fixtures rebuild with warnings. No electronic import, wiring, routing or component selection was changed.
The CLI now applies configured publication exclusions (I-002); explicit glob patterns also exclude datasheets, evidence, unused candidate imports and isolated fixture outputs. No dependency or imported definition was patched. I-007/I-009/I-013/I-014/I-015/I-016/I-017/I-018 remain unresolved. I-020 records upstream peer-version incompatibilities observed during installation; no new runtime failure was demonstrated by this update. Stock dates remain the original 2026-10-26 snapshot, not a new inventory claim. See VALIDATION.md for the actual registry upload/anonymous artifact verification outcome.
## Publication follow-up 0.0.5
The 0.0.4 upload encountered HTTP 413 for the package archive and one required encoder STEP model; 49 files uploaded but that release was incomplete and not marked ready to build. I-021 documents the failure. Version **0.0.5** uses the CLI's standard exact C962063 import with official remote model URLs and the documented individual upload mode. The remote OBJ/STEP files are byte-identical to the originals retained on GitHub. Electrical pins, copper pads and courtyard are unchanged; one notch silkscreen arc is regenerated with different tessellation. This is generated output from the supported importer, with no manual component patch.
The encoder's 3D assets now depend on the official model CDN. All hardware limitations above remain: this is an unconnected import-inspection prototype with 13 mandatory-pin build errors, no completed motor power circuit, no qualified FOC and no fabrication approval. The [current GitHub validation record](https://github.com/AnasSarkiz/rp2040-bldc-servo-controller/blob/main/VALIDATION.md) records the exact registry upload result, public file/hash checks and build state. Registry publication does not imply a passed hardware build.