Fireflies
FPGA implementation of Mirollo-Strogatz firefly synchronization on iCEstick.
Fireflies is an FPGA build for the Lattice iCEstick that makes hardware behave like a swarm of fireflies. Five LEDs each run as an independent phase oscillator, blinking at slightly different rates — and through pulse-coupling, they gradually pull themselves into sync, just like the real insects.
It’s based on the Mirollo–Strogatz model of pulse-coupled oscillators, with a twist: instead of relying on a concave phase function for convergence, I use phase-gated coupling, where only oscillators near their flash point (and not already flashing) receive a “kick.” PWM gives each LED a smooth flash-and-fade, and every ~45 seconds an LFSR scrambles the phases so synchronization replays from scratch.
There’s more packed into the ~1,200 logic cells: an I2S audio pipeline where each firefly sings a note on an A-minor pentatonic scale, and UART telemetry that streams phase and brightness to a live Python terminal UI. It’s built entirely with the open-source iCE40 toolchain — Yosys, nextpnr, and IceStorm.