Skip to content
All Projects
OptiFlow inventory monitoring dashboard
EPFL··Academic·prototype

OptiFlow: AI-Enhanced Retail Inventory Monitoring

Built an AI-enhanced system combining wearable RFID scanning with UWB indoor positioning for Decathlon, enabling real-time shelf-level inventory monitoring and store flow optimization.

systemsmlembeddedweb
  • Custom wearable hardware: ESP32-S3 microcontroller + UHF RFID reader + UWB positioning module with stationary anchor network
  • Full-stack real-time platform: Next.js dashboard with live store maps, WebSocket-driven employee tracking, and stock heatmaps
  • ML analytics pipeline: K-Means product clustering, demand forecasting, anomaly detection, and ABC classification
  • Containerized microservice architecture with dual PostgreSQL databases, MQTT broker, and simulation engine
Stack
PythonTypeScriptC++FastAPINext.jsPostgreSQLDockerMQTT
RoleSoftware & Firmware Lead
Team6 people

Overview

Grade: 6 / 6 | EPFL Innovation & Entrepreneurship in Engineering (10 ECTS)

A semester-long project for Decathlon addressing a core retail problem: recorded inventory rarely matches what's actually on the shelf. Employees lose time searching for "ghost stock": items that are in the store but not in their correct shelf location. Existing solutions either don't scale, aren't real-time, or raise privacy concerns.

OptiFlow turns routine employee movement into a continuous sensing layer, with no cameras and no manual scanning rounds. Decathlon was interested in exploring it further after the course.

How It Works

Sales associates wear a small custom device while doing their normal tasks. As they walk through the store, the device passively scans RFID-tagged products and tracks its own position via UWB, building a real-time picture of what's on which shelf.

Hardware

Control box internals showing Qorvo DWM3001CDK, ESP32-S3, and Li-ion battery
Control box: Qorvo UWB module, ESP32-S3, and battery in 3D-printed enclosure

We built a custom wearable platform combining:

  • ESP32-S3 microcontroller as the main processing unit
  • M5Stack JRD-4035 UHF RFID reader (wristband-mounted) for scanning product tags
  • Qorvo DWM3001CDK UWB module for centimeter-level indoor positioning via DS-TWR
  • Bosch BNO085 IMU (optional, for dead-reckoning augmentation)
  • A network of stationary UWB anchors deployed throughout the store
  • Custom 3D-printed enclosures for the control box, anchors, and wristband

The multi-tasking firmware orchestrates concurrent sensor polling, data collection, and wireless communication via MQTT, running concurrently without blocking on a resource-constrained device.

I was responsible for a large part of the firmware development, alongside all of the software. I also contributed to hardware design and assembly, including soldering and prototype iteration.

Complete wearable system with RFID wristband and control box
Assembled wearable: RFID wristband connected to control box
UWB anchor deployed on Decathlon shelf
UWB anchor mounted on store shelving during field testing at Decathlon

Software

I designed and built the full software stack, a containerized microservice architecture processing incoming telemetry:

  • FastAPI backend handling trilateration, data ingestion, analytics, WebSocket management, and simulation control
  • Trilateration engine converting UWB distance measurements from multiple anchors into coordinates using least-squares optimization with confidence scoring
  • Dual-mode missing item detection with a conservative algorithm requiring 6 consecutive misses before flagging items unavailable
  • AI-powered analytics: K-Means product clustering, short-term demand forecasting, anomaly detection, ABC classification, and product affinity analysis
  • Next.js dashboard with live canvas-based store maps, employee trajectories, stock depletion heatmaps, and admin controls
  • Real-time WebSocket communication broadcasting position updates, inventory changes, and detection events
  • Dual PostgreSQL databases fully isolating simulation and production data
  • MQTT broker (Mosquitto) routing messages between hardware/simulation and the backend with mode-based topic filtering
  • Full simulation engine replicating employee movement, RFID detection, and UWB distance measurements for development and demo without hardware

All services orchestrated via Docker Compose with proper network configuration and volume management.

The dashboard below shows the system running live. The store map displays real-time employee position (blue), detected items (green), and missing items (red), with a prioritized restock queue on the right:

Live operational dashboard with store map and restock queue
Operational dashboard: live employee tracking, item detection, and restock priorities

The heatmap view aggregates stock depletion data across the store, highlighting zones with the highest inventory loss. Managers can spot problem areas and allocate restocking effort accordingly:

Stock depletion heatmap
Heatmap overlay showing inventory depletion intensity by store zone

The analytics engine goes beyond basic inventory tracking. It identifies sales anomalies, forecasts short-term demand, and classifies products by velocity, giving store managers actionable intelligence rather than raw data:

AI-powered anomaly detection and forecasting
AI Insights: anomaly detection with surge alerts and demand forecasting

Business Viability

The team also developed financial modeling across three deployment scenarios:

  • Pilot: 1 wearable + 7 anchors
  • Full-store: 20 wearables + 99 anchors
  • Scalable: UL-TDOA architecture with PCB miniaturization

Analysis confirmed commercially viable returns through a hybrid hardware + SaaS revenue model, with sustainability evaluation and IP cost assessment included.

Technical Details

Analytics KPI dashboard
KPI dashboard: stock coverage, turnover rate, and sales metrics at a glance

Data flow: Hardware packets arrive via MQTT → bridge service → FastAPI ingestion → trilateration + detection → WebSocket broadcast to dashboard. Append-only tables with UTC timestamps enable full historical reconstruction and audit trails.

Position calculation: Supports 2-anchor weighted midpoint through 4+ anchor least-squares optimization, with confidence scoring (0.3–0.95 range) based on measurement consistency.

Scalability consideration: The prototype uses DS-TWR (Double-Sided Two-Way Ranging) which limits the number of concurrent tags. For production, the report proposes UL-TDOA (Uplink Time Difference of Arrival) which scales to many more simultaneous devices.

My Role

  • Designed and implemented the entire software platform (backend, frontend, simulation, MQTT bridge, database schema, deployment)
  • Developed a large portion of the ESP32 firmware (sensor orchestration, MQTT communication)
  • Led system architecture and design decisions across the full stack
  • Contributed to hardware assembly, soldering, prototyping, field testing at Decathlon stores

Results

We field-tested the system at Decathlon Bussigny across four site visits. In prototype testing it reached:

Sub-10 cm

UWB localization

~200

RFID tags / cycle

Sub-100 ms

Sensor to dashboard

5h+

Battery runtime

These are prototype figures under test conditions, not production guarantees; the DS-TWR scalability limit above is why the tag count is what it is. The project received the top grade (6/6) and a course performance prize.

What I Learned

  • Building a full system from hardware through firmware to web dashboard taught me how each layer constrains the others: firmware buffer sizes dictate packet formats, which dictate backend parsing, which dictates frontend update rates
  • MQTT is excellent glue between embedded devices and web services, especially with topic-based routing for mode separation
  • Designing a simulation engine that faithfully mimics hardware behavior was essential for rapid iteration without needing the physical device at every step
  • Working with UWB positioning exposed the practical challenges of indoor localization: multipath, anchor placement, and the gap between datasheet accuracy and real-world performance