PIC10F200 Harry Potter Melody

A tiny PIC10F200 plays Hedwig's Theme on a scavenged headset speaker, built as a holiday ornament. This started from a CircuitBread tutorial on generating music with a buzzer, then I transcribed the Harry Potter melody into assembly and wrapped it in a 3D-printed globe.

PIC10F200 Assembly Buzzer 3D Print

Open project folder

Origins

The baseline is the CircuitBread tutorial Musical Microcontroller - Part 8 (PIC10F200) . The article explains how to toggle a GPIO pin at audio frequencies using precise delay loops, how note timing is derived from period counts, and why limited flash means a melody must reuse a small set of notes. It also highlights using `XORWF` to toggle GP2 efficiently and `SLEEP` for low-power idle.

Media

Demo video (compressed).

PIC10F200 ornament photo
Fusion360 model render

Music source

I wanted a holiday-themed build, so I picked Hedwig's Theme. I referenced the sheet music at MusicNotes and translated the notes into the PIC assembly sequence.

Implementation highlights (PIC10F200)

ESP32 port comparison

PIC10F200 assembly

  • Hand-tuned delay loops per note (`d1`, `d2`, `unitc`).
  • GPIO toggled in a tight loop for square-wave audio.
  • Durations defined by repeating period blocks.

ESP32 implementation

  • Table-driven `Step` list with frequency (Hz) and duration (ms).
  • LEDC hardware tone generation for stable pitch.
  • Articulation via a small `GAP_MS` between notes.

Source: ESP32_HarryPotter/ESP32_HarryPotter.ino

Physical build

The circuit lives inside a 3D-printed globe ornament. I cut a tiny speaker from a headset, wired it to the PIC10F200 output pin through a resistor, and powered it with a small battery. The model file is board+case.f3d.

Notes

This folder also contains a simple web piano used for quick square-wave note checks. It is based on a basic tutorial example and wasn’t central to the final build.