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

  • 1x ESP32 38-pin wide dev board, such as the Dorhea ESP32-DevKitC WEOOM-32U on Amazon

  • 1x Screw terminal breakout board for that ESP32, such as this one on Amazon

  • 1x 16x2 backlit character LCD display with I2C backpack (i.e. PCF8574T) such as this one on Amazon

  • 1x 4-channel bi-directional 3.3v/5v level converter such as one of these on Amazon

  • 1x clockless 12mm WS2812-type addressable RGB LED; I’m currently using ones clipped out of a string of these Amazon waterproof 5V LEDs just because I had a bunch of them on hand.

  • 1x 3.3v controlled optoisolated relay module to switch up to 10A; I’m currently using one of these from Amazon

  • 1x 16mm red LED-backlit momentary pushbutton with flip-up transparent shield/cover. I specifically use the MPJA 34155 SW pushbutton and the now-discontinued MPJA 34167 SW transparent shield but any standard SPST or SPDT momentary pushbutton will work as long as its LED can be driven directly by 3.3VDC.

  • 1x wiegand protocol 3.3-5VDC RFID reader with a card present output. I’m currently using this item from the e_goto Processors Store on AliExpress that ships directly from the manufacturer in China. The only important part about this specific item is it’s a fairly rare unit that can work directly on 3.3VDC with 3.3V communication, so it doesn’t require an additional two channels of level converter. Also, it has a CST line that’s pulled high when a RFID tag is within range of the reader.

  • 1x GX16-8 locking connector pair, such as MPJA 32426 PL.

Wiring

This is intended to work with esphome-configs/2024.6.4/no-current-input.yaml.

Wiring diagram of system
  • 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

  • GX16-8 (8 pin) 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 bakelite housing that accepts those pins. Note that GX16-8 connectors have an alignment notch, a ring of 7 contacts, and one central contact. Contacts are numbered 1-7 clockwise from the alignment notch with 8 in the center.

    • 1 to +5VDC power in (red)

    • 2 to power supply ground (black)

    • 3 to relay input / common (green)

    • 4 to relay output Normally Open (green or brown)

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

    • 6 to ESP32 GPIO14 for future use (white)

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

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

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.

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