Skip to content

Research: custom PCB to replace the COTS parts assembly in the MAC MCU boxes #208

In progress

Description

@jantman

Goal

Research and recommend a custom PCB that replaces the off-the-shelf (COTS) assembly inside the V1 MCU box. This is research, not a finished design. The deliverable is a design/research document, not a PR with a finished board (unless the board turns out to be trivially scoped).

The PCB's size, connectors and mounting will drive a separate hardened enclosure for movable tools that may be used outdoors (Trello card "Design hardened MAC MCU enclosure for movable tools"). Settle size, connector choice, mounting and environmental constraints first, and state them early in the doc so the enclosure work can start from them. Related build-out work is tracked in the Trello card "Finish assembling MAC MCU RFID boxes".

Why

The current MCU boxes are prototypes: off-the-shelf modules wired together by hand. 5 units are deployed now, and at least as many more are planned. If DM is going to keep building these, it's time to design a PCB and have a run manufactured. The motivation is repeatable, lower-effort manufacturing at that scale, not fixing a specific hardware fault.

Current hardware (V1)

Source: docs/source/hardware.rst (component table and wiring), hardware/v1_mcu/README.md, esphome-configs/2025.11.2/no-current-input.yaml. Prices are the November 2025 figures from that table.

Part Function GPIO / interface Approx. cost
ESP32-DevKitC 38-pin (WROOM-32D) on a screw-terminal breakout MCU, WiFi, runs ESPHome n/a $5.66 + $8.13
Wiegand RFID reader (3.3-5V, has CST card-present line; needs S2 solder blob for Wiegand) Card/fob read D0 GPIO16, D1 GPIO4, CST GPIO18 $6.26
16x2 I2C LCD (PCF8574T), 5V Status display SDA GPIO22, SCL GPIO23 (via level converter) $3.99
4-ch 3.3V/5V level converter LCD I2C and Neopixel data shifting n/a $0.75
WS2812 12mm RGB LED Status LED GPIO27 (via level converter) $0.32
3.3V opto-isolated relay module, up to 10A, NO output Primary load switch GPIO33 $1.29
16mm LED-backlit red momentary pushbutton ("Oops") Oops / E-stop request switch GPIO32, LED GPIO5 $5.49
M12 8-pin A-code connector (prewired) plus mating 2 m cable Power, relay contact, tamper, 2nd relay, current-clamp pins see pinout below $9.80 + ~$15.49
3D-printed enclosure and laser-cut card holder Housing n/a $9.90

Control box sub-total in the docs: $67.08. Optional external parts: 5VDC 2.5A supply ($12.90), 30A relay ($9.79), 25A SSR ($7.49), 40A 240V 2-pole contactor ($11.99), 6x6x4" junction box ($19.26), cord lock ($14.98).

M12 pinout (docs/source/hardware.rst): 1 +5VDC in, 2 GND, 3 relay common, 4 relay NO, 5 GPIO12 tamper switch (not implemented in software), 6 GPIO14 second relay (used by second_relay support, see specs/002-second-relay-support), 7 and 8 reserved for current clamp (not implemented).

Design intent in V1: the box only switches low-current control signals (M12 contacts are rated 2A). Motors and other high loads go through an external relay/contactor in a junction box.

Unit count (from Jason): 5 deployed, at least 5 more planned. Size the board run for roughly 10–15 units plus spares.

Mains switching is out of scope. By design, the MCU box switches only a low-current control signal; mains switching lives in an external unit fabricated per machine. The PCB does not need to handle mains voltage or tool load current.

Related notes from existing docs (secondary)

These are not the reason for the PCB, but are worth a sentence each where a board design choice touches them:

  • Relay/output state at boot and brown-out (GPIO12 is a strapping pin used for tamper on M12 pin 5): the board's output driver should fail safe (off).
  • docs/2026-05-05-mcu-lockup-analysis.md and docs/2026-05-11-mcu-lockup-analysis.md (lockups; root causes were firmware/server): note whether a supervisor/watchdog is cheap to include, without making it a goal.
  • M12 pins 5–8 (tamper, second relay, current clamp) are defined but unused or optional in the base build; decide which to break out.

Questions the research must answer

