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.
docs/encoder-and-rearm.md
# Encoder interface and re-arm review — 13 November 2026
This hardware revision adds a motor-feedback connector and a hardware re-arm
interlock. It retains the 91 × 90 mm outline, four corner mounting holes,
top-side assembly, screen/button arrangement, upward POWER switch and four
150 µF / 50 V capacitors. Routing and fabrication validation are recorded in
`review-validation.md`; this document specifies the interface and behavior.
## J20: one external encoder or Hall sensor
An encoder is a separate sensor attached to the motor shaft, or already built
into the motor. Its A/B outputs produce pulses as the shaft turns. Counting
them measures movement, their order indicates direction, and their rate can
be used to calculate speed once the encoder's counts per revolution are known.
Z is an optional once-per-turn reference. It is not the SPEED potentiometer.
The board has the **connection for an encoder**, not an encoder mounted on it.
J20 is the connector (C265104), and U14 is the SN74LVC3G17 input buffer
(C68245). The project's own AS5047P encoder board now plugs into J20; its rear-shaft mount and supply margin still require qualification. See `encoder-board.md`. For example, turning
the shaft faster produces pulses more often; the RP2040 can count them and
future application firmware can display the calculated RPM on the OLED.
The native system diagram source is `circuit/system-diagram.tsx`. View its
encoder page at `dist/system-diagram/encoder_feedback.svg`, or run
`bun run diagram` to regenerate all three pages. The normal board entrypoint
also contains these pages with links to the actual PCB components.
J20 is a side-entry JST PH five-position header, S5B-PH-SM4-TB(LF)(SN), C265104. Its mating opening faces the right enclosure wall; the plug inserts horizontally toward the PCB.
Use the numbered connector drawing, not wire colors, to assemble the cable.
Its matching housing is PHR-5 with compatible PH crimp contacts selected for
the actual wire gauge. The mating cable is not included in the PCB BOM.
| Pin | Signal | Connection |
| --- | --- | --- |
| 1 | ENC_3V3 | Fused 3.3 V auxiliary **output**, provisional 20 mA maximum load |
| 2 | GND | Common signal ground |
| 3 | A / H1 | Quadrature A or first Hall input; RP2040 GP20 |
| 4 | B / H2 | Quadrature B or second Hall input; RP2040 GP21 |
| 5 | Z / H3 | Optional index or third Hall input; RP2040 GP7 |
For an A/B encoder without an index, leave pin 5 unconnected. For a 5 V sensor,
power the sensor separately and leave pin 1 disconnected; connect grounds.
The three signal inputs accept single-ended 0–3.3 V or 0–5 V logic. Open-collector
outputs use onboard pullups. This is not an RS-422 differential receiver or a
12/24 V industrial input, and encoder and Hall modes cannot be used simultaneously.
Check the chosen sensor's output thresholds, edge rate, pinout, cable length and
supply requirement before connecting it.
Each input has connector-side ESD protection, a 1 kΩ series resistor, 100 pF
filter and a 3.3 V powered SN74LVC3G17 Schmitt buffer. The buffer accepts 5 V
inputs and supports partial-power-down isolation. D10 isolates the 10 kΩ pullup
bus from the board supply when an externally powered sensor remains connected
while the board is off. This circuit does not constitute board-level IEC ESD
qualification; cable transients and powered/unpowered behavior require testing.
F2 is a 100 mA hold-current resettable fuse, not a precise 20 mA regulator. The
20 mA auxiliary allocation is a conservative design allowance. Its published
15 Ω maximum post-trip resistance can drop 0.30 V at 20 mA; verify the sensor's
minimum supply voltage and the installed fuse's drop. No 5 V supply is provided
on J20. Start input qualification at no more than 20 kHz per channel; this is a
test target, not a guaranteed interface bandwidth.
`firmware/feedback.py` is a motor-disabled, slow manual-spin diagnostic. It
shows A/B counts, direction, invalid transitions and the current Z level. It is
not a high-speed counter or commissioned closed-loop controller. Hardware PIO
counting and index/Hall processing remain firmware work for the selected sensor.
The MCF8329A still performs **sensorless FOC internally**. The encoder goes to
the RP2040 for measurement; wiring J20 does not make the MCF use encoder angle
for commutation. An outer speed/position controller would require separate
firmware and validation. Sensored commutation would require a different drive
architecture.
## Fresh ARM press after POWER OFF
SW4's second pole now grounds the asynchronous reset input of U15 whenever
POWER is OFF. U15 is a Nexperia 74LVC1G74DP,125 flip-flop. U16 also holds it reset
during 3.3 V startup/brownout. Its complemented output drives Q9, which clamps
the existing ARM_BASE signal while re-arm permission is absent.
A fresh press of the existing physical ARM button clocks U15 through Schmitt
inverter U17. The MCU's MOTOR_ARM signal and the existing PD inhibit remain
independent conditions for enabling the driver. The latch is deliberately not
clocked by MOTOR_ARM: the old application drops that signal at zero dial speed,
and raising speed again must not substitute for a fresh ARM press.
Expected sequence:
1. Power up: motor disabled; an ARM press is required.
2. Press ARM with valid power and an eligible MCU command: operation is permitted.
3. Slide POWER OFF: hardware disables the motor and resets permission.
4. Slide POWER ON, even quickly: permission stays reset.
5. Release and press ARM again: permission can be set again.
Holding ARM through OFF→ON, or pressing it while OFF, does not supply a fresh
edge after reset release. MCU disable and PD inhibit can still stop the motor.
This is an operational interlock, not a certified safety function or emergency
stop. Reset pulse widths, switch bounce, held-button transitions, brownout and
motor behavior still need fault-injection testing on real hardware.
Nexperia specifies Schmitt behavior on all U15 inputs. Do not substitute another
74LVC1G74 manufacturer without rechecking input transition requirements for the
RC reset node. U16 is the 2.93 V threshold TLV803S variant with its specified
reset delay; do not silently substitute another threshold/suffix.
## Firmware and remaining review findings
The 27 November firmware update adds the MCF8329A readback adapter and validates
its own register fields before allowing the existing knob/ARM runtime to drive.
The earlier MCT driver remains reference code. `motor_setup.PROFILE=None` keeps
the shipped application in preview-only mode until motor-specific settings and
measured ADC calibration are supplied. See [knob firmware](knob-firmware.md).
Thermal thresholds, screen/menu behavior and physical motor commissioning remain
separate work; encoder wiring and host tests do not establish those behaviors.
TMP102 measures board temperature near the bridge, not the motor winding.
The transistor-driven buzzer remains fitted. Neither feature proves that
thermal protection is commissioned. The provisional motor-feed policy is 0.8 A (5 V) and 2.4/2.6/2.7 A
(9/15/20 V); it is not a phase
current rating, and the MOSFET's 46 A headline is not a board rating.
Before manufacture/operation, confirm OLED supports/header height, sensor cable,
3.5 mm female to 4 mm male motor adapters and actual factory parts allocation.
On the prototype, verify all six gate waveforms, startup at each PD voltage,
5 V driver headroom under load, calibrated current limits, braking/backdrive
bus rise, capacitor ripple and temperatures. The capacitor bank stores transient
energy; it does not dissipate sustained regenerative braking power. The input
blocking path prevents assuming USB will absorb that energy.
## Primary references
- [TI MCF8329A](https://www.ti.com/lit/ds/symlink/mcf8329a.pdf)
- [TI SN74LVC3G17](https://www.ti.com/lit/ds/symlink/sn74lvc3g17.pdf)
- [Nexperia 74LVC1G74](https://assets.nexperia.com/documents/data-sheet/74LVC1G74.pdf)
- [TI TLV803](https://www.ti.com/lit/ds/symlink/tlv803.pdf)
- [TI SN74LVC1G14](https://www.ti.com/lit/ds/symlink/sn74lvc1g14.pdf)
- [TI TPD4E05U06](https://www.ti.com/lit/ds/symlink/tpd4e05u06.pdf)
- [JST PH series](https://www.jst-mfg.com/product/pdf/eng/ePH.pdf)