This is a submission for the Presage SmartSpectra SDK Challenge
What I Built
I built FocusPulse, an empathetic, contactless bio-adaptive co-pilot designed for neurodivergent individuals managing ADHD.
People with ADHD struggle daily with sustained attention, hyperfocus burnout, sensory overload, and autonomic task paralysis (a physiological fight-or-flight freeze state). Traditional tools often fail because they require manual tracking or intrusive smartwatches—demanding effort and adding tactile discomfort.
FocusPulse turns any standard webcam into a real-time neuro-physiological monitor. It non-invasively tracks rPPG cardiac vitals, respiratory motion, eye aspect ratios, and head kinematics to detect autonomic stress and mind-wandering before the user consciously experiences burnout. Instead of blaring alarms, FocusPulse responds with non-punitive micro-interventions: peripheral 40Hz focus beats, screen dimming, micro-task chunking, and vagal breathing biofeedback.
Demo
- Live Production App: https://focuspulse-760833501708.us-central1.run.app/
-
Dual Operation Modes:
- Live Webcam rPPG Mode: Click "Enable Camera rPPG" to stream contactless vitals in real time.
- Simulated SmartSpectra Engine: Test all ADHD state triggers instantly without a camera using the built-in scenario switcher.
Code
- Public Repository: https://github.com/AravindFLASH/adhd-google
Setup Instructions
# Clone the repository
git clone [https://github.com/AravindFLASH/adhd-google.git](https://github.com/AravindFLASH/adhd-google.git)
cd adhd-google
# Run the local server
node server.js
Open http://localhost:3000 in Chrome or Edge, click "Enable Camera rPPG", and grant camera permissions.
How It Responds to Human Signals
The Presage SmartSpectra SDK extracts clinical-grade physiological signals without skin contact by analyzing micro-vascular capillary blood volume flushes and optical flow from ordinary consumer webcams.
[ Webcam 30 FPS Video ]
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ PRESAGE SMARTSPECTRA SDK │
│ ├─ rPPG Optical Sensor ───────► Pulse Rate, Plethysmogram & HRV │
│ ├─ Dual-ROI Motion Flow ──────► Upper Chest & Lower Abdomen Waves │
│ └─ 478 Landmark Facial Mesh ──► Eye Blink Rate, EAR & Gaze Vectors │
└───────────────────────────────────┬────────────────────────────────────┘
│ Live Telemetry Stream
▼
┌────────────────────────────────────────────────────────────────────────┐
│ ADHD SIGNAL INTERPRETER ENGINE │
│ ├─ Baseline Calibration (Resting Mean & SD for Vitals) │
│ ├─ Signal Quality Index (SQI Gating out motion noise) │
│ ├─ The "Stimming Paradox" Filter (Protects functional motor ticks) │
│ └─ Multi-Modal State Machine (Flow, Inattention, Freeze, Anxiety) │
└───────────────────────────────────┬────────────────────────────────────┘
│ Bio-Adaptive Event Trigger
▼
┌────────────────────────────────────────────────────────────────────────┐
│ BIO-ADAPTIVE UI │
│ ├─ Ambient Attention Pulse: Cyan halo & 40Hz Gamma Isochronic beat │
│ ├─ Dual-Trace Paced Breathing: 0.1 Hz vagal resonance biofeedback orb │
│ ├─ Micro-Task Paralysis Buster: Dims clutter, auto-chunks into 2m steps│
│ └─ GPU WebGL Shaders: 8,000 bio-reactive particles pulsing with vitals│
└────────────────────────────────────────────────────────────────────────┘
🔬 Mapping Presage SmartSpectra Signals to ADHD Symptoms
| SmartSpectra Signal | Sensor Payload | ADHD Clinical Marker | System Action & Micro-Intervention |
|---|---|---|---|
| Blink Rate & Eye Gaze | Blink frequency, EAR, gaze vectors | Visual Inattention & Mind-Wandering (Hypo-arousal "Zombie Stare" > 6s or off-screen glances) | Gentle Attention Visual Pulse: Peripheral luminance breathing vignette + synthesized 40Hz gamma isochronic audio beat. |
| rPPG Pulse & HRV | Cardiac variability (RMSSD), Baevsky Stress Index, IBI | Task Paralysis & Autonomic Freeze (Sympathetic surge + vagal collapse) | Micro-Task Paralysis Buster: Automatically dims clutter, isolates 1 single 2-minute atomic step, removes choice overload. |
| Dual-Trace Respiration | Upper chest & lower abdominal displacement waveforms | Clavicular Hyperventilation vs. Diaphragmatic Calming (Anxiety / Hypocapnia) | Paced Breathing Biofeedback: Visual expanding/contracting orb synced to 0.1 Hz vagal resonance or 4-4-4-4 box breathing. |
| Head Motion & Stability | Landmark coordinate velocity, optical flow energy | Physical Restlessness / Fidgeting | Adaptive Movement Reset: 60-second tactile energy realignment. (Guarded by the Stimming Paradox: productive stimming with on-screen gaze is protected). |
| Facial Expressions & Valence | Frustration, brow furrow, fatigue, valence | Emotional Dysregulation / Burnout | Sensory De-escalation: Screen dimming, dopamine reset, hydration prompts. |
🚀 Key Features
1. 🫁 Dual-Trace Respiration (Upper Chest vs. Lower Abdomen)
FocusPulse separates and analyzes two distinct respiratory zones via optical flow:
- Upper Chest (Thoracic/Clavicular) Trace: Monitors clavicular elevation (Sky/Cyan trace). High thoracic amplitude flags sympathetic fight-or-flight, anxiety, and hypocapnia risk.
- Lower Abdomen (Diaphragmatic) Trace: Monitors lower belly and diaphragmatic expansion (Emerald trace). Diaphragmatic breathing stimulates the vagus nerve, elevating HRV RMSSD and restoring prefrontal executive control.
-
Thoracoabdominal Ratio (TAR):
$$\text{TAR} = \frac{\text{Upper Thoracic Amplitude}}{\text{Lower Abdominal Amplitude}}$$
- $\text{TAR} > 1.4$: Clavicular Hyperventilation $\rightarrow$ Activates Paced Breathing Guide.
- $\text{TAR} < 0.9$: Optimal Diaphragmatic Regulation $\rightarrow$ Confirms Flow State.
2. 🎧 Web Audio API Engine (40Hz Gamma Isochronic & Binaural Beats)
A zero-dependency neuro-entrainment audio synthesizer built directly in the browser:
- 40Hz Gamma Isochronic Pulses: Periodic amplitude-modulated carrier tone (216 Hz, 432 Hz, or 528 Hz) pulsing at 40Hz. Proven in EEG literature to synchronize cortical gamma oscillations and sustain working memory. Effective on laptop speakers.
-
Stereo Binaural Beats: Dual independent phase-aligned oscillators ($f_L = 216\text{ Hz}$, $f_R = 256\text{ Hz} \rightarrow \Delta f = 40\text{ Hz}$) routed via stereo
ChannelMergerNodefor headphones. - Brownian / Pink Noise Masking Generator: Continuous integrated noise ($1/f^2$ spectral density) providing auditory stochastic resonance to ground racing thoughts and mask distracting ambient office noises.
- Live FFT Analyser: Real-time 32-bin frequency spectrum visualizer rendered on canvas.
3. ✨ Modern Canvas Particle & Shader FX (Bio-WebGL Canvas)
An interactive GPU-accelerated WebGL 3D particle system running 8,000+ particles driven by custom GLSL vertex and fragment shaders:
-
Direct Bio-Signal Synchronization:
-
u_pulse: Particles swell outward on every systolic rPPG heartbeat. -
u_breathing: The entire particle matrix breathes in sync with thoracic/abdominal waves. -
u_audio: Particle sizes and wave heights dance to the live 40Hz audio spectrum. -
u_state: Dynamically shifts color palettes based on ADHD state (Cyan/Emerald for Flow, Amber/Gold for Freeze, Violet/Coral for Restlessness).
-
-
3 Topologies:
- 🧬
Neural Orb: Fibonacci 3D sphere mimicking prefrontal neural firing. - 🌀
Vortex Swarm: Dual-toroidal cosmic particle stream. - 🌐
Quantum Field: 3D wave mesh responding to harmonic frequencies.
- 🧬
- Focus Meditation View: Expand to a distraction-free, full-screen particle canvas with interactive gravitational mouse physics.
4. 🛡️ The "Fidgeting Paradox" Filter
Clinical research demonstrates that physical movement (fidgeting, posture shifting) often acts as an unconscious compensatory mechanism that upregulates dopamine in the prefrontal cortex. FocusPulse implements Multi-Modal Co-occurrence Gating: if high motion energy occurs while gaze is locked on screen and stress is low, it is classified as Productive Stimming and left completely undisturbed.
5. 🧊 Micro-Task Paralysis Buster
When an acute sympathetic freeze is detected ($RMSSD < 18\text{ ms}$, Baevsky Index $> 300$, zero motion), traditional productivity apps fail by sending more alerts. FocusPulse automatically dims background clutter and decomposes daunting tasks into one single 2-minute atomic micro-step to break executive paralysis.
6. ⌚ Zero-Wearable Core with Optional Hybrid Smartwatch Support
While 100% contactless via webcam rPPG, FocusPulse also includes a built-in Web Bluetooth API client (0x180D Heart Rate GATT service). Clicking "Pair Smartwatch (Optional)" allows any BLE heart rate monitor (Apple Watch, Wear OS, Garmin, Polar) to pair as a secondary sensor.
🧪 Interactive Clinical Scenarios
Inside the application's right-hand panel, click any scenario to stress-test how the entire pipeline reacts:
- Balanced Flow State: 72 BPM, 55ms RMSSD, 14 RPM, Diaphragmatic breathing ($TAR < 0.9$).
- Mind-Wandering (Zombie Stare): Prolonged blank fixation (> 8s), blink rate drops to 3/min, gaze drifts off-screen $\rightarrow$ triggers peripheral attention vignette + 40Hz audio focus pulse.
- Task Paralysis & Freeze: HRV collapses to 14ms RMSSD, Baevsky Stress Index spikes to 385, motion drops to near-zero (motor freeze) $\rightarrow$ triggers screen dimming & Micro-Task Chunking assistant.
- Clavicular Hyperventilation: Breathing surges to 27 RPM with upper chest dominance ($TAR > 1.8$) $\rightarrow$ launches interactive Paced Breathing biofeedback orb.
- Agitated Restlessness: Erratic head motion with off-screen gaze $\rightarrow$ launches 60-second movement break.
- Cognitive Burnout: Low autonomic tone, prolonged fatigue $\rightarrow$ triggers sensory de-escalation.
Top comments (0)