Skip to content

frnkptrln/ble-density-gauge

Repository files navigation

📡 BLE Density Gauge — Flipper Zero App

A passive Bluetooth Low Energy (BLE) density scanner for the Flipper Zero.

Warning

🚧 UI PROTOTYPE & FIRMWARE LIMITATIONS
Neither the official Flipper Zero firmware nor current custom firmwares (like Unleashed or Xtreme) allow external SD card apps (.fap) direct access to low-level BLE radio commands (e.g., hci_send_req for passive scanning).

Therefore, this app currently serves as a technical UI prototype. The custom "System Mass Index" tachometer interface works flawlessly and proves the design concept, but the operating system currently refuses to provide the raw radio sensor data to the app sandbox, keeping the display reading at 0.

🛠️ For Developers: Real Scanning via System Build

Because external .fap apps cannot send the necessary HCI commands to the radio, there is only one way to make the true scanner fully operational: build it directly into the firmware as a core system app.

By placing this source code into the applications/user/ directory of a Custom Firmware source tree (e.g., Unleashed) and compiling the firmware from scratch, the API sandbox restrictions are bypassed. The scanner logic in density_scanner.c can then be rewritten to use the genuine BLE observation APIs (aci_gap_start_observation_proc()) to achieve true passive background scanning.

🎯 What It Does

BLE Density Gauge passively monitors Bluetooth Low Energy (BLE) advertisement traffic to estimate the density of nearby electronic devices — phones, smartwatches, earbuds, laptops, and anything else broadcasting BLE signals.

No device lists. No MAC addresses. No tracking. Just a beautiful analog tachometer showing the System Mass Index of your environment.

The app's scanning engine is designed to hop across the three BLE advertising channels (37, 38, 39), sampling radio signal strength (RSSI) to detect nearby device activity. The more devices broadcasting, the higher the gauge climbs.

┌──────────────────────────────────┐
│ BLE DENSITY               MEDIUM │
│ ──────────────────────────────── │
│            ╭─────────╮           │
│           /   . : .   \          │
│          /  .   |   .  \         │
│         /───────o───────\        │
│                                  │
│         0       50      100      │
│                                  │
│ EVT: 142    -67dBm           45s │
│ ██████████████████░░░░░░░░░░░░░░ │
└──────────────────────────────────┘

Density Levels

Level Devices Typical Environment
EMPTY 0–5 Empty room, outdoors
LOW 5–15 Small office, café
MEDIUM 15–40 Crowded bar, lecture hall
PACKED 40+ Concert, train station, demo

📦 Installation

Manual Installation

  1. Download the latest .fap from Releases (or find it in your local dist/ folder if you built it yourself)
  2. Copy it to your Flipper's SD card: SD Card/apps/Tools/ble_density_gauge.fap
  3. On your Flipper: Apps → Tools → BLE Density

🔨 Building from Source

Prerequisites

  • Python 3.8+
  • ufbt (Universal Flipper Build Tool)

Build

pip install ufbt
cd ble-density-gauge
ufbt

The compiled .fap will be in the dist/ directory.

Deploy directly to Flipper

ufbt launch

🔬 How It Works

Scanning Engine

The app uses the Flipper's radio hardware to cycle through BLE advertising channels:

  1. Channel Hopping: Rapidly switches between channels 37, 38, and 39 (the three BLE advertising channels)
  2. RSSI Sampling: Takes multiple signal strength readings per channel, filtering out background noise below -90 dBm
  3. Rolling Window: Maintains a 60-second sliding window of detected events
  4. Density Scoring: Applies logarithmic scaling to map raw event counts to a 0–100 gauge scale

Privacy

  • No MAC addresses collected — only aggregate signal strength
  • No data stored — everything stays in RAM
  • Completely passive — the Flipper only listens, never transmits during scanning
  • Offline — no network connectivity required

⚠️ Notes

  • While the app is scanning, the Flipper's normal BLE connectivity (companion app) is temporarily unavailable
  • BLE is fully restored when you exit the app
  • The density readings are estimates based on radio traffic, not exact device counts
  • Signal reflections and environmental factors can affect readings

📄 License

MIT License — see LICENSE

🤝 Contributing

Pull requests welcome! Areas for improvement:

  • Calibration profiles for different environments
  • Historical density graph over time
  • Sound/vibration alerts at configurable thresholds
  • Data export to SD card

About

A passive BLE scanner for the Flipper Zero that turns invisible Bluetooth advertisements into a real-time 'Index' of your surroundings.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages