Two Arduino Micro boards (ATmega32U4) run the keypad/peripheral I/O:
| Board | FQBN | Sketch | Role |
|---|---|---|---|
| Millennium Alpha | arduino:avr:millennium_alpha |
sketches/keypad |
4x7 keypad, magstripe reader, hook switch |
| Millennium Beta | arduino:avr:millennium_beta |
sketches/display |
VFD display, coin validator, I2C→USB bridge |
See PINOUT.md for complete pin assignments, I2C protocol, and serial command reference.
Pre-built hex files are checked in under build/:
build/keypad/keypad.ino.hex # Flash to Millennium Alpha
build/display/display.ino.hex # Flash to Millennium Beta
These can be flashed directly without compiling:
arduino-cli upload -p /dev/serial/by-id/usb-Arduino_LLC_Millennium_Alpha-if00 \
--fqbn arduino:avr:millennium_alpha --input-dir ./build/keypad
arduino-cli upload -p /dev/serial/by-id/usb-Arduino_LLC_Millennium_Beta-if00 \
--fqbn arduino:avr:millennium_beta --input-dir ./build/display- arduino-cli in your
PATH(or setARDUINO_CLI=/path/to/arduino-cli) - Arduino AVR core:
arduino-cli core install arduino:avr - The custom board definitions must be appended to the Arduino AVR
boards.txt(see Custom Board Definitions below)
make build # Compile both sketches → build/
make install # Flash both to connected Arduinos
make install_keypad # Flash keypad only
make install_display # Flash display only
make clean # Remove build artifactsRecommended: build on macOS, deploy to Pi via GPIO reset
The Pi has direct GPIO reset connections to both Arduinos:
- GPIO17/GEN0 (pin 11) → Arduino Alpha RST
- GPIO27/GEN2 (pin 13) → Arduino Beta RST
The deploy scripts assert reset via GPIO (open-drain: drive low, release to input), wait for
the device to disappear then reappear (the bootloader enumerates under the same custom PID as
the sketch), then flash with avrdude. No uhubctl or 1200-baud tricks needed. Requires
raspi-gpio and avrdude on the Pi. Note: the WDT (4s) limits the bootloader window —
flashing completes well within that window.
./Arduino/deploy_display.sh [user@host] # flash Beta (display)
./Arduino/deploy_keypad.sh [user@host] # flash Alpha (keypad)
# Default host: matzen@192.168.86.145
# Or via make:
make deploy_display
make deploy_keypad
make deploy # flash both (keypad first, then display)If build fails because arduino-cli.yaml has Linux paths: BUILD_CONFIG=0 make build_display. If hex not pushed: VIA_SCP=1.
If arduino-cli is not in your PATH:
make build ARDUINO_CLI=/home/matzen/bin/arduino-cliThe build is reproducible — recompiling from the same source with the same arduino-cli and AVR core version produces identical hex files.
The two boards are Arduino Micro clones with custom USB product names and
PIDs so the Pi can distinguish them via /dev/serial/by-id/. The custom
entries must be appended to:
~/.arduino15/packages/arduino/hardware/avr/1.8.6/boards.txt
Key differences from stock Arduino Micro:
| Property | Stock Micro | Millennium Alpha | Millennium Beta |
|---|---|---|---|
| USB PID (app) | 0x0037 | 0x0045 | 0x0046 |
| USB PID (boot) | 0x8037 | 0x8045 | 0x8046 |
| Product name | Arduino Micro | Millennium Alpha | Millennium Beta |
The full board definition entries are documented in PINOUT.md.
The boards.txt entries reference custom bootloader hex files
(Caterina-Micro-Millennium-Alpha.hex, Caterina-Micro-Millennium-Beta.hex)
that encode the custom VID/PID. These bootloader hex files were never built —
the boards currently run with stock Micro bootloaders that were already flashed
at the factory. The custom VID/PID only takes effect when the sketch is running
(not during the bootloader's 8-second window).
To build custom bootloaders (requires LUFA library and avr-gcc):
cd ~/.arduino15/packages/arduino/hardware/avr/1.8.6/bootloaders/caterina
make VID=0x2341 PID=0x8045 TARGET=Caterina-Micro-Millennium-Alpha
make VID=0x2341 PID=0x8046 TARGET=Caterina-Micro-Millennium-BetaThis requires the LUFA 111009 library
installed at the path referenced in the Makefile
(../../../../../../LUFA/LUFA-111009 relative to the bootloader directory).
Arduino/
├── Makefile # Build and flash targets
├── arduino-cli.yaml # arduino-cli configuration
├── PINOUT.md # Pin assignments and protocol reference
├── build/
│ ├── keypad/keypad.ino.hex # Pre-built keypad firmware
│ └── display/display.ino.hex # Pre-built display firmware
├── sketches/
│ ├── keypad/keypad.ino # Keypad Arduino source
│ └── display/display.ino # Display Arduino source
└── libraries/
├── Keypad/ # Keypad matrix library
└── MagStripe/ # Magnetic stripe reader library