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.
README.md
# RP2040 BLDC controller — 1.54-inch I²C OLED
The main BLDC controller now uses the BuyDisplay ER-OLED015-2W (SSD1309, native I²C) with its stock 36 mm flex. No I²C-to-SPI bridge is used.
The 27 November power-circuit revision adds hardware power-loss detection, an isolated logic reservoir, reset-safe display-power control and I²C isolation. J21 uses Molex **5034802400 / C122434**. Its ribbon-width fit is still unqualified, and its imported CAD conflicts with the mating drawing. Supply sequencing requires oscilloscope validation. See [the current shutdown and connector review](docs/oled-shutdown-trial.md).
The 30 November revision improves startup margin and speeds display-supply discharge using an adjustable U24 threshold, revised R181/R182/R185, a smaller C183 and new R192/R193. C191 remains 3300 µF / C52711639. See [the power-margin revision and prototype measurements](docs/oled-power-margin-revision.md). Current release checks are in `dist/oled-margin-release/`; earlier report folders remain historical evidence.
The original base and 5.8 mm PCB supports are restored, retaining the usual M3 × 5.7 mm inserts / M3 × 8 mm screws. The floor is 2.4 mm thick and exterior height stays 28.6 mm. See [enclosure hardware](enclosure/README.md). The enclosure has a shared, chamfered USB opening sized for the modeled 12 × 6 mm plug heads. The display sits 0.8 mm below the existing flat roof in a removable screen door, so its flex is plugged in from above after the lid is closed. A thin rear frame fastens upward into blind door inserts; two M2 screws hold the door from the top (30 November change, modeled only: see enclosure hardware). ARM, UP, DOWN, OK, BACK, RESET and BOOT share one row; RESET and BOOT sit behind 2 mm paperclip pinholes with no caps (1 December change, modeled only: see enclosure hardware). Labels use printable sticker artwork. The encoder, speed dial, side POWER lever, 91 × 90 mm PCB outline and 28.6 mm roof height retain their positions/dimensions.
See [display design and qualification notes](docs/oled154-design.md) and [enclosure assembly instructions](enclosure/README.md). `enclosure/dist` contains the STL/3MF/sticker outputs. The preview is at `http://127.0.0.1:4188/` while its local server is running.
All 13 parts that were short of stock at JLCPCB on 2 December 2026 were replaced with parts held in volume there. Eight needed no board change. Five did: Q1 and Q2 (with R3), U24 (new package), J21 (HDGC 0.5K-HX-24PWB / C2919499 in place of the Molex part named above) and U3 (adjustable AP63200 with two added 0402 feedback resistors, R194 and R195, and a 6.8 µH L1). Everything stays on the top side. Not built or tested. See [part substitutions](docs/part-substitutions.md).
This is a prototype, not a fabrication release. Ribbon bend radius/contact compatibility, printing tolerances, display power sequencing, motor operation and thermal performance still require physical qualification. Earlier V2 validation documents describe the baseline and do not qualify this revision.
To inspect the current PCB locally:
```sh
bun run typecheck
bun run build:pcb
bun scripts/check-routed.mjs dist/pcb/circuit.json
bun scripts/check-v2-hardware.mjs dist/pcb/circuit.json
bun run dev
```
The following sections are retained V1 engineering history, not V2 dimensions
or validation results.
Battery-free controller for the Readytosky 2212 920KV motor. **J19 PWR supports selected 5, 9, 15 or 20 V / 3 A PD contracts; 9 V remains the cold-start default. J1 DATA connects to the computer.** The illustrated motor is retained for the default setup; select a voltage appropriate to the connected motor. The two USB cables can be connected together. There is no battery, battery charger, balance connector or external temperature probe.
Power flows through the PD input switch, current shunt, fuse F1, ideal diode U12/Q7 and power switch U11 to the motor bridge. U11's own limit is set above the 3 A contract (R142 = 680 Ω, 3.63 A nominal, 3.06–4.22 A), so it only guards against inrush and short circuits and does not cap the motor. Motor current is limited in software: the firmware motor-feed ceilings (2.4 A at 9 V, 2.6 A at 15 V, 2.7 A at 20 V, in `firmware/power_policy.py`) and the MCF8329A ILIMIT setting. U12/Q7 replace the lossy D3 diode and block motor energy from returning to USB. SW4 OFF removes motor power and clamps ARM while USB communication remains available. Voltage selection requires SW4 OFF and a discharged motor bus.
At 5 V the motor driver still needs at least 4.5 V at its pins. Cable and board losses limit usable load. The prototype policy uses a provisional 0.8 A motor-feed input ceiling and a 4.65 V measured motor-bus cutoff; neither is a validated motor rating. Use calibrated voltage readings. The supplied bring-up console deliberately keeps motor drive OFF at every setting. **The configurable-PD changes were applied to main with user approval on 16 October 2026; 5 V motor operation remains unqualified and awaits maintainer review.** The U11-only replacement evaluation did not resolve the voltage margin, so the existing U11 is retained. See [current revision](manufacturing/CURRENT-REVISION.md).
All fitted components are on the top of a **73 × 72 mm, four-copper-layer PCB**. J10/J11/J12 are outward-facing AMASS 24.243.4 sockets. The motor's original 3.5 mm male bullets plug into three purchased 3.5 mm female / 4 mm male rigid adapters, then into those sockets. RV1 speed, SW3 ARM, SW1 BOOTSEL and SW2 RESET are onboard. Sixteen copper test pads provide service access.
The separate connected-system assembly includes the PCB, motor, original motor leads, rigid adapters, a PD-power USB cable and a computer-data USB cable. USB source/host enclosures and cable lengths are representative. Exact motor-lead and adapter-body dimensions remain unverified; this view does not prove physical mating.
The compact layout saves **12.5% board area** compared with the previous 77 × 78 mm outline, and **27.0%** compared with 80 × 90 mm. See [layout changes](docs/compact-layout.md).
## Build and inspect
Run `bun run dev` and open **3D** for the enclosed connected assembly. Use `tsci dev pcb.circuit.tsx` for the PCB alone or `bun run dev:connected` for the assembly without the shell.
The enclosure fits the 91 × 90 mm board with a shallow 1.54-inch OLED, seven aligned controls, a fitted SPEED knob, side POWER lever, shared USB recess and right-facing encoder connector. Its footprint is 104.4 × 103.4 mm and body height is 28.6 mm. The base is 130.4 × 103.4 mm across its two mounting flanges (added 2 December 2026, four 4.5 mm screw holes; see the enclosure notes). The eight lid cooling slots are removed; base slots and buzzer openings remain. See [hardware and fit notes](enclosure/README.md) and the six [current STL designs](assets/enclosure).
```sh
bun run check
bun run enclosure:build
bun run enclosure:verify
bun run build:package
bun run dev
```
`bun run build` builds the PCB and default enclosed package. `bun run build:all` additionally regenerates the connected assembly and enclosure artifacts; see the enclosure notes for its Python dependencies. `dist/pcb/circuit.json` is the independent PCB baseline. `dist/index/circuit.json` adds the external assembly and eleven native printed parts and sticker artwork. The integration guard compares all PCB, schematic and electrical connection records against that baseline. `circuit/route-plan.json` remains guarded against changed pads, nets or rules. A passing report applies only to its recorded inputs.
The main project uses the latest published tscircuit release and its normal dependency tree, with
no internal dependency overrides or CLI patches. `bun.lock` records the
installed versions; run `bun update tscircuit --latest` to refresh them.
The old upload-timeout/ignore-list patch is no longer applied. The integrated
assembly remains in `assets/connected-system.glb`.
A motor encoder board for J20, made as a snap-off piece of the controller, is described in [docs/encoder-board.md](docs/encoder-board.md). It is not fabricated or tested, and its motor holder still needs the motor's rear shaft measured.
Publish only when requested, using `bun run push:package`. It first packs the inputs above the registry's per-file limit into `.gz` copies (see docs/registry-build.md), then runs `bunx tsci push --compress --include-dist`. The canonical package is `@tsci/MustafaMulla29.rp2040-bldc-motor-controller`; hardware revisions belong in the package version, not its name.
## Engineering status
**Hold the current manufacturing order.** The 12 October follow-up fixes the R81 Kelvin routing and U11 native paste size. U7 now exports six native rectangular paste windows; factory stencil/process approval remains required. See the [order-readiness review](docs/order-readiness.md). Passing PCB DRC and configured width checks does not approve fabrication or motor operation.
The change is a design prototype, not a bench-qualified motor controller. The PD diagnostic firmware provisions a 9 V default and selects/checks 5/9/15/20 V over USB DATA while keeping the motor OFF. The separate `firmware/knob_app.py` now implements knob/ARM control, filtered/ramped PWM commands and calibrated power/current supervision. It ships in preview-only mode until a commissioned motor profile and measured ADC calibration are supplied. Motor tuning, coast-stop/AVS behavior and physical testing remain outstanding; no working motor operation is claimed. D4 is a transient suppressor, not a continuous regenerative braking load. See [knob firmware](docs/knob-firmware.md) for operation, commissioning and limitations.
See [connections and firmware](docs/connectors-and-firmware.md), [PD-only design](docs/pd-only-design.md), [assembly](docs/full-assembly.md) and [manufacturing status](docs/order-readiness.md). Previous battery-revision files are backed up outside this package.
Validation results and the remaining native style advisories are recorded in [validation](docs/validation.md).
The onboard **RGB STATUS** LED beside ARM uses blue for PD waiting/negotiation,
green for a verified selected PD contract and red for diagnostic errors.
The current diagnostic firmware keeps the motor OFF; green is not a motor-run
indication. See [connections and firmware](docs/connectors-and-firmware.md).