Exact steps to go from zero to a working browser drum machine triggered by your ESP32 over USB.
No extra hardware needed — just your ESP32-M1 DevKit and a USB data cable.
| Item | Notes |
|---|---|
| ESP32-M1 DevKit | Any standard ESP32 DevKit board |
| USB cable | Must be a data cable — charge-only cables will not work |
| Mac or Windows PC | These steps show Mac terminal commands |
| VS Code | Download from code.visualstudio.com if not installed |
| Chrome browser | Web Serial API is Chrome-only — Firefox and Safari won't work |
Do this once. Skip if you already have PlatformIO.
- Open VS Code
- Click the Extensions icon on the left sidebar (4-square icon)
- Search PlatformIO IDE
- Click Install — it's the one published by PlatformIO
- Wait for it to finish. VS Code will prompt you to Reload — do it.
- After reload you'll see a house icon in the left sidebar. That's PlatformIO.
If you have git:
git clone <repo-url>
cd Electronic_Drum_Using_ESP32
git checkout phase-0-mvpOr download the ZIP from GitHub and unzip it.
- In VS Code: File → Open Folder
- Navigate to and open this specific folder:
Open that folder — not the root repo folder.
Electronic_Drum_Using_ESP32/firmware/phase0/ - VS Code detects
platformio.iniand configures the project automatically. - First time: a progress bar runs at the bottom while it downloads the ESP32 toolchain. Wait ~1–2 minutes.
- Plug your ESP32-M1 DevKit into your Mac with a USB cable
- Open Terminal in VS Code: Terminal → New Terminal
- Run:
ls /dev/cu.* - You should see a new entry like
/dev/cu.usbserial-XXXXor/dev/cu.SLAB_USBtoUART
Nothing new appeared? Your cable is charge-only. Try every cable you have — only data cables work.
Open firmware/phase0/platformio.ini and update the port to match what you saw:
upload_port = /dev/cu.usbserial-XXXX ← replace with your port
monitor_port = /dev/cu.usbserial-XXXX ← same valueSave the file.
- Look at the blue status bar at the very bottom of VS Code
- Click the → (Upload) button
- Or:
Cmd+Shift+P→ typePlatformIO: Upload→ Enter
- Or:
- Watch the terminal. It ends with:
==== [SUCCESS] ====
Upload failed? Make sure the port in
platformio.iniis correct and the cable is plugged in.
- In the blue status bar click the plug icon (Serial Monitor)
- Or:
Cmd+Shift+P→PlatformIO: Serial Monitor
- Or:
- You should see:
# ESP32 Drum Kit — Phase 0 ready # Keys: 1=KICK 2=SNARE 3=HIHAT_CLOSED 4=HIHAT_OPEN # 5=TOM_LOW 6=TOM_MID 7=CRASH 8=RIDE - Type
1and press Enter → you should seeKICKprinted back - Test a few more:
2→SNARE,7→CRASH, etc.
Nothing appears? Press the EN/RST button on the ESP32 to reboot it.
You need 8 WAV files. Get them free from sampleswap.org:
-
Go to sampleswap.org → Samples → DRUMS (SINGLE HITS)
-
Download one file from each category:
- Kicks → rename to
kick.wav - Snares → rename to
snare.wav - Hats → rename to
hihat_closed.wav - Hats (different one) → rename to
hihat_open.wav - Toms → rename to
tom_low.wav - Toms (different one) → rename to
tom_mid.wav - Crashes → rename to
crash.wav - Rides → rename to
ride.wav
- Kicks → rename to
-
Place all 8 files here (exact filenames matter):
web_app/phase0/samples/kick.wav web_app/phase0/samples/snare.wav web_app/phase0/samples/hihat_closed.wav web_app/phase0/samples/hihat_open.wav web_app/phase0/samples/tom_low.wav web_app/phase0/samples/tom_mid.wav web_app/phase0/samples/crash.wav web_app/phase0/samples/ride.wav
Any WAV format works. If you want to convert to 22050Hz 16-bit mono: use Audacity → Tracks → Stereo to Mono → Tracks → Resample 22050Hz → File → Export as WAV 16-bit.
The web app must be served over HTTP (not opened as a file) so Chrome allows audio and serial access.
- Open a new terminal (not the PlatformIO Serial Monitor one)
- Run:
cd /path/to/Electronic_Drum_Using_ESP32/web_app/phase0 python3 -m http.server 8080 - You should see:
Serving HTTP on :: port 8080 (http://[::]:8080/) ...
Leave this terminal running.
- Open Chrome (not Firefox, not Safari)
- Go to:
http://localhost:8080 - You'll see the drum pad grid with 8 color-coded pads
Important: Close the PlatformIO Serial Monitor first — Chrome and Serial Monitor cannot share the same port.
- In Chrome, click "Connect to ESP32"
- A popup lists available serial ports — select your ESP32 port (e.g.
usbserial-3110) - Click Connect
- The status dot turns green
Browser only (no ESP32 needed):
- Click pads with your mouse
- Press keyboard keys:
12345678
Full end-to-end (ESP32 → USB → Chrome → sound):
- Make sure Chrome is connected (green dot)
- Open PlatformIO Serial Monitor
- Type
1, press Enter - Hear kick drum play in Chrome
That's Phase 0 complete.
| Key | Alias | Command | Sound |
|---|---|---|---|
1 |
k |
KICK |
Kick drum |
2 |
s |
SNARE |
Snare |
3 |
h |
HIHAT_CLOSED |
Closed hi-hat |
4 |
H |
HIHAT_OPEN |
Open hi-hat |
5 |
t |
TOM_LOW |
Low tom |
6 |
T |
TOM_MID |
Mid tom |
7 |
c |
CRASH |
Crash cymbal |
8 |
r |
RIDE |
Ride cymbal |
| Problem | Fix |
|---|---|
| No port appears when ESP32 plugged in | Try a different cable — charge-only cables have no data wires |
| Upload fails with "No serial data received" | Wrong port in platformio.ini — check ls /dev/cu.* |
| Serial Monitor shows nothing | Press the EN/RST button on the ESP32 to reboot |
| Chrome shows no serial ports in popup | Close PlatformIO Serial Monitor first — two apps can't share one port |
| Pads are dim / greyed out | WAV files missing or wrong filename — check web_app/phase0/samples/ |
| Click pad but no sound | Click anywhere on the page first — Chrome requires a user gesture to unlock audio |
python3: command not found |
Install Python from python.org |
| Web Serial API not available | You're not in Chrome — switch from Firefox or Safari |