-
-
Main page of mobile app (Flutter)
-
Chat interface of mobile app (Flutter)
-
Search pill of mobile app (Flutter)
-
Category view of mobile app (Flutter)
-
Main page of web app (Desktop view)
-
Chat interface of web app (Desktop view)
-
Dashboard of Central Store (Desktop view)
-
Dashboard view of leg machine, central store, web app (Desktop view)
-
Machine page of available machine, web app (Desktop view)
-
Machine page of in-use machine, web app (Desktop view)
GymPulse
Abstract
GymPulse addresses a critical pain point affecting thousands of gym-goers across Hong Kong's rapidly expanding HK$2.8 billion 24/7 fitness ecosystem: equipment availability uncertainty. Despite hundreds of thousands of active gym memberships across major chains¹ like Anytime Fitness, Snap Fitness, and 247 Fitness, members frequently arrive at gyms only to find their preferred equipment occupied, leading to wasted time, modified workout plans, or abandoned sessions entirely.
Our solution transforms this frustrating experience through an AI-powered real-time intelligence system featuring four core capabilities: an Agentic Chatbot that understands natural language queries like "Leg day nearby?" and provides personalized recommendations; Predictive Insights using machine learning to forecast 30-minute equipment availability; Live Equipment Tracking with sub-15-second latency across multiple gym locations; and Interactive Heatmaps revealing 24-hour availability patterns to help users avoid Hong Kong's problematic peak hours (7-9 AM and 7-10 PM).
Built on AWS's cutting-edge serverless architecture, GymPulse implements a sophisticated data pipeline (IoT Simulator → AWS IoT Core → Lambda Functions → DynamoDB → API gateway → Real-time Broadcast → Frontend) processing data from 655 simulated machines across 12 Hong Kong gym branches. The system leverages Google Gemini API for conversational AI with structured tool-use capabilities and employs a multi-model ensemble forecasting engine (MLForecastEngine) combining seasonal decomposition, pattern recognition, trend analysis, and context-aware predictions.
Development was accelerated through Amazon Q Developer's advanced agentic capabilities, enabling rapid implementation of complex AWS service integrations while maintaining production-ready code quality through intelligent code generation, architectural guidance, and automated best practices. Key challenges included mastering AWS cloud infrastructure, orchestrating real-time data pipeline excellence, and implementing WebSocket broadcasting—all overcome through intelligent AI tool assistance.
Our accomplishments demonstrate sophisticated AI integration and an intuitive chat interface that bridges the gap between Hong Kong gym members' natural communication patterns and complex real-time equipment tracking. Looking ahead, GymPulse will evolve into a comprehensive AI-driven fitness ecosystem through an Intelligent Onboarding Chatbot for personalized gym experiences and Complete Fitness Integration combining equipment availability with nutrition coaching, exercise analytics, and wellness monitoring.
GymPulse transforms Hong Kong's gym experience from uncertainty and frustration to informed decision-making, positioning itself as the essential companion for the city's fitness community while showcasing the transformative potential of AWS AI tools in solving real-world urban challenges.
Table of Contents
- 1.1 The Hong Kong Gym Boom
- 1.2 The Hidden Frustration
- 1.3 Current Solutions Fall Short
- 1.4 Our Vision
- 3.1 Data Pipeline Architecture
- 3.2 Overall System Architecture
- 3.2.1 Frontend & Backend Stack
- 3.2.1 Frontend & Backend Stack
- 3.3 AI Function Design
- 3.4 Development & Implementation with Amazon Q Developer
- 4.1 Mastering AWS Cloud Infrastructure Excellence
- 4.2 Orchestrating AWS Real-Time Data Pipeline Excellence
- 4.3 Mastering AWS API Gateway WebSocket Real-Time Broadcasting
Inspiration
The inspiration for GymPulse emerged from a widespread frustration shared by thousands of gym-goers across Hong Kong's rapidly expanding 24/7 fitness ecosystem. The city's fitness landscape has been transformed by the proliferation of round-the-clock gym chains including 247 Fitness, Anytime Fitness, Snap Fitness, and GO24 Fitness, each operating extensive multi-branch networks designed to maximize accessibility and convenience.
The Hong Kong Gym Boom
Hong Kong's unique urban density and demanding work culture have created perfect conditions for the 24/7 gym phenomenon. With a fitness market valued at HK$2.8 billion annually¹, the city has embraced a "train anywhere, anytime" culture that reflects the needs of busy professionals, students, and shift workers who require flexible workout schedules. This substantial market serves hundreds of thousands of fitness enthusiasts across the territory¹.
The appeal of these multi-branch networks lies in their promise of ultimate convenience - members can work out at any location, at any hour, fitting exercise around unpredictable schedules. The landscape includes major players like Anytime Fitness (35+ locations)², Snap Fitness (approximately 17-20 locations)³, GO24 Fitness (9+ locations)⁴, and 247 Fitness with its extensive regional network⁵, along with premium chains like Pure Fitness (21+ premier studios)⁶ and boutique studios like H-Kore and Ozone Fitness. These chains have strategically positioned branches in residential areas, business districts, and transport hubs to maximize accessibility.
The Hidden Frustration
However, this convenience comes with a significant drawback that affects gym-goers daily: equipment availability uncertainty. Despite having multiple location options, members frequently experience the frustration of arriving at their chosen gym only to find their preferred equipment occupied, forcing them to either wait, modify their workout plans, or abandon their session entirely.
This problem is particularly acute in Hong Kong's high-density environment where:
Peak Hours Overwhelm Capacity: Morning (7-9 AM) and evening (7-10 PM) rushes create equipment bottlenecks across all major chains, with gyms reaching 70-90% capacity during these periods⁷ Popular Equipment Creates Queues: Squat racks, bench presses, and cable machines experience significant wait times at busy locations, with gym members frequently reporting difficulties accessing preferred equipment⁸ Branch Hopping Becomes Inefficient: Members waste time traveling between branches without knowing which locations have available equipment Session Planning Falls Apart: Structured workout routines get disrupted when key equipment is unavailable, leading to incomplete or abandoned sessions
Current Solutions Fall Short
While major gym chains across the spectrum - from budget-friendly options like Anytime Fitness and Snap Fitness to premium brands like Pure Fitness - offer mobile apps, these typically provide only club-level "busyness" indicators⁹. Members face the fundamental problem: apps show whether a location is "busy" or "quiet" without the granular, machine-level information needed to make informed decisions.
This limitation spans the entire ecosystem:
24/7 Chains: Basic occupancy tracking without equipment-specific availability Premium Operators: Enhanced apps but still lacking equipment-level detail Boutique Studios: Often no real-time data at all Third-Party Solutions: Focus on workout tracking rather than availability intelligence Social Workarounds: Informal social media updates that are unreliable and limited in scope¹⁰
Our Vision
GymPulse was conceived as a comprehensive solution to bridge this critical information gap across Hong Kong's entire 24/7 fitness ecosystem. Rather than focusing on a single gym chain, we envisioned a platform that could aggregate real-time equipment availability data from multiple gym networks, providing members with the machine-level granularity needed to optimize their workout efficiency.
Our goal is to transform the gym experience from one of uncertainty and frustration to one of informed decision-making, where members can confidently plan their sessions knowing exactly which equipment is available, where, and for how long. By combining real-time IoT data with intelligent routing recommendations, GymPulse aims to eliminate "failed sessions" and maximize the value of Hong Kong's impressive 24/7 fitness infrastructure.
What it does
GymPulse directly addresses the equipment availability uncertainty problem outlined above by providing Hong Kong gym members with machine-level intelligence across multiple gym networks. Our solution transforms the frustrating experience of "arriving at a gym to find equipment occupied" into an informed decision-making process where members know exactly what's available, where, and when.
The platform delivers four core capabilities that solve the critical pain points identified in Hong Kong's 24/7 fitness ecosystem:
Agentic Chatbot
An AI-powered conversational assistant that understands natural language queries like "Leg day nearby?" or "Find chest equipment close to me." The chatbot leverages real-time data, location awareness, and intelligent routing to provide personalized recommendations that optimize both equipment availability and travel time, making the multi-branch gym experience truly seamless.
Predictive Insights
Machine learning-powered 30-minute availability forecasting that predicts when equipment will become free, using historical usage patterns and intelligent algorithms. This feature transforms reactive "branch hopping" into proactive planning, allowing members to time their arrivals for maximum equipment availability.
Live Equipment Tracking
Real-time monitoring of individual gym machines across multiple branches and gym chains, showing precise occupied/free status with sub-15 second latency. This eliminates the guesswork of whether your preferred squat rack or bench press is available before you travel to the gym, directly solving the "equipment uncertainty" problem that affects thousands of Hong Kong gym-goers daily.
Interactive Heatmaps
24-hour availability patterns for each machine and equipment category, providing members with visual insights into peak usage times and optimal workout windows. These heatmaps help users avoid the problematic 7-9 AM and 7-10 PM rush periods that create equipment bottlenecks across major chains, enabling smarter session planning.
How we built it
To address Hong Kong's HK$2.8 billion fitness market's equipment availability uncertainty problem, we architected GymPulse as a comprehensive real-time intelligence system that transforms the gym experience from frustration to informed decision-making across the city's hundreds of thousands of fitness enthusiasts¹.
Data Pipeline Architecture
The foundation enabling our machine-level granularity solution is a robust real-time data pipeline designed to eliminate the "equipment uncertainty" problem affecting thousands of Hong Kong gym-goers daily:
IoT Simulator → AWS IoT Core → Lambda Functions → DynamoDB → Lambda Functions → API Gateway → Real-time Broadcast → Frontend
This serverless pipeline captures equipment status changes from 655 simulated machines across 12 gym branches spanning Central, Causeway Bay, Mongkok, Tsim Sha Tsui, Jordan, Shatin, and Quarry Bay, delivering updates within 15 seconds. Unlike existing gym apps that only show club-level "busyness," our pipeline provides the machine-level detail needed to prevent the significant wait times that plague popular equipment like squat racks and bench presses during Hong Kong's peak hours (7-9 AM and 7-10 PM)⁸.
The efficacy of this pipeline is contingent upon the high-fidelity data generated by the IoT Simulator, which is produced as follows. The foundational positioning data for the IoT Simulator is derived from a meticulously designed Angle of Arrival (AoA) model. This methodology leverages a network of strategically placed WiFi Access Points (APs) within each facility. For cost optimization, some of these APs could be replaced with ESP32 devices, which offer similar functionality at a more affordable price point. When a signal is transmitted from a gym member's smart device, each AP’s antenna array measures the precise angle at which the signal is received.
By processing and triangulating these angular measurements from multiple APs, the system calculates the real-time coordinates of the individual with a high degree of accuracy. This raw locational data is then programmatically correlated with a digital floor plan of the gym. A machine's status is updated to "occupied" only when a user's sustained presence is detected within a predefined operational zone around that piece of equipment. This translation of physical presence into a discrete machine status event is the critical function that provides the realistic, high-fidelity data that the IoT Simulator feeds into our real-time pipeline.
Overall System Architecture
Frontend & Backend Stack
Frontend (React/TypeScript): Designed specifically for Hong Kong's demanding professionals, students, and shift workers who need flexible workout scheduling. Built with Vite, React Router, and Tailwind CSS to deliver responsive experiences across devices. Real-time WebSocket connections power our live equipment tracking, while geolocation integration enables location-aware recommendations that optimize travel time across Hong Kong's multi-branch networks like Anytime Fitness (35+ locations)², Snap Fitness (approximately 17-20 locations)³, and 247 Fitness with its extensive regional network⁵.
Backend (AWS Cloud Infrastructure): Fully serverless architecture using AWS CDK for infrastructure-as-code deployment across Hong Kong's gym ecosystem. AWS IoT Core handles device data ingestion from our simulated gym equipment, Lambda functions process real-time updates and AI queries, DynamoDB stores equipment states and historical patterns reflecting authentic Hong Kong 24/7 fitness usage, and API Gateway provides both REST endpoints and WebSocket support for seamless real-time updates.
AI Function Design
To deliver the intelligent capabilities that differentiate GymPulse in addressing Hong Kong's specific gym challenges, we implemented two sophisticated AI components:
Agentic Chatbot Design
Our conversational AI leverages Google Gemini API with structured tool-use capabilities to understand natural language queries like "Leg day nearby?" The chatbot combines real-time equipment data with Hong Kong's dense urban geography to provide intelligent routing decisions. By understanding the city's unique "train anywhere, anytime" culture, it optimizes recommendations for busy professionals who need to fit workouts around unpredictable schedules, directly solving the inefficient "branch hopping" problem described in our motivation.
Predictive Forecasting Algorithm
Our machine learning forecasting engine employs a sophisticated multi-model ensemble system (MLForecastEngine) specifically tuned for Hong Kong's 24/7 fitness patterns. The system combines multiple machine learning models, statistical analysis, and Gemini AI insights to deliver accurate 30-minute equipment availability predictions.
Multi-Model Ensemble Architecture:
- Seasonal Decomposition: Analyzes weekly patterns with trend calculation using linear regression to understand Hong Kong's unique work-week fitness cycles
- Pattern Recognition: Advanced statistical analysis with weekend/weekday differentiation, capturing the distinct usage patterns of Hong Kong's demanding professional schedule
- Trend Analysis: Momentum indicators with 3-day recent trend analysis and momentum weighting for responsive adaptation to changing gym usage
- Context-Aware Forecasting: Real-time adjustments based on current machine status and time proximity to Hong Kong's critical peak hours
- Ensemble Prediction: Weighted combination of all models (30% seasonal, 30% pattern, 20% trend, 20% context-aware) for robust predictions
AI-Powered Quality Assurance:
- Anomaly Detection: Statistical z-score analysis (threshold: 2.0 standard deviations) identifies unusual usage patterns affecting forecast reliability
- Gemini AI Integration: Google Gemini 2.0 Flash API generates natural language insights and actionable recommendations for gym management
- Dynamic Confidence Scoring: Multi-factor calculation using data quantity (40%), model agreement (50%), and anomaly penalties (10%) ensures reliable predictions
- Quality Validation: Minimum 48 data points for ML models with automatic fallback to simpler statistical models when insufficient data
Real-Time Implementation: The system queries 20-day historical windows, processes NumPy structured arrays including Hong Kong-specific indicators (peak hour flags, weekend patterns), and delivers color-coded predictions through React frontend PredictionChip components. This transforms reactive session planning into proactive scheduling, directly addressing the "session planning falls apart" problem by enabling Hong Kong gym members to confidently schedule workouts knowing exactly when their preferred squat rack or bench press will be available.
Development & Implementation with Amazon Q Developer
Agentic Development Capabilities
Amazon Q Developer's agentic capabilities fundamentally transformed our approach to building complex serverless IoT systems. Unlike traditional code completion tools, Q Developer demonstrated true autonomous intelligence by understanding our entire GymPulse architecture context and proactively suggesting optimal integration patterns across the complete AWS ecosystem. Its workspace context awareness enabled seamless coordination between AWS IoT Core, Lambda functions, DynamoDB optimization, and API Gateway implementation, automatically generating production-ready infrastructure code that adhered to AWS security and performance best practices.
The tool's autonomous debugging capabilities proved revolutionary when optimizing our machine learning forecasting pipeline for Hong Kong's demanding peak hours (7-9 AM and 7-10 PM). Q Developer didn't just identify performance bottlenecks—it provided comprehensive solutions including optimal Lambda memory allocation strategies, advanced DynamoDB query optimization patterns, and intelligent connection pooling techniques that enabled us to achieve the sub-15-second latency requirements critical for real-time gym equipment recommendations.
Intelligent AWS Infrastructure Generation
Q Developer's CDK code generation capabilities accelerated our infrastructure development by orders of magnitude. When we described our requirements for real-time data processing across 12 Hong Kong gym locations, Q Developer autonomously generated comprehensive infrastructure-as-code definitions that included sophisticated error handling, retry logic patterns, and monitoring configurations. The tool's deep understanding of AWS service interdependencies enabled it to suggest architectural improvements we hadn't initially considered, such as optimal DynamoDB table designs specifically tuned for Hong Kong's unique peak hour patterns and sophisticated WebSocket connection management strategies.
Challenges we ran into
Building GymPulse to solve Hong Kong's gym equipment availability crisis required overcoming significant technical challenges, particularly as our first deep dive into AWS cloud infrastructure for a real-time IoT system serving hundreds of thousands of fitness enthusiasts across the city's demanding 24/7 fitness ecosystem¹.
1. Mastering AWS Cloud Infrastructure Excellence
Challenge: As developers new to AWS cloud infrastructure, we were excited to leverage the powerful ecosystem of AWS IoT Core, Lambda functions, DynamoDB, and API Gateway to build a sophisticated real-time system for 655 machines across 12 Hong Kong gym branches. The rich feature set and integration possibilities of AWS services presented an exciting opportunity to architect a truly scalable solution with sub-15-second latency capabilities.
Amazon Q Developer Enablement: Q Developer proved to be an exceptional learning accelerator, transforming our AWS journey from exploration to expertise. Its intelligent suggestions guided us through AWS CDK best practices, recommended optimal serverless configurations, and illuminated powerful service integration patterns we hadn't initially considered. When designing our DynamoDB architecture for Hong Kong's unique peak hour patterns (7-9 AM and 7-10 PM), Q Developer's recommendations led us to an elegant multi-table design that perfectly handles current state, events, aggregates, and alerts with impressive efficiency.
Achievement: With Q Developer's intelligent guidance, we rapidly mastered AWS infrastructure-as-code principles and successfully deployed a production-ready serverless architecture. Q Developer's contextual insights helped us implement AWS best practices from day one, resulting in a robust system that showcases the power and flexibility of the AWS ecosystem.
2. Orchestrating AWS Real-Time Data Pipeline Excellence
Challenge: Building an end-to-end real-time data pipeline leveraging AWS's comprehensive IoT and serverless ecosystem (IoT simulator → AWS IoT Core → Lambda → DynamoDB → API Gateway→ frontend) to achieve <15 second latency presented an exciting systems integration opportunity. The sophistication of coordinating multiple AWS services while maintaining real-time performance across 12 Hong Kong gym locations showcased the impressive capabilities of AWS's interconnected service architecture.
Q Developer Intelligence: Q Developer's advanced debugging capabilities became our secret weapon for optimizing this complex AWS service integration. Its intelligent analysis helped us discover optimal connection pooling strategies for Lambda functions, suggested robust retry logic patterns for MQTT publishing, and revealed powerful WebSocket connection management techniques that maximized reliability for Hong Kong gym members. Q Developer's insights transformed our debugging process into a systematic optimization journey.
Achievement: Through Q Developer's guidance, we successfully implemented comprehensive monitoring and resilient architecture patterns throughout our AWS pipeline. This systematic approach, enhanced by Q Developer's suggestions for error handling and logging best practices, enabled us to achieve the exceptional real-time performance that makes GymPulse's equipment recommendations truly actionable during Hong Kong's intense peak hours.
3. Mastering AWS API Gateway WebSocket Real-Time Broadcasting
Challenge: Implementing AWS API Gateway WebSocket for real-time equipment updates represented an exciting opportunity to leverage AWS's advanced real-time communication capabilities. We aimed to ensure that equipment status changes across our 12 simulated Hong Kong gym locations would instantly reach all connected clients, showcasing the impressive real-time potential of AWS's WebSocket infrastructure. The sophistication of managing WebSocket connections through DynamoDB, coordinating broadcast Lambda functions, and integrating with our data pipeline highlighted the robust capabilities of AWS's interconnected services.
Q Developer Architectural Excellence: Q Developer's architectural intelligence became invaluable for mastering AWS API Gateway WebSocket patterns and best practices. Its expert recommendations guided us to elegant connection management solutions using DynamoDB, suggested highly efficient broadcasting strategies, and provided deep insights into connection lifecycle optimization. Q Developer's suggestions for API Gateway integration patterns and Lambda function optimization unlocked the full potential of AWS's real-time communication infrastructure for our Hong Kong multi-branch gym network.
Achievement: With Q Developer's architectural guidance, we successfully deployed a sophisticated WebSocket broadcasting system that demonstrates the exceptional real-time capabilities of AWS services. This implementation delivers instant equipment availability updates to Hong Kong gym members, perfectly embodying our vision of transforming "equipment uncertainty" into confident, informed workout planning through the power of AWS real-time infrastructure.
Accomplishments that we're proud of
We successfully delivered two key innovations that directly address Hong Kong's gym equipment availability crisis:
Sophisticated AI Integration
Implemented an advanced conversational AI system with structured tool-use capabilities, location awareness, and multi-modal responses that transform Hong Kong's gym experience. Our agentic chatbot leverages Google Gemini API to understand natural language queries and provide actionable recommendations based on real-time equipment data and intelligent routing calculations, directly solving the "branch hopping" inefficiency that plagues Hong Kong's multi-location gym networks.
Intuitive Chat Interface
Developed a natural language interface that seamlessly handles complex queries like "Leg day nearby?" and "Find chest equipment close to me," returning structured recommendations with ETA calculations, real-time availability counts, and interactive navigation. This interface successfully bridges the gap between Hong Kong gym members' natural communication patterns and the technical complexity of real-time equipment tracking across 12 gym locations, making machine-level availability intelligence accessible to everyday users.
What we learned
Building GymPulse provided invaluable insights into leveraging Amazon Q Developer's cutting-edge AI capabilities to accelerate complex AWS system implementation:
Amazon Q Developer's Agentic Intelligence
Amazon Q Developer's agentic coding capabilities revolutionized our development approach beyond traditional code completion. The tool's ability to autonomously perform multistep tasks—from generating comprehensive CDK infrastructure definitions to implementing complex WebSocket broadcasting patterns—demonstrated the power of workspace context awareness. Q Developer's understanding of our entire project structure enabled it to suggest AWS service integration patterns we hadn't initially considered, such as optimal DynamoDB table designs for Hong Kong's peak hour patterns and sophisticated Lambda optimization strategies. This experience taught us that modern AI development assistants can serve as architectural advisors, not just code generators, fundamentally changing how we approach complex serverless system development.
What's next for GymPulse
Building on our successful solution to Hong Kong's gym equipment availability crisis, GymPulse will evolve into a comprehensive AI-driven fitness ecosystem through two transformative developments:
Intelligent Onboarding Chatbot
An advanced AI assistant that personalizes the entire gym experience from the moment users join. This chatbot will guide new members through personalized gym plan setup based on their fitness goals, experience level, schedule constraints, and Hong Kong lifestyle preferences. By understanding whether users are busy Central district professionals needing quick 30-minute sessions or shift workers requiring flexible late-night access, the onboarding bot will configure optimal equipment preferences, workout style selections, and availability notification settings tailored to Hong Kong's unique 24/7 fitness culture.
Complete Fitness Integration
Transform GymPulse from equipment tracking into the "must-have" comprehensive fitness app that seamlessly orchestrates every aspect of the fitness journey. This evolution will integrate our real-time equipment availability intelligence with:
- AI Nutrition Coach: Meal planning and macro tracking synchronized with workout schedules and gym availability, optimized for Hong Kong's dining culture and busy professional lifestyle
- Exercise Analytics: Comprehensive workout logging with AI-powered form feedback and performance tracking that correlates with equipment usage patterns across gym locations
- Wellness Ecosystem: Holistic health monitoring including water intake, body measurements, and progress visualization, all connected through "behind-the-scenes" automation that links equipment availability with personalized workout plans, nutrition timing, and recovery scheduling
This integrated approach will position GymPulse as the essential companion for Hong Kong's fitness community, transforming our equipment uncertainty solution into a complete fitness ecosystem that eliminates friction between intention and action across every aspect of the fitness journey.
Appendix A: Technical Implementation of Angle of Arrival (AoA) Estimation
1. Introduction
The Angle of Arrival (AoA) estimation methodology in our system is based on the high-resolution Multiple Signal Classification (MUSIC) algorithm, a subspace-based technique formally detailed in the foundational 1986 paper by R. O. Schmidt. This method is renowned for its ability to provide asymptotically unbiased estimates of signal parameters. This appendix outlines the mathematical framework of the MUSIC algorithm and the subsequent triangulation process used to determine a user's position.
2. Signal Model and Array Steering Vector
We model the antenna configuration at each Access Point (AP) as a Uniform Linear Array (ULA) consisting of M antenna elements separated by a uniform distance d . To prevent spatial aliasing, this distance is typically set to half the signal's wavelength \(λ\).
When a signal from a source arrives at the array with an angle θ , a phase shift is induced across the elements. The array's response to this angle is described by the steering vector, a(θ) , a cornerstone of array signal processing.
$$a(\theta) = \begin{bmatrix} 1 \ e^{-j \frac{2\pi}{\lambda} d \sin(\theta)} \ e^{-j \frac{2\pi}{\lambda} 2d \sin(\theta)} \ \vdots \ e^{-j \frac{2\pi}{\lambda} (M-1)d \sin(\theta)} \end{bmatrix}$$
The vector of signals received by the M M antennas, x(t) , is modeled as the steering vector multiplied by the source signal s(t) , plus an additive white Gaussian noise vector n(t) .
$$x(t) = a(\theta)s(t) + n(t)$$
3. The MUSIC Algorithm
The MUSIC algorithm exploits the eigen-structure of the signal's spatial covariance matrix to estimate its direction of arrival.
Step 1: Spatial Covariance Matrix Estimation
The algorithm begins by estimating the spatial covariance matrix, Rx , from the received signal vectors. This is achieved by averaging the outer product of the signal vector with its conjugate transpose ( \(xH (t)\) over N discrete time samples.
$$\hat{R}_x = \frac{1}{N} \sum_{k=1}^{N} x(t_k)x^H(t_k)$$
Step 2: Eigenvalue Decomposition
An eigenvalue decomposition is performed on the estimated covariance matrix Rx , yielding M eigenvalues and their corresponding eigenvectors, E .
$$\hat{R}_x E = E \Lambda$$
Here, E E is the matrix of eigenvectors and Λ is a diagonal matrix of the eigenvalues.
Step 3: Subspace Partitioning
The eigenvectors are then partitioned into two orthogonal subspaces. For a single signal source:
Signal Subspace (Es): Spanned by the eigenvector corresponding to the largest eigenvalue.
Noise Subspace (En): Spanned by the remaining M−1 eigenvectors associated with noise.
A fundamental principle of MUSIC is that the steering vector of the true signal, (true), is orthogonal to the noise subspace.
Step 4: Construction of the MUSIC Pseudospectrum
This orthogonality is used to find the AoA. A pseudospectrum function, PMUSIC(), is created where the denominator is the squared norm of the projection of a test steering vector a(θ) onto the noise subspace.
$$P_{MUSIC}(\theta) = \frac{1}{a^H(\theta) E_n E_n^H a(\theta)}$$
When the test angle θ matches the true angle, the denominator approaches zero, creating a sharp peak in the function's output.
Step 5: AoA Estimation
The AoA is estimated by finding the angle θ θ that maximizes the pseudospectrum.
$$\hat{\theta}_{AoA} = \underset{\theta}{\operatorname{argmax}} P_{MUSIC}(\theta)$$
4. Positioning via Triangulation
Once AoA estimates, i , are obtained from multiple APs at known locations (xi, yi), the user's position (xu, yu) is determined. Each AoA defines a line which can be expressed in a linear form:
$$x_u \sin(\hat{\theta}_i) - y_u \cos(\hat{\theta}_i) = x_i \sin(\hat{\theta}_i) - y_i \cos(\hat{\theta}_i)$$
With three or more APs, this forms an overdetermined system of linear equations (Ap=b).
$$\begin{bmatrix} \sin(\hat{\theta}_1) & -\cos(\hat{\theta}_1)
\sin(\hat{\theta}_2) & -\cos(\hat{\theta}_2)
\vdots & \vdots
\sin(\hat{\theta}_K) & -\cos(\hat{\theta}_K) \end{bmatrix} \begin{bmatrix} x_u
y_u \end{bmatrix} = \begin{bmatrix} x_1 \sin(\hat{\theta}_1) - y_1 \cos(\hat{\theta}_1)
x_2 \sin(\hat{\theta}_2) - y_2 \cos(\hat{\theta}_2)
\vdots
x_K \sin(\hat{\theta}_K) - y_K \cos(\hat{\theta}_K) \end{bmatrix}$$
This system is solved using the linear least-squares method, which minimizes the error to find the most probable position, p.
$$\hat{\mathbf{p}} = (A^T A)^{-1} A^T b$$
The resulting coordinate vector, \(p=[xu,yu]T\) , provides the high-fidelity location data used by the IoT simulator.
References
China Daily Hong Kong. "Hong Kong fitness market valued at HK$2.8 billion annually." https://www.chinadailyhk.com/hk/article/131382
South China Morning Post. "US-based Anytime Fitness picks three new locations in Hong Kong." https://www.scmp.com/business/article/3177372/us-based-anytime-fitness-picks-three-new-locations-hong-kong-it-targets
Hong Kong City Guide. "Guide to the biggest gym chains in Hong Kong." https://www.hk-cityguide.com/expat-guide/guide-to-the-biggest-gym-chains-in-hong-kong
InvestHK. "US gym brand GO24 Fitness expands in Hong Kong." https://www.investhk.gov.hk/ja/news/us-gym-brand-go24-fitness-expands-in-hong-kong/
247 Fitness. "Find Us - Location Directory." https://247.fitness/en/find-us/
Pure Fitness. "21 premier studios in Hong Kong." https://www.pure-360.com.hk/en/
Pursue Fitness. "When is the gym least busy - Peak hours analysis." https://www.pursuefitness.com/blogs/news/when-is-the-gym-least-busy-your-guide-to-peaceful-workouts
Reddit Hong Kong. "Weightlifting gyms - Equipment availability discussions." https://www.reddit.com/r/HongKong/comments/9etlyw/weightlifting_gyms/
App Store. "Anytime Fitness App - Features and functionality." https://apps.apple.com/us/app/af-app/id1598355340
GeoExpat Forum. "Hong Kong gym discussions and member experiences." https://geoexpat.com/forum/33/thread244774.html
Wachowiak, M. (2021). music-aoa-estimation-py (Version 1.0).
GitHub. https://github.com/MarcinWachowiak/music-aoa-estimation-py
Log in or sign up for Devpost to join the conversation.