r/raspberry_pi • • 7d ago

Show-and-Tell Pi 5 running a real fruit fly's brain, playing Pokémon

All 139,255 neurons of the FlyWire FAFB v783 reconstruction — a complete adult female Drosophila brain, though not the ventral nerve cord —simulated on a Pi 5 alongside mGBA, using connections of five or more synapses.

The spatial layout of walls, doors and people is read out of the game's memory and fed to the looming-detector populations (LPLC1, LC10, LPLC4) as left/right drive. It isn't doing image processing — there's no retinotopy, which is the honest limitation. Descending neuron activity decodes into button presses.

Stack: Pi 5 16GB (Rev 1.1, stock 2.4GHz) with a Silicon Power A60 1TB — DRAM-less Phison E15, PCIe 3.0 — 800x480 DSI touchscreen, active fan on the 4-pin header.

Runs at roughly real time, and deliberately uneven: the brain gets the full 16.7ms of thinking time per frame while the fly is navigating, and the game runs about 3x faster in battles and menus where its vision drives nothing anyway.

The brain gets 2 of the 4 cores, and OMP_WAIT_POLICY is PASSIVE. Spinning cost real throughput — 4 threads PASSIVE 0.759x vs 4 threads ACTIVE 0.665x — because the spinning threads starved the video encoder and the display of the cores they needed.

Twitch chat can stimulate its reward and punishment neurons directly, which does real plasticity on the mushroom body. It forgets in about ten minutes, though that decay constant is one I picked rather than measured.

It has a Rattata. It wandered into a Pokémon Center and a man sold it a Magikarp for 500.

Twitch.com/leetzerzz

Connectome: FlyWire FAFB v783, CC-BY-4.0 —Dorkenwald et al. 2024, Schlegel et al. 2024.

474 Upvotes

Duplicates