Back to projects
FitnessIn Progress

PedalAI

Transform any spin bike into a smart trainer with AI-powered workouts, automated resistance control, and biometric tracking.

November 15, 2025
ReactTypeScriptPythonRaspberry PiStepper MotorWeb Bluetooth
Share:

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

PedalAI Architecture

Tech Stack

ComponentTechnology
Web AppReact 18, TypeScript, Vite, Zustand
Device ControllerPython 3.11, WebSocket server
Local StorageIndexedDB via Dexie.js
BluetoothWeb 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 BikePedalAI
$1,500–$3,000+~$150 in parts
Monthly subscriptionNo subscription
Proprietary appOpen source PWA
Cloud-dependentOffline-first
Fixed bike modelWorks 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

FullStackGrower

Appearance

Connect