BlueHeaven

📱📲: BlueHeaven: Bluetooth Low Energy-based mesh network for general-purpose traffic

Successful connection across 5 nodes

Design Overview

BlueHeaven was born when I came into possession of around 15 Android phones and decided that I wanted to do something with them.

Inspired by Silicon Valley’s PiperNet, I quickly came up with the idea to implement a mesh network, and I wrote up my ideas here: https://regulad.notion.site/BlueHeaven-bb83b532feed4d0e9c896d2cc4130d3d?pvs=4

Based on the B.A.T.M.A.N. routing design, my nodes exchange information on the next hop to reach a destination, meaning that no single node has to know the entire network topology, which was critical as my network was going to have even bigger scalability issues than a traditional mesh network with Bluetooth devices joining and leaving reguarly.

Implementation Woes

Although I had a lot of fun writing the code, I ran into several issues that I was able to solve.

The final problem proved to be the most fatal. Occasionally, the client would be able to connect with no problem, but completely randomly it would not be able to send data to the server. After 5+ hours of debugging, I was not able to find even a single lead towards why this was happening. Multiple devices, multiple Android versions, multiple BLE chipsets, and multiple connection methods were all tried, but the problem persisted. Eventually, I stumbed across the medium series Making Android BLE Work and I was able to put it all together. I need to thank Martijn van Welie endlessly as his series was the only thing that helped me solve my problem.

BLE Connection Diagram

A picture from a version where devices had no limit on the number of servers they could connect to. You could see that they really favored connecting to as many peers as possible. However, you can see one of the devices along the top with knowledge about nodes it isn’t directly connected to. This is the OGM routing algorithm at work!