A self-contained, procedurally-synthesised drum machine for the ESP32. Every sound is generated on-chip in real time — no samples, no SD card. Twist two knobs to change tempo and pattern; watch a live 16-step sequencer on an OLED.
Heltec / generic ESP32 + MAX98357A I²S amp + SSD1306 OLED + 2 pots
No Arduino IDE required. Open the web flasher in desktop Chrome or Edge, plug your ESP32 in over USB, and click install:
(Powered by ESP Web Tools via the Web Serial API.)
- 12 patterns across 4 sound kits —
STD,DARK,GLCH(glitch),ALTN(alien) - 3 voices per pattern: kick, snare, hi-hat — all synthesised with exponential-decay envelopes and noise
- 20–200 BPM, live tempo control with adaptive smoothing
- 16-step sequencer rendered on a 128×64 OLED with a moving playhead
- Dedicated audio task pinned to core 0 for glitch-free I²S playback
| Input | Function |
|---|---|
| Pot A (GPIO 36) | Tempo (20–200 BPM) |
| Pot B (GPIO 39) | Pattern select (1–12) |
| OLED | Step grid + BPM / kit readout |
| Component | Signal | ESP32 GPIO |
|---|---|---|
| SSD1306 OLED (I²C) | SDA | 21 |
| SCL | 22 | |
| MAX98357A (I²S) | BCLK | 26 |
| LRC / WS | 25 | |
| DIN | 27 | |
| Tempo pot | wiper | 36 (ADC1_CH0) |
| Pattern pot | wiper | 39 (ADC1_CH3) |
Wire each pot's outer legs to 3V3 and GND, wiper to the listed GPIO. The MAX98357A drives a small 4–8 Ω speaker.
Requires the Arduino IDE (or arduino-cli) with:
- esp32 board package by Espressif (core 3.x)
- U8g2 library by oliver (Library Manager)
arduino-cli compile --fqbn esp32:esp32:esp32 esp32_drumachine_new_nd_good.ino
arduino-cli upload --fqbn esp32:esp32:esp32 -p COM5 esp32_drumachine_new_nd_good.inoNote:
setup()runs a one-time pot diagnostic that prints 300 ADC readings to the serial monitor at 115200 baud before the sequencer starts. Open the serial monitor and turn the pattern pot to verify it's wired correctly.
esp32_drumachine_new_nd_good.ino # the sketch
docs/ # GitHub Pages web flasher
├── index.html # ESP Web Tools install page
├── manifest.json # firmware manifest
└── firmware/drumachine-esp32.bin # merged 4 MB flash image
MIT — see LICENSE.