Fruit fly connectome on an ESP32-S3
A port of part of the fruit fly connectome, 48,311 neurons and 9.46 million connections from a real fly brain, escaping a spider on an ESP32-S3.

By slvDev (GitHub repository owner)
- GitHub stars
- 4.5K (GitHub)
Build sheet
- Board
- ESP32-S3 N16R8
- Other parts
- OLED
- AI model or service
- fruit fly connectome (MaleCNS v1.0), nothing trained
- Difficulty
- Advanced · Our suggestion
Parts list
Prices and notes: Parts and requirements
Steps
- Difficulty
- Advanced
- scripts/fetch_model.sh fly
- scripts/deploy.sh fly [10]
Full instructions: View original
Like this build? Get the weekly builds
Get the best new AI hardware builds every Thursday. One email a week, free.
Built something? Submit a build
Overview
A port of part of a real brain to an ESP32-S3: 48,311 neurons and 9,462,135 connections from the male fruit fly connectome, MaleCNS v1.0, compressed to 13.5MiB in flash. Nothing is trained: a spider on an OLED drives the fly’s own looming detectors, and its escape neurons decide when it jumps.
What it does
- Holds 48,311 neurons and 9,462,135 connections from the male fruit fly connectome, MaleCNS v1.0, with the synaptic contact count of every connection kept exactly. [1]
- Escapes a spider on the OLED: the spider’s growing size drives the fly’s looming detectors, LC4 and LPLC2, and when the escape neurons on that side, including DNp01, get active enough, the fly leaps away. [2]
- No model was trained: the port ships a small text file naming the input and output neurons and one threshold, and the behavior comes from the fly’s own wiring. [3]
- The graph is 13.5MiB compressed in flash with blocks cached in PSRAM, and a new decision comes about every 1.7 s. [4]
Use-case ideas
- Without a display the demo still runs and reports over serial. [5]
Parts and requirements
| Part | Spec / notes | Needed | Price |
|---|---|---|---|
| ESP32-S3 N16R8 [6] | Required | ||
| SH1106 I2C OLED, 128 x 64 pixels [7] | Without a display the demo still runs and reports over serial | Optional |
- esp32:esp32 core 3.3.10
- Adafruit SH110X, Adafruit GFX Library and Adafruit BusIO
- Requirements source: [8]
How it works
The graph sits compressed in flash with blocks cached in PSRAM; every simulation step goes through all of its connections on both cores with the chip’s SIMD instructions, and a new decision arrives about every 1.7 s.
Setup effort
Two commands: fetch_model.sh fly downloads and verifies the graph, circuit and gold; deploy.sh fly checks the bundle, runs the host gold, compiles, then flashes the graph and the firmware. [10]
Limits and caveats
Why it's interesting
This demo puts part of a real brain on a microcontroller: 48,311 neurons and 9,462,135 connections from the male fruit fly connectome (MaleCNS v1.0), with the synaptic contact count of every connection kept exactly. The README says the graph is 13.5 MiB compressed in flash, and every simulation step runs through all connections on both ESP32-S3 cores using the chip's SIMD instructions. Nothing is trained. A spider growing on screen drives the fly's own looming detectors, LC4 and LPLC2, and when escape neurons such as DNp01, the giant fiber, get active enough the fly leaps away. The author checked that stimulating those detectors activates the escape neurons 30 to 100 times more than random visual neurons. It is a selected part of the nervous system, not the whole fly.
Source: github.com/slvDev/esp32-ai#porting-part-of-the-fruit-fly-connectome-to-esp32
Hardware
- ESP32-S3 N16R8
- OLED
Credits and links
- slvDev: Creator
- FlyEM Project at HHMI Janelia, University of Cambridge, MRC Laboratory of Molecular Biology and Google Research: MaleCNS v1.0 connectome, used under CC BY 4.0
Sources
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/README.md?plain=1#L67-L69
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/README.md?plain=1#L89-L93
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/README.md?plain=1#L95-L97
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/README.md?plain=1#L83-L84
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L53-L54
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L3-L4
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L44-L54
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L31-L36
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L27
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L19-L24
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/README.md?plain=1#L73-L75
- github.com/slvDev/esp32-ai/blob/52ebcbbd905270592c1d415efd1128d04d0fa365/firmware/esp32_fly/README.md?plain=1#L97-L99
This page is a short summary written by HardwareLab. Build steps, code and photos belong to the creator; follow “View original” for the full project.
Featured? Add this badge
Built this? Paste the badge into your README. It links back to this page.
Markdown
[](https://hardwarelab.dev/projects/esp32-fruit-fly-connectome/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w)HTML
<a href="https://hardwarelab.dev/projects/esp32-fruit-fly-connectome/?utm_source=badge&utm_medium=referral&utm_campaign=launch_2w"><img src="https://hardwarelab.dev/badge.svg" alt="Featured on HardwareLab" width="188" height="20"></a>Related builds
All 22 in Local LLM Rigs & Edge Agents
Muse Gadgets SDK
Meta’s open SDKs for connecting Muse to ESP32 and Raspberry Pi gadgets.
- ESP32 boards
- Raspberry Pi (3B+, 4, 5 or Zero 2 W) or another Linux computer with Bluetooth LE
Intermediate2.2K
ESP32 iPhone Agent
An ESP32-S3 board lets an AI model use a real iPhone: no computer at run time, no jailbreak.
- Seeed XIAO ESP32S3 (plain, 8MB PSRAM; any ESP32-S3 with native USB + PSRAM)
- iPhone on iOS 18+ with cellular data
- Lightning to USB Camera Adapter (Lightning iPhones only)
- +2 more
Intermediate2.4K