Hardware

The “machine control unit” (MCU) devices use ESP32 microcontrollers; our reference builds use ESP32-DevKitC / ESP32-WROOM-32D boards such as these from Amazon. For reasons described in the introduction we use ESPHome as the software on the ESP32s.

Version 1 Hardware

This describes the initial Version 1 MCU hardware, essentially a prototype assembled from off-the-shelf components and fitted in a 3D printed enclosure.

Components

The following table lists the components required for the Version 1 MCU hardware. Costs are approximate as of November 2025 and may vary, and do not include fasteners, hookup wire, and incidental parts.

Item / Description

Qty

Link

Cost (USD November 2025)

3D Printed Enclosure and Laser Cut Card Holder

1

See Enclosure, below

$9.90

ESP32 38-pin wide dev board [1]

1

Amazon

$5.66

Screw terminal breakout board for ESP32

1

Amazon

$8.13

16x2 backlit character LCD display with I2C backpack (PCF8574T)

1

Amazon

$3.99

4-channel bi-directional 3.3v/5v level converter

1

Amazon

$0.75

Clockless 12mm WS2812-type addressable RGB LED [2]

1

Amazon

$0.32

3.3v controlled optoisolated relay module (up to 10A) [3]

1

Amazon

$1.29

16mm red LED-backlit momentary pushbutton with shield/cover [4]

1

Skycraft Surplus - button and Amazon cover

$5.49

Wiegand protocol 3.3-5VDC RFID reader with card present output [5]

1

AliExpress

$6.26

M12 8-pin A-code male connector, prewired, for control box [6]

1

Amazon

$9.80

M12 8-pin A-code female connector to blunt end wire, 1-3m length as needed [6]

1

Amazon

~$15.49 (2m)

Control Box Sub-Total

$67.08

optional 5VDC 2.5A Power Supply, if needed [7]

Amazon

$12.90

optional 30A relay for high current machine control [8]

Amazon

$9.79

optional 25A solid state relay for high current machine control [8]

Amazon

$7.49

optional 40A 240V contactor 2-pole contactor for 240V machine control [8]

Amazon

$11.99

optional Junction box for housing high current relays/contactors - Carlon E987R 6x6x4” [9]

Home Depot

$19.26

optional Cord lock for plug-in junction box [9]

Amazon (large)

$14.98

Component Notes:

Wiring

This is intended to work with https://github.com/jantman/machine-access-control/blob/main/esphome-configs/2024.6.4/no-current-input.yaml. Note that a standalone (non-networked) ESPHome configuration for verifying the operation of all hardware, along with instructions for using it, can be found in https://github.com/jantman/machine-access-control/tree/main/esphome-configs/2025.11.2.

Wiring diagram of system M12 8-pin A-code connector pinout
  • RFID Reader - Note that if using the same model that I did, you must add a solder blob on S2 for Wiegand output.

    • CST to GPIO18

    • Gnd to ground

    • TX/D0 to GPIO16

    • RX/D1 to GPIO4

    • 3.3-5V to 3v3

  • Level Converter

    • Gnd and Gnd to ground

    • LV to ESP32 3v3

    • HV to ESP32 5v

    • 2 - LV2 to GPIO22; HV2 to LCD SDA

    • 3 - LV3 to GPIO23; HV3 to LCD SCL

    • 4 - LV4 to GPIO27; HV4 to Neopixel D1

  • Pushbutton

    • LED - to Gnd

    • LED + to GPIO5

    • Switch NC to Gnd

    • Switch Com to GPIO32

  • Neopixel

    • 5v to 5v (often red)

    • Gnd to Gnd (often blue)

    • D1 to Level Converter HV4 to GPIO27 (often white)

  • LCD Display

    • Gnd to Gnd

    • VCC to 5v

    • SDA to Level Converter HV2 to GPIO22

    • SCL to Level Converter HV3 to GPIO23

  • Optoisolated Relay - Output is N.O.

    • Gnd to Gnd

    • In to GPIO33

    • VCC to 3v3

  • M12 8-pin A-code connector for power, control, and additional inputs. The MCU should have the female socket which has visible pins in it, and the wire going to it should have the male plug which has a housing that accepts those pins. Note that M12 A-code connectors have an alignment notch, a ring of 7 contacts, and one central contact. On the male connector (the one with pins), contacts are numbered 1-7 clockwise from the alignment notch with 8 in the center. There is also an industry-standard color code for the wires, shown below.

    • 1 (white) to +5VDC power in

    • 2 (brown) to power supply ground

    • 3 (green) to relay input / common

    • 4 (yellow) to relay output Normally Open

    • 5 (grey) to ESP32 GPIO12 for tamper switch (not yet implemented in software)

    • 6 (purple) to ESP32 GPIO14 for future use

    • 7 (blue) reserved for future ammeter / current clamp use (not implemented in V1)

    • 8 (red) reserved for future ammeter / current clamp use (not implemented in V1)

Enclosure

There is an example enclosure for the unit, 3D printed with a few laser cut parts, in the hardware/v1_mcu directory of the GitHub repo. See that directory for information on fabrication and assembly.

ESPHome Configurations

Example ESPHome configurations for various ESPHome versions and various hardware combinations can be found in the esphome-configs/ directory of the git repo broken down by ESPHome version. New installations should always use the newest supported ESPHome version, as bug fixes and features are not backported to earlier versions of these configs.

All of the example ESPHome configurations begin with a substitutions key, which contains a machine_name substitution. This must be set to the same name as used in the machines.json config file. If desired, you can override the esphome name and friendly_name values (though this is not recommended).

The ESPHome configurations are based on a ESPHome secrets.yaml file for substituting in sensitive values and installation-specific values using the !secrets substitution operator. The example configurations expect the following secrets to be defined:

api_encryption_key

this is needed for the ESPHome web UI functionality, like wirelessly streaming logs. See ESPHome docs.

ota_password

A password used for OTA updates from ESPHome. See ESPHome docs.

wifi_ssid

WiFi network SSID to connect to. See ESPHome docs.

wifi_password

WiFi network password. See ESPHome docs.

domain_name

Domain name to use for DNS. See ESPHome docs.

mac_url

the full URL to the /api/machine/update endpoint of the machine-access-control server