Answer each with a recommendation and the reasoning. Mark what could not be confirmed.

  1. Size, mounting, connectors (answer first, for the enclosure effort): board outline, keep-out for the LCD/reader/button/LED positions, mounting hole pattern, and a connector set that survives vibration and being moved (M12 A-code 8-pin is the V1 choice; evaluate keeping it vs. other options for outdoor/IP use). Give a target IP rating and temperature range, and say how these affect part choice.
  2. MCU module: keep the ESP32-WROOM-32D, or move to ESP32-S3 / a newer module? Consider ESPHome support level and the "minimal firmware changes" constraint, supply availability, and the 4 MB flash and OTA needs. Chip must be assemblable by the PCB service.
  3. RFID reader interface: keep a Wiegand reader as a separate module on a header, or put a reader IC (for example PN532/RC522/other) on the board? Note the V1 reader is a rare 3.3V-capable AliExpress part with a solder-blob mode setting. Check availability, antenna placement vs. enclosure lid and any metal tool body, and whether Wiegand remains compatible with the current ESPHome config.
  4. Display, LED and button: LCD with I2C backpack and level shifting vs. alternatives (OLED, 3.3V LCD) that remove the level converter. WS2812 data level at 3.3V. Keep the backlit 16mm "Oops" button and its 3.3V-drivable LED.
  5. Output switching: the on-board output only drives the external per-machine switching unit (low-current control signal, M12 contacts rated 2A), as V1 does. Choose a small relay vs. SSR/optocoupled output for that signal, with flyback, contact rating for the external unit's coil, and fail-safe state. Mains switching and tool load ratings are out of scope.
  6. Power input: low voltage only (V1 takes external 5V via M12 pins 1/2). Keep it low-voltage; no mains on the board.
  7. Protection: input reverse polarity, TVS, polyfuse/fuse, ESD on the external connector and the reader/button lines, brown-out/UVLO, isolation of the relay side, and surge/noise from motor loads close to the board.
  8. Current sensing for tool-in-use detection: M12 pins 7 and 8 are reserved for a current clamp but not implemented. Decide whether to include an ADC/CT interface, what sensor type, and whether it is worth doing now . Check esphome-configs/ for the no-current-input.yaml naming; there is no current-input config yet.
  9. Programming and debug: USB-C or tag-connect/header for first flash, boot/EN access, UART logging. Check that OTA remains the production path (docs/source/hardware.rst ESPHome section).
  10. Firmware compatibility: keep GPIO assignments from esphome-configs/2025.11.2/no-current-input.yaml where possible so the existing config works unchanged. List every pin that would change and the exact config diff. Do not change firmware; propose only.
  11. DFM and ordering: JLCPCB/PCBWay assembly (basic vs. extended parts, single vs. double-sided, panelization), cost per board at roughly 10–15 units plus spares, and at a larger run for comparison, lead time, and any part with supply risk. Keep a hand-solder path for the through-hole or module parts.

Deliverable

A research doc in the repo, following the repo's feature-doc process: docs/features/<name>.md per docs/features/README.md and docs/features/template.md (for example docs/features/custom-mcu-pcb.md). If a feature plan is the wrong container for research only, say so in the doc and ask Jason before using another location. The doc includes:

  1. Constraints for the enclosure effort (size, mounting, connectors, IP, temperature), up front.
  2. A recommended architecture and a block diagram description (text or Mermaid; no stale tree diagrams).
  3. A draft BOM with manufacturer part numbers, distributor part numbers, and current prices looked up (with the date and source), not estimated.
  4. A rough cost comparison against the V1 COTS assembly ($67.08 control box sub-total in docs/source/hardware.rst), at roughly 10–15 units.
  5. Firmware impact (pin map diff).
  6. Open questions for Jason.

Optional: a KiCad project skeleton under hardware/ only if the repo's hardware/ layout calls for it. The existing hardware/v1_mcu/ holds a Fritzing file (Hardware_v1.fzz) and OpenSCAD enclosure files, with no KiCad convention yet, so propose a layout (for example hardware/v2_mcu/) rather than creating it unprompted.

Constraints

  • This is a public repo. No home-network or personal details (hostnames, internal domains, IPs) in the doc.
  • Read and follow CLAUDE.md and docs/features/README.md. Documentation style should match the existing docs. If the feature process requires milestones and human approval, follow it.
  • Ask Jason before ordering anything or changing firmware. No purchases, no sample orders, no ESPHome config changes as part of this research.
  • Mark every fact you could not confirm.

Related

  • Trello card: "Design hardened MAC MCU enclosure for movable tools"
  • Trello card: "Finish assembling MAC MCU RFID boxes"
  • specs/002-second-relay-support, docs/2026-11-21-oops-clear-power-on-analysis.md

Activity

  1. added
    robot-army
    on Nov 25, 2026
  2. jantman commented on Nov 25, 2026

    @jantman
    ContributorAuthor

    🤖 robot-army dispatched a session for this issue.

    • Host: phoenix.jasonantman.com
    • Session: ra-machine-access-control-208
    • Session id: 9cb9b0bb-7631-4169-9143-a615e60997ec
    • Branch: robot-army/issue-208-research-custom-pcb-to-replace-the-cots
    • Worktree: /home/jantman/worktrees/machine-access-control/issue-208
  3. jantman commented on Nov 28, 2026

    @jantman
    ContributorAuthor

    🤖 robot-army reassigned this issue to a new session (attempt 2).

    • Host: phoenix.jasonantman.com
    • Session: ra-machine-access-control-208
    • Session id: f4edbe9e-2407-432c-a684-3974a9baa824
    • Continues: 9cb9b0bb-7631-4169-9143-a615e60997ec (that session's context was restored)
    • Branch: robot-army/issue-208-research-custom-pcb-to-replace-the-cots
    • Worktree: /home/jantman/worktrees/machine-access-control/issue-208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    robot-army

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions