NYU TANDON · ECE-GY 9953 · FALL 2025

NeuroCardiacShield

A complete multi-modal physiological monitoring platform that integrates brain and heart signals for real-time health risk assessment

We built an end-to-end system from embedded firmware to machine learning to demonstrate how next-generation wearable medical devices could detect cardiovascular-neurological risks before they become emergencies.

11
Signal Channels
8 EEG + 3 ECG
76
ML Features
Hand-crafted
250
Hz Sample Rate
Real-time
4
System Layers
Full stack
Mohd Sarfaraz Faiyaz
Systems & ML
Vaibhav D. Chandgir
Signal Processing
Advisor: Dr. Matthew Campisi
Scroll to explore
01 — THE PROBLEM

Why This Matters

Every year, millions of people experience sudden cardiac events or neurological emergencies that could have been predicted. Current wearables monitor heart OR brain — never both together.

Cardiac Events

805,000heart attacks per year in the US alone

Many cardiac arrhythmias produce neurological symptoms (dizziness, syncope) before the heart attack occurs. Current ECG monitors miss these warning signs.

Neurological Events

1 in 26people will develop epilepsy

SUDEP (Sudden Unexpected Death in Epilepsy) kills thousands yearly. These deaths involve cardiac arrhythmias triggered by seizures — a brain-heart connection that single-modality devices cannot detect.

The Gap We Address

The heart and brain are bidirectionally connected through the autonomic nervous system. Cardiac events affect brain function; neurological events affect heart rhythm. No consumer device monitors both simultaneously.

NeuroCardiac Shield demonstrates how such a device would be built — from signal acquisition to machine learning inference — as a complete reference implementation.

02 — OUR SOLUTION

What We Built

A complete end-to-end system that captures brain and heart signals, processes them in real-time, extracts clinically meaningful features, and predicts health risks using machine learning.

Hardware Layer

C firmware simulating an embedded device that captures 8-channel EEG and 3-lead ECG at 250 Hz.

  • • 569-byte binary packets
  • • 10 packets/second throughput
  • • BLE communication stub

Signal Processing

Digital signal processing pipeline using validated algorithms from clinical literature.

  • • Butterworth bandpass filters
  • • R-peak detection (Pan-Tompkins)
  • • Welch PSD estimation

ML Inference

Ensemble model combining gradient boosting with deep learning for interpretable predictions.

  • • XGBoost (60% weight)
  • • BiLSTM (40% weight)
  • • 76 hand-crafted features

End-to-End Data Flow

Sensors
8 EEG + 3 ECG
Firmware
C, 569B packets
Gateway
BLE → JSON
DSP
Filter & Extract
ML Model
XGB + LSTM
Dashboard
Real-time viz
03 — LIVE SIGNALS

Real-Time Physiological Monitoring

Watch simulated brain and heart signals as they would appear from a real patient. Each signal carries specific physiological meaning that our system extracts and analyzes.

8-Channel EEG

Brain electrical activity

State:
250 Hz

Relaxed / Eyes Closed: Dominant alpha rhythm, especially in occipital regions. Classic "alpha block" when eyes open.

Fp1
Left frontal - cognitive processing
Fp2
Right frontal - executive function
C3
Left central - motor planning
C4
Right central - motor execution
T3
Left temporal - language/memory
T4
Right temporal - spatial processing
O1
Left occipital - visual processing
O2
Right occipital - visual processing

Understanding EEG Frequency Bands

Delta
0.5-4 Hz
Deep sleep
Theta
4-8 Hz
Drowsiness
Alpha
8-13 Hz
Relaxed
Beta
13-30 Hz
Focus
Gamma
30-50 Hz
Cognition

3-Lead ECG

Heart electrical activity

72BPM
Lead IIRA → LL

Understanding the PQRST Complex

Each heartbeat produces a characteristic waveform.

P Wave
80ms
Atrial contraction
Absent in AFib
PR
120-200ms
AV delay
Heart block
QRS
80-120ms
Ventricular
Bundle block
ST
Variable
Plateau
MI elevation
T Wave
160ms
Repolarization
Ischemia
04.5 — THE SIGNAL SCIENCE

How We Generate Clinically Realistic Data

Our synthetic data isn't random noise — it's generated using validated algorithms from peer-reviewed neuroscience and cardiology literature. Here's exactly how it works.

Why Synthetic Data?

Real patient EEG/ECG data requires IRB approval, HIPAA compliance, and months of clinical partnerships. For an academic prototype, we use synthetic data that mimics real physiological signals closely enough to develop and test our algorithms. The same signal processing and ML pipelines would work on real data.

Spectral Accuracy

Power spectral density matches clinical EEG databases. 1/f noise slope verified against published norms.

Temporal Fidelity

PQRST timing matches AHA guidelines. HRV metrics fall within normal physiological ranges.

State Transitions

Different cognitive/arousal states produce distinct spectral signatures, just like in real recordings.

EEG Signal Generation Algorithm

1Multi-Band Synthesis

Each EEG channel is composed of 5 frequency bands (delta, theta, alpha, beta, gamma) with amplitudes based on the 10-20 electrode system and published normative data.

signal = Σ A_band × sin(2π × f_band × t)
21/f Pink Noise

Real EEG has a characteristic "1/f" power spectrum — lower frequencies have more power. We use the Voss-McCartney algorithm to generate pink noise with equal energy per octave.

PSD(f) ∝ 1/f^α, where α ≈ 1
3State-Dependent Modulation

Cognitive states alter the relative power of each band. Alert states boost beta/gamma; relaxed states boost alpha; drowsy states boost theta/delta.

4Amplitude Modulation

Alpha waves naturally "wax and wane" in real EEG. We add slow (~0.5 Hz) modulation to create realistic spindle-like patterns.

Dominant alpha rhythm, especially in occipital regions. Classic "alpha block" when eyes open.

O1 Channel (Occipital)State: relaxed
delta
40%
theta
50%
alpha
150%
beta
60%
gamma
30%

Interactive Component Explorer

See how each frequency band contributes to the final signal. Click a band to isolate it.

ECG Signal Generation: The McSharry Model

Our ECG generation is based on the McSharry dynamical model, a widely-cited algorithm that uses Gaussian functions to create realistic PQRST morphology.

Gaussian Wave Model

Each ECG wave (P, Q, R, S, T) is modeled as a Gaussian:

W(t) = A × exp(-(t - t₀)² / (2σ²))
Heart Rate Variability

RR intervals vary naturally (5-10%). We model this plus respiratory sinus arrhythmia (RSA).

Noise Components

Baseline wander (~0.2 Hz), electrode noise, and 60 Hz powerline interference are added.

Premature Ventricular Contractions have wide QRS, no P wave, and inverted T waves.

PQRST Wave Parameters (Lead II)
P0.1-0.2 mV80-100 msAtrial depolarization
Q-0.1 mV20-40 msSeptal depolarization
R1.0-1.5 mV40-60 msVentricular mass
S-0.2 mV40-60 msLate ventricular
T0.2-0.3 mV120-160 msRepolarization
Lead IINormal Sinus Rhythm

Scientific References

EEG Signal Generation

Niedermeyer & Lopes da Silva
"Electroencephalography: Basic Principles, Clinical Applications, and Related Fields" — 5th Edition, Lippincott Williams & Wilkins, 2004
Nunez & Srinivasan
"Electric Fields of the Brain: The Neurophysics of EEG" — 2nd Edition, Oxford University Press, 2006
Voss & Clarke
"1/f noise in music and speech" — Nature 258:317-318, 1975 (Pink noise algorithm)

ECG Signal Generation

McSharry et al.
"A Dynamical Model for Generating Synthetic Electrocardiogram Signals" — IEEE Trans Biomed Eng 50(3):289-294, 2003
Task Force of ESC & NASPE
"Heart Rate Variability: Standards of Measurement, Physiological Interpretation, and Clinical Use" — Circulation 93(5):1043-1065, 1996
Pan & Tompkins
"A Real-Time QRS Detection Algorithm" — IEEE Trans Biomed Eng 32(3):230-236, 1985

Note: While our synthetic data follows established algorithms, it is not a substitute for real clinical data. The patterns are approximations and would require validation against actual patient recordings before any clinical use.

04 — SIGNAL PROCESSING

From Raw Signals to Meaningful Features

Raw physiological signals are noisy and high-dimensional. Our digital signal processing pipeline extracts 76 clinically meaningful features that the ML model uses for prediction.

EEG Feature Extraction

Step 1: Bandpass Filtering

4th-order Butterworth filter (0.5-50 Hz) removes DC drift and high-frequency noise while preserving brain rhythms.

Step 2: Power Spectral Density

Welch's method decomposes each channel into frequency bands (delta, theta, alpha, beta, gamma).

Step 3: Feature Computation

Band powers, spectral entropy, and inter-hemispheric coherence computed per channel.

66EEG features extracted

ECG & HRV Feature Extraction

Step 1: R-Peak Detection

Pan-Tompkins algorithm identifies R-peaks (heartbeats) with 99%+ accuracy on clean signals.

Step 2: HRV Time Domain

SDNN, RMSSD, pNN50 computed from R-R intervals per Task Force of ESC (1996) standards.

Step 3: HRV Frequency Domain

LF (0.04-0.15 Hz) and HF (0.15-0.4 Hz) power reflect sympathetic/parasympathetic balance.

10ECG/HRV features extracted

Complete Feature Set: 76 Features

40
EEG Band Powers
5 bands × 8 channels
16
EEG Statistics
Entropy, ratios per channel
10
EEG Coherence
Cross-channel correlation
4
HRV Time Domain
SDNN, RMSSD, pNN50, HR
3
HRV Frequency
LF, HF, LF/HF ratio
3
ECG Morphology
QRS duration, amplitude

Every feature has clinical meaning — we prioritize interpretability over black-box representations.

05 — MACHINE LEARNING

Interpretable Risk Prediction

We chose an ensemble approach that prioritizes explainability. Medical AI must be interpretable — clinicians need to understand WHY a prediction was made, not just what it is.

