The RaspberryPi BLE People Counter is an end-to-end IoT system designed to estimate the number of people passing through or occupying a given area — without cameras, without pairing, and without storing any personally identifiable data. Each Raspberry Pi passively listens for Bluetooth Low Energy advertisement packets broadcast by the smartphones and wearables people carry, anonymizes the raw MAC addresses on-device using SHA-256, and forwards the results to a cloud backend that aggregates them and serves a real-time web dashboard.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 problem it solves
Traditional people-counting solutions (camera-based systems, infrared barriers, manual tallies) are either expensive, intrusive, or too coarse for multi-zone analysis. BLE signals are already present wherever people carry smartphones. By treating signal strength (RSSI) as a proxy for distance, the system can classify detections into proximity zones without any active interaction from the people being counted.Passive BLE scanning
Uses the Bleak library to scan BLE advertisements on any Raspberry Pi with a Bluetooth adapter. No pairing, no consent prompts, no active probing.
SHA-256 MAC anonymization
Raw MAC addresses are hashed with SHA-256 before they leave the device. The cloud backend never sees hardware identifiers — only 64-character hex digests.
Three-zone proximity classification
Each detection is classified as NEAR (≥ −60 dBm), MEDIUM (≥ −75 dBm), or FAR (< −75 dBm) based on the measured signal strength. Thresholds are configurable.
MQTT and HTTP transport modes
Choose MQTT for production deployments with offline buffering, or HTTP for simple local setups. The agent falls back to an in-memory buffer (up to 100 messages) when the network is unavailable.
Real-time dashboard
A React frontend connects to the backend over WebSocket and renders per-zone counts, hourly and daily trends via Recharts, and CSV export filters.
Privacy by design
Anonymization is applied on the Pi before transmission. No raw identifiers are stored anywhere in the pipeline. Zone thresholds can be recalibrated without historical data loss.
Three-component architecture
The system is split into three independently deployable components:Raspberry Pi agent
A Python asyncio process (
src/main.py) that drives BLE scanning, anonymization, zone classification, and transport to the cloud.Cloud backend
A FastAPI application backed by PostgreSQL. Receives detections over MQTT or HTTP, stores them, and pushes live updates to connected dashboard clients over WebSocket.
Web dashboard
A React + Recharts single-page app that visualizes zone statistics in real time and provides CSV export of historical records.
The three components communicate over well-defined interfaces (MQTT topics or REST endpoints plus a WebSocket feed), so each layer can be replaced or scaled independently.
Where to go next
Architecture overview
Understand the full data flow from BLE radio to dashboard chart.
Quickstart
Get a working people-counting setup running in under 15 minutes.