Smart bikes like Peloton cost $1,500–$3,000 and require monthly subscriptions. I have a perfectly functional spin bike, but the hassle of manually adjusting resistance during intervals keeps it from getting much use.
What if a Raspberry Pi and a stepper motor could solve that problem for under a few hundred dollars?
The Concept
Attach a small motor to the bike's resistance knob and control it via a web app during workouts.
Cost comparison:
| Solution | Hardware | Monthly |
|---|---|---|
| Peloton Bike+ | $2,495 | $44 |
| Bowflex VeloCore | $1,699 | $20 |
| DIY PedalAI | ~$150 | $0 |
The economics are compelling.
System Design
Software Stack
| Component | Technology |
|---|---|
| Web App | React 18, TypeScript, Zustand |
| Device Controller | Python 3.11, WebSocket server |
| Local Storage | IndexedDB (Dexie.js) |
| Bluetooth | Web Bluetooth API |
| Cloud (Optional) | Vercel Edge Functions |
Safety Systems
Automated resistance control requires careful safety engineering:
- Fail-Safe: Returns to minimum resistance within 500ms if communication is lost
- Rate Limiting: Max 20% change per second (prevents jarring transitions)
- Latency Target: Command-to-actuation under 100ms
- Emergency Stop: Hardware button overrides all software
Key Features
Workout Management
Pre-Built Library:
- Norwegian 4x4 (high-intensity intervals)
- HIIT programs
- Endurance rides
- Recovery sessions
Custom Builder:
- Define phases (warmup, intervals, recovery, cooldown)
- Set target cadence and resistance for each
- Save and reuse workout templates

Biometric Integration
The Web Bluetooth API connects to standard fitness sensors:
- Heart rate monitors (Polar, Garmin, etc.)
- Cadence sensors
- 10Hz telemetry updates
Workout intensity adjusts based on heart rate zones.
Multi-User Profiles
- Up to 5 users per device
- Individual calibration settings
- Separate session history
- Personal analytics
Session Tracking
Every ride records:
- Resistance over time
- Heart rate zones
- Cadence
- Estimated calories/distance
- Performance scores
Development Progress
Completed
Web App (100%):
- Full PWA with offline support
- Workout player and builder
- Settings and calibration UI
- Session analytics and history
Device Controller (100%):
- Python WebSocket server
- Motor control abstraction
- Safety systems
- Sensor integration
Waiting on Hardware
- Raspberry Pi Zero 2 W
- NEMA 17 stepper motor
- A4988 motor driver
- 12V power supply
- 3D printed mounting bracket
Technical Challenges
Resistance Calibration
Every bike's resistance knob is different. The calibration wizard:
- User sets bike to minimum resistance
- Motor records position
- User sets bike to maximum resistance
- Motor records position
- Software maps positions to percentage
This creates a personalized resistance curve for each bike.
Why Open Source?
Commercial smart bikes are black boxes. If the company pivots, your bike becomes dumb again.
PedalAI is fully open source:
- Modify workouts however you want
- Add sensors the app doesn't support
- Keep using it forever, no subscription
The code is mostly ready but some tweaks are likely needed. Once the hardware arrives and mounting is solved, the project will be documented end-to-end.
Next Steps
- Hardware acquisition: Parts mostly selected, almost ready to order
- Mounting design: A 3D-printed bracket would be ideal, but the initial PoC will likely use plywood, screws, and zip ties
- Integration testing: Software + motor + bike
- Calibration refinement: Real-world resistance curves
- Simulated AI coach: Adaptive resistance based on heart rate feedback
- Terrain visual profiles: Generate simulated hills and flats
- Documentation: Complete build guide
The goal is a reproducible project anyone with basic DIY skills can build. Smart fitness shouldn't require a $2,000 bike or a monthly subscription.
