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.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.
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: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.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.
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.
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.