The Problem
Smart bikes with automated resistance cost $1,500–$3,000+ and lock you into monthly subscription services for guided workouts. Meanwhile, a perfectly good basic spin bike sits in my home office, requiring manual resistance adjustments during every interval with no programmatic control over resistance levels or workout progression.
The Solution
PedalAI converts any spin bike into a smart trainer:
- Automated Resistance: Stepper motor controlled by Raspberry Pi
- AI Workouts: Pre-built programs + custom workout builder
- Biometric Integration: Heart rate monitors and cadence sensors via Bluetooth
- Offline-First: Full functionality without internet
System Design
Tech Stack
| Component | Technology |
|---|---|
| Web App | React 18, TypeScript, Vite, Zustand |
| Device Controller | Python 3.11, WebSocket server |
| Local Storage | IndexedDB via Dexie.js |
| Bluetooth | Web Bluetooth API |
| Cloud (Optional) | Vercel Edge Functions, PostgreSQL |
Features
Workout Management
- Pre-built Library: Norwegian 4x4, HIIT, endurance programs
- Custom Builder: Create personalized workouts with phases
- Phase Types: Warmup, intervals, recovery, cooldown, steady
Real-Time Tracking
- Heart rate zones and cadence targets
- Live resistance display
- Calories and distance estimates
- Session recording with playback
Multi-User Support
- Up to 5 profiles per device
- Individual calibration settings
- Separate session history
Current Status: On Hold
The software MVP is complete:
- Full React PWA with offline support
- Python device controller with WebSocket server
- Workout player and builder
- Session analytics
Waiting for hardware: Project paused while sourcing parts:
- Raspberry Pi Zero 2 W
- NEMA 17 stepper motor
- Motor driver board
Why DIY?
| Commercial Smart Bike | PedalAI |
|---|---|
| $1,500–$3,000+ | ~$150 in parts |
| Monthly subscription | No subscription |
| Proprietary app | Open source PWA |
| Cloud-dependent | Offline-first |
| Fixed bike model | Works with any bike |
Technical Highlights
Resistance Control
The Raspberry Pi controls a stepper motor attached to the bike's resistance knob:
- Precise position control (not just "harder/easier")
- Calibration wizard maps motor positions to resistance levels
- Smooth transitions during workouts
Bluetooth Integration
The Web Bluetooth API connects to standard fitness sensors:
- Heart rate monitors (Polar, Garmin, etc.)
- Cadence sensors
- 10Hz telemetry updates
Offline Architecture
The app is designed to work without connectivity:
- IndexedDB stores all workout data locally
- PWA works without internet
- Optional cloud sync for cross-device access
Related Articles
- Smart Bike on a Budget (Work in Progress): Converting a basic spin bike into an AI-powered trainer