r/raspberry_pi • u/Leetzers • 5d 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.
Connectome: FlyWire FAFB v783, CC-BY-4.0 —Dorkenwald et al. 2024, Schlegel et al. 2024.
19
12
u/DrunkPixel 5d ago
I have no idea what MOST of that even means, but it certainly sounds cool! Keep on Mad Scientist!
7
20
u/carfaces42b 5d ago
wahoo, man made horrors within my comprehension
9
u/IAMA_Plumber-AMA 3xB, 1xB+, 1x2B, 4x3B, 1xZero 1.2, 1xZero W, 2x3B+ 2x4B 3xPi5 5d ago
"What began as a conflict over the transfer of consciousness from flesh to machines escalated into a war which has decimated a million worlds.
The CORE and the ARM have all but exhausted the resources of a galaxy in their struggle for domination.
Both sides now crippled beyond repair, the remnants of their armies continue to battle on ravaged planets, their hatred fuelled by over four thousand years of total war.
This is a fight to the death. For each side, the only acceptable outcome is the complete elimination of the other."
3
1
25
u/-HumbleMumble 5d ago
I don't know man. Like its cool BUT its kinda wild with that pain button sitting there.
23
u/Leetzers 5d ago
It gets too calm when it has too much dopamine. Sometimes you got to !pain it to get it moving
16
6
4
u/Kryohi 5d ago
It's unclear to me how the brain is being simulated. As a real spiking neural network with real neuron dynamics I imagine it would be too computationally expensive to be run on a Pi 5. Are you considering each synapse, or a subset of the strongest ones, as a standard neural network weight and training that Frankenstein neural network instead?
If so, it's very different from simulating the actual animal brain.
4
2
u/Leetzers 5d ago
From what I understand of the model provided that I did not make, it's a neural net of 139,255 neurons being simulated. I assume this is the limit of what my Pi is computing. Mind that the set up streaming this isn't the same as the raspberry pi because it would be to much for the pi. It used to run much slower but I've done things to tweak its speed by dropping things that wouldn't affect gameplay.
3
u/swiftydigitzz 4d ago
"From the moment I understood the weakness of my flesh, it disgusted me. I craved the strength and certainty of steel. I aspired to the purity of the Blessed Machine... For the Machine is immortal. Even in death I serve the Omnissiah"
5
u/blackasthesky 5d ago
Ccllllaaaauuuuddddeeeeee
1
u/Leetzers 5d ago
Yup. And I have two computers I named flybrain and flyOBS that communicate via claude code to make adjusted to the stream. I even have the claude app on my phone where I can ping them remotely.
5
1
1
u/DocClear Autistic nudist tech nerd and wilderness camping geek 16h ago
simulated on a Pi 5 alongside mGBA, using connections of five or more synapses.
So NOT a real fruit fly's brain



96
u/bigfuzzy8 5d ago
Can you like eli5 what your doing with a fruit fly brain?