Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AngelAmoSanchez/TFG-RaspberryPi-BLE/llms.txt

Use this file to discover all available pages before exploring further.

The RaspberryPi BLE People Counter is an end-to-end IoT system that uses one or more Raspberry Pi devices to passively detect nearby Bluetooth Low Energy (BLE) signals and estimate how many people are present in a defined area. MAC addresses are anonymized with SHA-256 before leaving the device, so no personally identifiable data ever reaches the cloud. A FastAPI backend stores and aggregates detections in PostgreSQL, while a React dashboard shows real-time zone statistics and lets you export historical data as CSV.

Quickstart

Get your first Raspberry Pi scanning and data appearing in the dashboard in under 15 minutes.

System architecture

Understand how the Pi agent, cloud backend, MQTT/HTTP pipeline, and web dashboard fit together.

Raspberry Pi setup

Install dependencies, configure the BLE agent, and register your device with the backend.

API Reference

Explore every REST endpoint and the WebSocket feed for real-time detection events.

How it works

The system is composed of three independent layers that communicate over MQTT or HTTP:
1

Scan

Each Raspberry Pi runs the BLE agent (src/main.py), which uses the Bleak library to passively detect nearby BLE advertisements every 30 seconds. No pairing or consent is needed — the scanner only reads public advertisement packets.
2

Process & anonymize

Raw MAC addresses are hashed with SHA-256 and each device is classified into a proximity zone — NEAR (≥ −60 dBm), MEDIUM (≥ −75 dBm), or FAR (< −75 dBm) — before any data leaves the Pi.
3

Send to the cloud

The agent publishes processed detections in bulk to the FastAPI backend via MQTT or HTTP. An offline buffer retains up to 100 messages if the network is unavailable.
4

Visualize

The React dashboard connects via WebSocket for live updates and renders per-zone people estimates, hourly/daily trends, and CSV export filters.

Key features

Privacy by design

SHA-256 MAC anonymization happens on-device. The cloud never sees raw hardware addresses.

Configurable zones

Tune NEAR / MEDIUM / FAR RSSI thresholds through the dashboard or API. Zone recalculation is retroactive.

MQTT & HTTP modes

Choose between MQTT (with offline buffering) or direct HTTP posting depending on your network setup.

CSV export

Download filtered detection records by date, zone, or device ID for offline analysis.

Build docs developers (and LLMs) love