Mycelium: When the Grid Goes Down, the Network Awakens

Autonomous, privacy-first BLE 5.1 mesh network that anonymously locates trapped survivors and relays emergency SOS alerts without cell towers, internet, or GPS.


Inspiration

Whenever major hurricanes, earthquakes, or severe winter storms strike, the first infrastructure to collapse is almost always cellular connectivity and the municipal power grid. Cell towers get knocked offline, backup batteries deplete, and centralized communication goes completely dark—leaving victims unable to call for help and first responders searching blind.

At the same time, modern tracking systems pose a massive ethical dilemma: traditional attempts at emergency locating rely on intrusive cell phone pinging, GPS tracking, and facial recognition cameras that harvest personal identity, invasive telemetry, and private data.

We asked ourselves:
Can we build a system that locates people in life-or-death emergencies and verifies building attendance, without relying on a single router, cell tower, or central authority—and without compromising human privacy?

Inspired by biological fungal mycelium—vast underground organism networks that communicate, balance resources, and survive without any central brain or master root—we created Mycelium.


How We Built It

Mycelium is divided into a physical edge hardware layer, a mathematical localization solver, and a 3D visualizer.

1. Hardware Architecture

  • Edge Nodes (4+ Arduino Uno Q Boards): Each Uno Q runs Debian Linux on a Qualcomm QRB2210 processor handling the BLE mesh routing daemon, coupled with an STM32 real-time microcontroller for physical LED hop feedback and emergency inputs.
  • Observer Bridge (Laptop): An Intel Bluetooth 5.1 adapter running a Windows BLE GATT bridge and WebSocket engine (bridge.py) that observes the mesh without assuming central authority.

2. The 20-Byte Compact Wire Protocol

Because Bluetooth Low Energy ATT MTU is typically constrained to 23 bytes (leaving 20 bytes of effective payload after the 3-byte ATT header), standard IP/TCP/UDP packets are impossible. We engineered a custom 20-byte binary wire frame (!HHBBBI9s):

$$\text{Frame Size} = \underbrace{2\text{B}}{\text{Origin ID}} + \underbrace{2\text{B}}{\text{Target ID}} + \underbrace{1\text{B}}{\text{TTL}} + \underbrace{1\text{B}}{\text{Hop Count}} + \underbrace{1\text{B}}{\text{Msg Type}} + \underbrace{4\text{B}}{\text{Message ID}} + \underbrace{9\text{B}}_{\text{Payload}} = 20\text{ Bytes}$$

  • Broadcast Target (0xFFFF): Floods network for route discovery and emergency SOS alerts.
  • Deduplication Cache: Every node tracks seen (Origin, MessageID) pairs to suppress duplicate forwards and prevent broadcast storms.
  • Dynamic Route Advertisements: Nodes advertise routing tables every $5\text{s}$ with a $30\text{s}$ lease, supporting multi-hop unicast up to 4 hops with bounded flooding fallback.

3. Mathematical Localization & Physics Solver

Rather than faking node coordinates on a 2D plane, Mycelium calculates 3D physical positions from raw radio physics.

Step A: 2.4 GHz RF Path-Loss Distance Modeling

We convert the Received Signal Strength Indicator ($\text{RSSI}$, in $\text{dBm}$) into physical meters using the calibrated Log-Distance Path Loss Model:

$$d = 10^{\left( \frac{A - \text{RSSI}}{10 \cdot n} \right)}$$

Where:

  • $d$ is the calculated physical distance in meters.
  • $A = -59.0\text{ dBm}$ is the calibrated reference RSSI at a 1-meter distance for $0\text{ dBm}$ BLE transmission power.
  • $n = 2.2$ is the path-loss exponent calibrated for indoor multi-path environments.
  • To filter radio noise and multipath fading, distances are calculated using a rolling median filter over a $30\text{s}$ window ($N \le 12$ samples).

Step B: 3D Force-Directed Spring Relaxation Solver

To resolve pairwise distances into consistent 3D coordinates $(x, y, z)$, we implemented a dynamic particle physics relaxation engine using Hooke's Law and electrostatic repulsion:

$$\mathbf{F}{\text{spring}}(i, j) = -k \cdot \left( |\mathbf{x}_i - \mathbf{x}_j| - d{ij} \right) \frac{\mathbf{x}_i - \mathbf{x}_j}{|\mathbf{x}_i - \mathbf{x}_j|}$$

$$\mathbf{F}_{\text{repulsion}}(i, j) = \frac{c}{|\mathbf{x}_i - \mathbf{x}_j|^2 + \epsilon} \frac{\mathbf{x}_i - \mathbf{x}_j}{|\mathbf{x}_i - \mathbf{x}_j|}$$

Nodes update velocity and position per simulation step with velocity damping ($\gamma = 0.88$) to prevent numerical oscillation:

$$\mathbf{v}i^{(t+1)} = \gamma \cdot \mathbf{v}_i^{(t)} + \frac{\sum{j \neq i} \left( \mathbf{F}{\text{spring}}(i, j) + \mathbf{F}{\text{repulsion}}(i, j) \right)}{m} \Delta t$$

$$\mathbf{x}_i^{(t+1)} = \mathbf{x}_i^{(t)} + \mathbf{v}_i^{(t+1)} \Delta t$$


4. Real-Time 3D Visualizer & HUD

