Skip to content
joshnaim1Public

About

Pressure-sensing balance board + web app for objective stroke rehab therapy. Live metrics, games, progress tracking. ~$74 hardware.

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

ReBalance logo

ReBalance

Objective balance therapy · ~$74 in parts · zero bias

A pressure-sensitive balance board that turns stroke rehab into an objective, gamified experience — built for the oSTEM × CPES Hackathon at Cal Poly · Spring 2026.


oSTEM × CPES Cal Poly ~$74 BOM No Backend


React Vite Tailwind CSS Arduino Web Serial Gemini License: MIT


Joshua Naim · Brian Li


The problem · What we built · Tech stack · Architecture · Hardware (~$74) · Quick start · Clinical objectivity


The problem

Balance therapy after stroke is subjective, boring, and expensive.

800K

strokes per year
in the United States

30%

therapy compliance
by month 3

$14,000

typical cost
of clinical balance systems

Patients need repeatable feedback and motivation to keep practicing. Clinicians need objective metrics, not guesswork. And the system should not demand a cloud stack, a $14k cart, or data that has nothing to do with balance.


What we built

ReBalance is a pressure-sensitive balance board paired with a React dashboard that reads live weight distribution over USB and turns it into therapy you can measure.

⚖️

Live Balance
Real-time left/right weight distribution and balance score

🎮

Balance Games
Therapeutic games controlled by shifting your weight

📈

Progress Tracking
Session history and improvement over time

🤖

AI Analysis
Objective clinical notes from pure sensor data

Judges & reviewers: Click Try Demo Mode in the app — no board required. Every tab works with simulated pressure data.


Tech stack

Software

Layer Technology
UI React 19 + Vite 8
Styling Tailwind CSS 4
Charts Recharts 3
Games HTML5 Canvas (gameRenderer.js, HiDPI canvas)
Browser I/O Web Serial API (Chrome / Edge)
Storage localStorage — sessions, profile, calibration
AI Google Gemini 2.5 Flash
Quality Vitest · Testing Library · fast-check

Hardware

Component Role
4× FSR sensors (RP-S40-ST) Pressure detection under the board
Arduino UNO R3 (ELEGOO) Aggregates readings → serial stream ~20 Hz
USB cable (~6 ft) Power + data to the laptop
Breadboard + jumpers Prototype wiring
Custom board + liner Patient-facing standing surface

Total prototype cost: ~$74 — see bill of materials.

Design principles (from our hackathon pitch)

Principle How ReBalance delivers
No backend Everything runs in the browser; data stays on-device
No WiFi / Bluetooth / cloud USB cable only — plug in and go
Zero bias Therapy-relevant data only; AI grounded in sensor metrics
Cost-effective Clinical-grade feedback loop at hobbyist BOM cost

System architecture

  ┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────────────┐
  │  4 × FSR    │     │  Arduino    │     │  USB cable  │     │  Chrome + React     │
  │  sensors    │ ──► │  Uno R3     │ ──► │  (6 ft)     │ ──► │  Web Serial API     │
  │  pressure   │     │  ~20 Hz     │     │             │     │  dashboard + AI     │
  └─────────────┘     └─────────────┘     └─────────────┘     └─────────────────────┘

No WiFi · No Bluetooth · No cloud · No backend · Just a cable.

Stage Detail
Sensors Four force-sensitive resistors detect foot pressure
MCU Firmware sums left/right channels → left,right lines over serial
Transport Web Serial @ 9600 baud, newline-delimited (BALANCEBACK_READY handshake)
App useSerial → balanceCalc → live UI, sessions, games, optional Gemini chat
                    ┌──────────────────────────────────────┐
                    │      ReBalance React Dashboard        │
                    │  Home · Game · Sessions · Progress    │
                    │  Profile · TherapyChat (Gemini)       │
                    └──────────────────┬───────────────────┘
                                       │ USB
                                       ▼
                    ┌──────────────────────────────────────┐
                    │  Arduino UNO + 4× FSR balance board   │
                    └──────────────────────────────────────┘

Hardware build (~$74)

Cost-effective prototyping with high-fidelity sensor integration and few parts.

Category Item Cost
MCU Arduino ELEGOO UNO R3 $16.99
Sensors 4× FSR (RP-S40-ST) $23.98
Wiring Breadboard + jumper wires $9.99
Connection USB cable $5.99
Build Local supplies (tape, liner) + board ~$27
Total ~$74

Serial protocol (firmware ↔ app)

Line Meaning
BALANCEBACK_READY Board ready
1234,5678 Left and right pressure integers

Calibration in-app: stand centered 5 seconds → baseline saved to localStorage for accurate L/R percentages.


Quick start

Run the dashboard

git clone https://github.com/joshnaim1/balanceback.git
cd balanceback
npm install
npm run dev

Open in Chrome or Edge → use Try Demo Mode or Connect Board.

Step Action
1 Demo mode — try the full UX without hardware
2 Complete the getting started wizard
3 Sessions — start a timed balance session
4 Game — play Balance Training, Balance Bird, or Balance Jump
5 Progress — view charts after logging data

Optional: AI features

# .env.local
VITE_GEMINI_API_KEY=your_key_here

Scripts

npm run build    # production bundle
npm run test     # Vitest + property tests
npm run lint     # ESLint

Clinical objectivity

The board doesn't read charts. It reads pressure.

Measures balance with sensors Not therapist judgment alone
Captures therapy-relevant data only No demographics, identity, or unrelated history in the AI context
AI clinical notes Generated from pure sensor data — numbers in, insight out
We collect We do not collect
Display name, optional pronouns Legal sex, gender marker
Stroke/injury date, affected side Gender-affirming care history
Therapy goals, session feelings Unrelated medical / EHR data
Balance scores, L/R %, duration Pharmacy, billing, insurance

All records stay in localStorage on the patient's machine. Export JSON anytime. See in-app Data Transparency (🛡️) and AISourceDisclosure on AI-generated notes.

Disclaimer: ReBalance is a hackathon prototype for balance practice and education. It is not FDA-cleared and does not replace licensed clinical care.


Project structure

src/
├── App.jsx                 # Shell, tabs, wizard, calibration
├── components/             # Games, SessionLog, ProgressChart, HomePage, …
├── hooks/                  # useSerial, useGameLoop, useReducedMotion, …
└── utils/                  # balanceCalc, storage, sessionAnalytics

Accessibility specs: .kiro/specs/ui-accessibility-improvements/


Hackathon

Event oSTEM × CPES Hackathon
Host Cal Poly
Season Spring 2026
Team Joshua Naim & Brian Li
Tagline $74 in parts. No backend. No bias.

License

MIT License — Copyright © 2026 Brian Li and Joshua Naim

About

Pressure-sensing balance board + web app for objective stroke rehab therapy. Live metrics, games, progress tracking. ~$74 hardware.

Resources

Contributing

Security policy

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages