Network Layer: Bluetooth Mesh and Routing Algorithms

Managed Flooding and Node Density Theory

🕸 Network Layer: Bluetooth Mesh and Routing Algorithms

Butterfly's physical layer is built on Bluetooth Low Energy (BLE) technology, specifically leveraging the Advertising and Scanning features in the Generic Access Profile (GAP).

⚙️ Hardware Adaptation Specifications

The system adaptively adjusts according to device hardware:

  • BLE 4.0/4.2: Range 10–50 meters, low power mode, suitable for dense indoor social environments.

  • BLE 5.0+: Range 200–400 meters, supports "long range mode", suitable for outdoor music festivals/squares.

🛣 Routing Algorithm: Managed Flooding

For the mesh network routing algorithm, Butterfly abandons routing table mechanisms commonly used by protocols like ZigBee and instead adopts managed flooding. To prevent "broadcast storms," each relay node executes the following logic:

Time-To-Live (TTL)

Each packet is assigned a TTL value at initialization (default 7 hops). Each relay node decrements the TTL by 1. When TTL = 0, the node stops forwarding.

🍏 Cross-Platform Challenges and Solutions

Implementing a persistent mesh network on smartphones faces operating system limitations, especially iOS's strict control of background Bluetooth advertising.

Butterfly's solution:

  1. Hybrid wake-up mechanism: Use iOS Location Updates or Audio Background Mode as auxiliary keep-alive measures.

  2. Restricted advertising strategy (Duty Cycling): In background mode, the protocol switches to low-frequency advertising, sending only a minimized presence beacon.

  3. Local notification incentives: When nearby Butterfly nodes are detected, wake the user by sending a local push notification to open the app, thereby restoring full-speed mesh functionality.

📉 Network Physics: Percolation Threshold

In random geometric graphs, only when node density λ\lambdaexceeds a critical thresholdλc\lambda_c does a "giant component" emerge.

For a Bluetooth connection radius r30r \approx 30m:

λc4.5πr20.0016 /m2\lambda_c \approx \frac{4.5}{\pi r^2} \approx 0.0016 \text{ }/m^2

Conclusion: it is difficult to reach this density in the early stages in cities. Therefore, GTM strategy must focus on hyper-localized clusters(campuses, music festivals), where node density naturally exceeds λc\lambda_c, producing immediate network utility.

Last updated