Skip to content
Jonathan Correa
← Back to selected work

Spatial

Real-time bus crowd monitoring using an onboard Raspberry Pi 3 with Bleak Bluetooth scans, a Flask analytics service, and Supabase.

Year2024
RoleSoftware Developer
StackNext.js, Flask, Supabase, Raspberry Pi
LinkIn active development. Updates coming soon.

Overview

Spatial estimates bus crowd density in real time so transit riders know how full a bus is before boarding. Instead of using cameras or collecting personal data, the system measures passenger counts by scanning Bluetooth signals from rider devices using edge hardware installed on the vehicle.

Architecture

The system runs in three parts:

  1. Edge hardware. A Raspberry Pi 3 mounted inside the bus runs an asynchronous Python daemon with Bleak. It detects nearby Bluetooth Low Energy advertisements from phones and wearable devices inside the cabin. A rolling median filter removes weak or momentary signals so pedestrians waiting at bus stops are not counted.
  2. Backend analytics. The onboard Pi batches device counts, route IDs, and timestamps, then sends them to a Flask API. The backend compares raw signal counts with bus seating capacity to calculate realistic seat and standing room availability.
  3. Storage and dashboard. Supabase stores time-series records and replicates updates directly to a Next.js web app. Riders and transit operators see live bus coordinates, line congestion flags, and historical ridership trends.

Key considerations