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-controller

In 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.

firmware/status_led.py

"""Discrete common-cathode RGB status LED; GPIO10=R, GPIO25=G, GPIO18=B.

The diagnostic console never signals motor operation. Green means a verified
PD contract, not that the motor is enabled or the board is hardware-qualified.
"""

COLORS = {
    "off": (0, 0, 0),
    "waiting": (0, 0, 1),
    "negotiating": (0, 0, 1),
    "pd_ready": (0, 1, 0),
    "commanding": (0, 1, 1),  # Knob app only: PWM enabled, not measured rotation.
    "fault": (1, 0, 0),
}


class StatusLed:
    def __init__(self, pin_factory):
        self.pins = tuple(pin_factory(n, pin_factory.OUT, value=0)
                          for n in (10, 25, 18))

    def show(self, state):
        # An unknown state must never leave a stale green ready indication.
        color = COLORS.get(state, COLORS["fault"])
        for pin in self.pins:
            pin.value(0)
        for pin, value in zip(self.pins, color):
            pin.value(value)

    def off(self):
        self.show("off")