metronome/wokwi/README.md
Me Here 1186e61588 Add Wokwi (Pi Pico) simulation of the Micro metronome
MicroPython sim that runs on https://wokwi.com/pi-pico: KY-040 encoder stands in
for the thumb-roller (rotate=tempo, press=start/stop, hold+rotate=track), an
SSD1306 OLED for the display, and a piezo buzzer for the click. Files:
diagram.json, main.py, ssd1306.py + README with the (manual) setup steps.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 08:04:53 -05:00

1.9 KiB
Raw Permalink Blame History

Wokwi simulation — PMµ Micro (Raspberry Pi Pico)

A runnable Wokwi simulation of the PMµ Micro metronome on a Raspberry Pi Pico (RP2040), in MicroPython. It's a functional standin — Wokwi has no 14segment display or analog audio path, so we approximate:

Real device Simulated with
Clickable thumbroller KY040 rotary encoder (rotate / press / hold+rotate)
Amber 14segment display SSD1306 OLED (shows BPM and track names)
Analog click + speaker Piezo buzzer (accent beat = higher, longer beep)

Controls

  • Rotate the encoder → tempo (BPM)
  • Press (the encoder's button) → start / stop
  • Hold the button + rotate → switch track (release to load it)

Run it (you do this part — I can't operate your Wokwi account)

I can't log into wokwi.com or create the project on the site for you. Use these files:

  1. Open https://wokwi.com/pi-pico — it starts a new Pi Pico MicroPython project.
  2. Click the diagram.json tab and replace its contents with this folder's diagram.json.
  3. Replace main.py with this folder's main.py.
  4. Add a new file named ssd1306.py (the next to the file tabs) and paste this folder's ssd1306.py.
  5. Press ▶ (play). Rotate / click the encoder; you'll hear the click and see the OLED update.

If you use the Wokwi VS Code extension instead, keep these three files together and add a diagram.json reference as usual.

Pin map (Pico GPIO)

Function Pin
OLED SDA / SCL (I²C0) GP0 / GP1
Encoder CLK / DT / SW GP2 / GP3 / GP4
Buzzer GP5
OLED + encoder power 3V3 / GND

The real firmware ("PORTS TO FIRMWARE" in the web app) drives a 14segment display over I²C and injects the click into the analog signal path; this sim keeps the same control model and beat scheduling so the feel matches.