Overview
I developed a proof-of-concept prototype for a smart doormat capable of counting the number of people entering and leaving a room. The system is built around a pressure sensor mat — a textile with an embedded grid of pressure sensors — and combines a Python data pipeline running on a Raspberry Pi with a Flutter mobile application to perform real-time step detection and direction classification.


Technical Approach
A Python script reads raw sensor data from the pressure sensor mat over a serial connection and streams it to a smartphone or tablet via Bluetooth. A Flutter application receives the data, visualises the pressure distribution in real time, and runs a multi-stage step detection algorithm.
The algorithm operates across three simultaneous processing loops:
- Step event detection — the first loop identifies pressure patterns that match a typical footstep appearing at a consistent location across consecutive time frames, marking the start and end of each step event
- Direction classification — once a step event has ended, the second loop analyses how the centre of mass shifted during the step to determine the direction of travel
- Person tracking — the third loop analyses the location, direction, and timing of consecutive step events to determine whether they belong to the same individual
This layered approach allows the system to correctly attribute simultaneous footsteps from multiple people crossing the mat at the same time, accurately maintaining a running count of people moving in each direction.

