CPR practice anywhere. A pressure-sensitive pad, a real-time AI patient simulator, and a voice that corrects you within 50 milliseconds.
Built for HackaBull VII (Apr 26, 2026).
Out-of-hospital cardiac arrest survival without bystander CPR is around 10%. With proper compressions, it doubles. The bottleneck is training — not motivation. Revive trains anyone, anywhere, with $50 of hardware and a browser.
You compress a force-sensitive pad. The pad streams pressure peaks over Web Serial. The web app:
- Generates a fresh emergency scenario via Gemini 2.5 Flash (patient demographics, location, decision tree).
- Simulates patient physiology in real time — heart rate, BP, rhythm, oxygenation — based on your compression depth and rate.
- Coaches you out loud through three ElevenLabs voices — a calm instructor for the welcome, a 911 dispatcher reading scenario decisions, a panicked bystander with scenario-customized text.
- Scores you against AHA protocol (depth 2.0–2.4", rate 100–120 BPM, recoil quality, decision timing).
Voice replaces the screen, so your eyes stay on the patient.
- Cinematic intro → click anywhere → calm instructor voice welcomes
- Click BEGIN CPR PROTOCOL → Gemini generates scenario → bystander panics with scenario-specific lines
- Decision screen: 20-second window, pick first action (CPR / pulse check / call 911 / AED)
- Compression screen: depth bar, BPM counter, rhythm wave, anatomical silhouette pulsing with rate, dispatcher voice barking corrections per batch ("Push harder", "Slow down", "Allow recoil")
- Patient reaches ROSC or flatlines → debrief with performance index, breakdown, retry option
git clone https://github.com/VickyAnaJ/Revive.git
cd Revive/web
npm install
cp .env.local.example .env.local # add ElevenLabs + Gemini keys
npm run dev
# open http://localhost:3000 in ChromeFor the hardware: open firmware/revive_firmware.ino in Arduino IDE, flash to UNO R4 Minima, plug into USB. The web app auto-detects via Web Serial. No Arduino? Press Option+Shift+Space for keyboard fallback.
Required env vars:
NEXT_PUBLIC_GEMINI_API_KEY=...
NEXT_PUBLIC_ELEVENLABS_API_KEY=...
NEXT_PUBLIC_ELEVENLABS_VOICE_ID_INSTRUCTOR=...
NEXT_PUBLIC_ELEVENLABS_VOICE_ID_DISPATCHER=...
NEXT_PUBLIC_ELEVENLABS_VOICE_ID_BYSTANDER=...
- Plug Arduino UNO R4 Minima into USB.
cd revive/web && npm run dev.- Open
http://localhost:3000in Chrome (Web Serial requires Chromium). - Click anywhere to unlock audio. Click Connect Pad (or press
Option+Shift+Spaceto fall back to keyboard mode). - Click Begin CPR Protocol to start a session.
If the pad is unplugged or the user is on Safari/Firefox, keyboard mode lets every spacebar press simulate a compression peak. Same scoring, same coach voice.
Ctrl+Cin the terminal runningnpm run dev.- Unplug the Arduino.
- Browser tab can be closed without cleanup — no persistent state outside
.env.local.
If a dev server orphans (port 3000 stuck): pkill -f "next dev" clears it.
- Hardware: Arduino UNO R4 Minima + FSR pressure pad → JSON-over-Web-Serial
- Web: Next.js 16 + React 19 + TypeScript + Tailwind 4
- AI: Gemini 2.5 Flash (3 agents — patient simulation, coach phrases, scenario generation)
- Voice: ElevenLabs
eleven_flash_v2streaming TTS + pre-rendered MP3s + browser SpeechSynthesis fallback - Tests: Vitest, 222 tests, full TypeScript
revive/
├── firmware/ Arduino sketch (force sensor → JSON peaks at 100Hz)
├── web/ Next.js app — UI, state machine, AI agents, voice pipeline
├── api/ FastAPI scaffolding (currently unused; agents run client-side)
├── contracts/ Shared JSON schemas
└── docs/ Internal design + audit docs (gitignored, kept private)
- Gemini 2.5 Flash generates scenarios, simulates patient physiology, and produces coach phrases. Three independent agents with structured JSON output, schema validation, and a 3-tier fallback (retry → cached scenarios → rule-based vitals).
- ElevenLabs flash_v2 drives all spoken voice. Three distinct character voices for instructor / dispatcher / bystander. Pre-rendered MP3s for instant coach corrections; streaming for scenario-specific lines.
When something fails on stage, the demo keeps working:
- Pad disconnected → keyboard fallback (
Option+Shift+Space) - Gemini times out → cached scenarios + rule-based vitals
- ElevenLabs 429 / network down → browser SpeechSynthesis
- Audio blocked → text overlays preserve every coach correction
Built at HackaBull VII at the University of South Florida.