Ensemble Architecture

XGBoost60%

Gradient boosted trees operating on 76 hand-crafted features. Provides direct feature importance scores.

• 100 estimators
• Max depth: 6
• Learning rate: 0.1
+
Weighted
Ensemble
BiLSTM40%

Bidirectional LSTM captures temporal patterns in raw signal windows that features might miss.

• 2 LSTM layers (64 units)
• Dropout: 0.3
• Input: 250×11 window
Output
LOWMEDIUMHIGH
3-class risk classification + confidence score

ROC Curve (XGBoost)

Area Under Curve measures how well the model separates classes. 0.5 = random, 1.0 = perfect.

AUC = 0.923(Good discrimination)

Top Feature Importance

Which features matter most? HRV metrics dominate — the autonomic nervous system is key.

rmssd
Parasympathetic activity
lf_hf_ratio
Autonomic balance
O1_alpha
Visual cortex activity
sdnn
Overall HRV
C3_theta
Motor cortex theta
pnn50
Vagal tone marker

Honest Limitation

Our BiLSTM achieves 99.75% accuracy — suspiciously high. This indicates the synthetic training data contains patterns that are too easy to learn and would not generalize to real patients. We document this as a limitation, not an achievement. Real clinical deployment would require training on actual patient data with IRB approval and clinical validation studies.

06 — SYSTEM ARCHITECTURE

Four-Layer Medical Device Architecture

We followed IEC 62304 medical device software patterns (though without formal compliance). Each layer has clear responsibilities and interfaces, enabling independent testing and future hardware integration.

Layer 4
Presentation
Streamlit + Plotly
dashboard/app.py

Real-time dashboard displaying 8-channel EEG, ECG waveforms, risk gauge, and HRV metrics. WebSocket connection for live updates.

Layer 3
Application
FastAPI + Uvicorn
cloud/api/server.py

REST API for data ingestion (/ingest), ML inference (/inference), and system status. Manages 1000-packet circular buffer.

Layer 2
Domain
NumPy + SciPy + XGBoost + TensorFlow
cloud/signal_processing/ml/model/

Signal processing (Butterworth filters, Welch PSD, R-peak detection) and ML inference (ensemble prediction with confidence).

Layer 1
Acquisition
C Firmware + Python Adapters
firmware/cloud/device_adapters/

Device adapters for simulated, BLE, and serial connections. Binary packet parsing (569 bytes → JSON). Hardware abstraction layer.

250 Hz
Sample Rate
Captures up to 125 Hz (gamma)
569 B
Packet Size
25 samples × 11 channels + header
<100ms
Latency
Acquisition to prediction
100s
Buffer
1000 packets stored
07 — RESULTS & VERIFICATION

Reproducible, Verified, Open Source

Every component is tested. Every claim is verified. The entire codebase is open source for inspection, learning, and extension.

67
Verification Checks
All passing
42
Fixed Random Seed
100% reproducible
MIT
Open Source
Free to use & extend

Verification Breakdown

Directory Structure
14 passed
Core Source Files
12 passed
Documentation
8 passed
ML Pipeline
15 passed
Device Adapters
8 passed
Signal Processing
6 passed
Configuration
4 passed

Try It Yourself

# Clone the repository
git clone https://github.com/bblackheart013/neurocardiac-shield.git
cd neurocardiac-shield

# Setup (creates venvs, installs deps, trains models)
./setup.sh

# Verify everything works
python verify_system.py

# Launch the full demo
./run_complete_demo.sh
08 — CONNECT YOUR DEVICE

Live Device Integration

Connect your own wearable device to see real physiological data flowing through the NeuroCardiac Shield system. We support any Bluetooth LE heart rate monitor.

Device Connection

Connect a Bluetooth heart rate monitor to see live data

How to Connect

  1. 1Put on your heart rate monitor (chest strap works best for HRV data)
  2. 2Make sure Bluetooth is enabled on your computer
  3. 3Click "Connect Device" and select your device from the list
  4. 4Watch your real heart data flow through the system!

Compatible Devices

Polar H10
Heart Rate + ECG
Supported
Heart RateRR IntervalsECG Stream
Bluetooth LEBest for ECG data
Polar H9/OH1
Heart Rate
Supported
Heart RateRR Intervals
Bluetooth LEHR monitoring only
Garmin HRM-Pro
Heart Rate
Supported
Heart RateRR Intervals
Bluetooth LEStandard BLE HR
Wahoo TICKR
Heart Rate
Supported
Heart RateRR Intervals
Bluetooth LEStandard BLE HR
Any BLE HR Monitor
Heart Rate
Supported
Heart Rate
Bluetooth LEStandard GATT profile
Muse 2 / Muse S
EEG Headband
Coming Soon
4-ch EEGPPGAccelerometer
Bluetooth LEComing soon (requires SDK)
Apple Watch
Smartwatch
Coming Soon
Heart RateECG
Requires AppNeeds companion app
EEG Device Support Coming

We're working on integrating consumer EEG devices like Muse and OpenBCI. This requires custom SDK integration. Star the repo to get notified when EEG support is added!