Built with React 19, Three.js, React Three Fiber (R3F), Drei, and Tailwind CSS. It connects to the bridge over a low-latency loopback WebSocket (ws://localhost:8765), animating packet particles in 3D arcs between nodes as they relay across the physical room.


Challenges We Faced

Hackathons rarely go according to plan, but our hardware debugging journey was an absolute trial by fire:

1. The Qualcomm Wi-Fi Kernel Driver Crash (The IBSS Dead End)

We originally set out to build Mycelium over 802.11 IBSS (Ad-Hoc) Wi-Fi so the Arduino Uno Q boards could talk directly antenna-to-antenna on standard network sockets. However, after hours of kernel debugging, we discovered a fatal bug in the Qualcomm WCN3990 closed-source binary firmware:

ath10k_snoc: firmware crashed! Asserted in wlan_scan.c:wlan_scan_start:1266

Whenever the Linux subsystem initiated an ad-hoc Wi-Fi scan, the proprietary Qualcomm radio firmware suffered an unrecoverable kernel assertion crash that completely disabled wlan0. Because the firmware was compiled binary blob code, it was impossible to patch. Rather than giving up or settling for a fake centralized Wi-Fi Access Point (which would destroy our decentralized vision), we completely threw out our Wi-Fi code and pivoted our entire networking stack to raw Bluetooth Low Energy (BLE 5.1) in the middle of the night.


2. The Bluetooth Radio Hijacking Nightmare (Asymmetric Send/Receive)

Switching to BLE solved the Wi-Fi crash, but it plunged us straight into one of the most maddening bugs we’ve ever debugged:

  • The Symptom: Our nodes could passively scan, advertise, and receive packets flawlessly, but the moment our code tried to execute an active send (connecting as a central to transmit a frame to a neighbor), the transmission threw cryptic I/O errors or hung indefinitely.
  • Why It Was a Nightmare: Because incoming packets were arriving with clean signal strengths, our telemetry looked 100% operational. We spent hours dissecting our Python async loops, payload packing, and socket logic thinking our application code was broken.
  • The Root Cause: Background Linux system daemons (bluetoothd and conflicting BlueZ desktop services) were continuously waking up and hijacking exclusive control of the HCI radio controller (hci0). Passive listening didn't trigger a lock collision, but the second we opened a write channel to transmit, the system daemon wrestled control of the adapter away from our process.
  • The Fix: We had to write custom lower-level interface teardown routines—programmatically resetting the HCI bus with hciconfig hci0 down/up, managing BlueZ D-Bus leases through dbus-fast, and isolating our peer loop through an abstract local Unix domain socket so no rogue system daemons could steal radio access during multi-hop forwarding.

3. Squeezing a Mesh Protocol into 20 Bytes (The BLE MTU Wall)

Standard IP and TCP networking headers consume 40+ bytes before you can even transmit a single letter of payload. Standard Bluetooth Low Energy ATT Maximum Transmission Unit (MTU) is only 23 bytes—leaving an effective payload limit of exactly 20 bytes after the 3-byte ATT header.

Fitting routing IDs, hop counts, 32-bit duplicate suppression identifiers, message types, and emergency telemetry into 20 bytes with zero room for fragmentation required strict bit-level binary packing with Python's struct library.


4. RF Signal Echoes & Relay Loopbacks

In physical radio space, when Node B receives a packet from Node A and tries to relay it forward to Node C, Node B’s radio naturally hears Node A with the highest RSSI (because Node A just finished transmitting right next to it).

During our initial multi-hop tests, relay nodes kept connecting right back to the sender who originated the packet, causing infinite broadcast ping-pong loops. We had to implement a distributed deduplication cache (Origin, MessageID) combined with immediate previous-hop MAC filtering so nodes strictly propagate frames outward rather than echoing backward.


Accomplishments That We're Proud Of

  • True Decentralized P2P: Zero master nodes, zero access points, and zero IP addresses. Every Arduino board runs identical, symmetric routing logic.
  • Multi-Hop Hardware Relay: Successfully demonstrated a daisy chain of 4+ physical Arduino Uno Q boards relaying packets across space without any internet connectivity.
  • Physics-Derived 3D Positioning: Successfully converging raw radio signal fluctuations into a stable 3D visual representation using Hooke's Law spring physics.
  • Self-Healing Network: When an intermediate board is powered off, the routing tables dynamically expire the broken link within $20\text{s}$ and reroute subsequent packets through surviving neighbors.

What We Learned

  • Low-Level Radio Engineering: Gained deep experience with BLE Link Layer timing, GATT service advertisements, BlueZ D-Bus APIs, and RF attenuation physics.
  • Embedded System Constraints: Learned how to optimize memory and execution on embedded Linux running alongside an STM32 real-time coprocessor.
  • Privacy by Architecture: Proved that spatial awareness and disaster response don't require surveillance capitalism. You can build life-saving systems that treat user privacy as a fundamental engineering constraint.

What's Next for Mycelium

  • LoRa Long-Range Integration: Adding 915 MHz LoRa transceivers to extend the mesh radius from room-scale (tens of meters) to kilometer-scale across wilderness and disaster zones.
  • STM32 Sensor Fusion: Expanding the coprocessor firmware to transmit real-time telemetry (ambient temperature for fire detection, IMU acceleration for collapse detection) directly in the 9-byte payload.

Built With

Share this project:

Updates

Submission history