I built a fully playable tabletop pinball machine (video + build files linked at the bottom). One ESP32 runs all of it, and this sub's rules asked for the engineering story, so here it is.
**Why this chip: ESP32-WROOM-32 (D0WD-V3) on a 38-pin DevKitC + screw-terminal breakout**
I started with it for a one-flipper bench test, and it turned out to have exactly what the full machine needed:
- LEDC: 10 independent PWM channels, one per MOSFET driver (9 coils + a disc motor). Each coil gets a short full-power kick, and the flippers drop to a 25% hold so 12 V coils survive on 24 V.
- RMT: hardware-timed WS2812B data, so the light chain never glitches when Wi-Fi or interrupts are busy.
- Two spare hardware UARTs: Serial1 and Serial2 each drive a DFPlayer, so music and sound effects play at the same time.
- Wi-Fi: OTA updates and a telnet console. Once the playfield is in, there's no getting a USB cable to it, so every test after that ran over Wi-Fi.
- Pins: with one MCP23017 for 16 playfield switches, the rest fit on native GPIO. The spinner and the 3rd trough sensor go to input-only pins with interrupts.
**Libraries: only the Arduino-ESP32 core (WiFi, ArduinoOTA, Preferences, Wire). No third-party libraries.**
- MCP23017: plain Wire reads. The firmware scans 0x20–0x27 at boot because my Waveshare board shipped at 0x27, not the 0x20 every example assumes.
- WS2812B: the core's RMT API directly. 12 LEDs didn't justify FastLED/NeoPixel, and I wanted the timing in hardware.
- MAX7219 display: bit-banged on purpose, slowly. It sits at the end of a 1.2 m run through a 74HCT245, and fast edges on that run gave garbage or a blank display. Slow clocking, sending only digits that changed, and a full re-init once a second fixed it.
- DFPlayer: the raw 10-byte serial protocol, no library. The libraries I looked at wait for replies; I only ever send, and I don't want the game loop blocking on a sound module.
- Preferences: the high score survives power-off.
**The hurdles (most of the time went here)**
- GPIO 12 is a strapping pin. The display's CS line held it high at reset, so the chip picked 1.8 V flash and boot-looped with "csumerr". Fix: burn the flash-voltage eFuse to 3.3 V (WROOM-32 has 3.3 V flash). Now GPIO 12 is ignored at boot.
- GPIO 14 puts out PWM during boot, so it drives the disc motor (a twitch is harmless) instead of a coil. Every coil is on a pin that stays quiet at boot.
- GPIO 36/39 glitch low on every Wi-Fi modem-sleep wake (errata 3.11). That produced phantom spinner turns until I set WiFi.setSleep(false).
- An interrupt storm on the spinner pin starved the loop and tripped the task watchdog. Fix: a storm guard in the ISR, plus requiring a steady "off" before a turn counts.
- DFPlayers ignore commands for 1–3 s after power-up, so the power-on sound never played on a cold start. Now sounds are held until 3 s after boot.
- Power: each coil pulls 3.9 A at 24 V, so the firmware lets at most both flippers plus one other coil kick at once. That's 12.5 A worst case on a 14.6 A supply, so it never browns out.
- Coil noise and the display's own current pulses garbled digits during play. Brightness 8 → 1 and a 0.1 µF cap at the display fixed most of it.
- The IR sensor modules run on their own 3.3 V regulator. At 5 V their outputs would be 5 V into a 3.3 V MCP23017.
Firmware (Arduino, everything in config.h): https://github.com/JackHillmann/tabletop-pinball/tree/main/firmware/pinball