imrishabh18/rp2040-motor-controller

This circuit incorporates a USB-C Power Delivery (PD) interface with a CH224K controller, a WJ500V-5.08-04P motor output connector, multiple power conditioning components including capacitors, resistors, diodes, and an RP2040 microcontroller, to manage motor control, signal routing, and power management for a USB-powered stepper motor system.

Version
1.0.14
License
unset
Stars
0

README.md

# RP2040 motor controller — verified ground and routing correction

This project is based on the published `imrishabh18/rp2040-motor-controller` v1.0.13 source. It fixes the two disconnected ground networks by adding `BOARD_GND_JOIN` from `DRIVER.GND2` to the board-level `net.GND`. The existing driver-to-MCU and USB ground connections remain in place.

The board-level ground contains the copper pours, motor current-sense returns, decoupling returns, MODE/TRQ pins, TVS return, and sleep pull-down. The new trace joins these to the MCU, driver, and both USB grounds. Its requested width is 0.8 mm, matching the existing power-trace target.

## Toolchain

Versions were resolved from npm on 2026-09-05:

- tscircuit: **0.0.2463**
- @tscircuit/core: **0.0.1844** (includes schematic superscripts for disconnected same-name nets)
- @tscircuit/cli: **0.1.2021**
- @tscircuit/checks: **0.0.183**
- circuit-json: **0.0.485**
- circuit-to-svg: **0.0.413**

The existing patched `@tscircuit/common@0.0.48` is intentionally retained: that patch contains this board's RP2040 placement, footprints, crystal, decoupling, and schematic-sheet customizations. Replacing it with an unmodified module would change the hardware layout. Obsolete compiler/router overrides and the old CLI patch are no longer active. `bun.lock` records the installed dependency graph.

## Reproduce

```sh
bun install --frozen-lockfile
bun run typecheck
bun test tests/common-ground.test.tsx
bun run build
bun run validate:build
bun run test:built
bun run check:built
bun run render:schematic
bun scripts/render-pcb.ts
```

`validate:build` reads the built Circuit JSON and writes `reports/validation.json`, including a SHA-256 hash, installed versions, ground checks, and independently rerun routing checks. Treat this validation report as authoritative: the CLI can return exit code zero even when the generated circuit contains errors.

`bun run verify` runs the complete build/check/test sequence. `check:built` gates the actual `tsci check` error count and the Gerber shorts result, since a zero CLI exit code alone is insufficient.

The ground regression follows source traces and internal pin connections rather than matching labels or cached connectivity keys. It checks both GND declarations, 18 required ground pins, pour net assignments, and separation from the positive supply rails. Removing the new ground join makes the test fail. The same ground assertion runs against the fully routed board. It also checks both current-sense channels and all four motor-output connections and verifies that the four outputs remain distinct.

## Additional integration changes

- Route the fault-feedback network before the motor outputs, then route the remaining connections.
- Route A− before the other motor outputs, then use a 0.20 mm routing clearance in the remaining motor-output phase to preserve trace width and pad clearance.
- Define the B-channel current-sense escape with an explicit via; the original 0.10 mm DRC rules remain in force.
- Enlarge the controller schematic sheet to 310 mm width so the latest renderer keeps the ground label and trace within its border.
- Pass the existing `routingDisabled` option through to the board.
- Enable TypeScript to resolve the existing JavaScript stock-audit module.

## Validation status

The final build has **0 embedded DRC errors, 0 independently rerun routing errors, 0 `tsci check` errors, no detected Gerber shorts, and 7 passing tests**. Warnings remain listed in the reports.

See `reports/validation.json` and `reports/verification.md` for the final build result and limitations. Publication uses `tsci push --include-dist --compress` to upload the source and verified build.

The original release's README and inventory audit are retained in `reports/` as historical records. They are not current stock checks or approval to fabricate this revision.