Problem & hardware constraints
HeartFlow OS compiles trained Scikit-Learn soft-voting ensembles into pure, static C99 headers designed to run on microcontrollers with less than 8KB of SRAM. It pairs the embedded runtime with a 60 FPS browser-based oscillograph communicating over the Web Serial API.
System architecture & pipeline
The runtime is structured into decoupled execution layers to avoid latency jitter and unpredictable heap fragmentation:
Trains an ensemble classifier in Scikit-Learn, extracts split thresholds, weights, and tree structures, then computes SHAP summary values for explainability.
Generates zero-allocation C99 code. All weights are baked into const arrays in flash memory. Stack usage is strictly bounded below 512 bytes with zero dynamic heap allocation (no malloc).
Processes analog telemetry pins at 250Hz. Fixed-point math and branch-predictable tree traversals execute in 18.4 microseconds per sample.
Streams raw signal packets into a browser dashboard rendered at 60 FPS via Canvas and WebGL shaders, with zero driver installation needed.
Engineering trade-offs & alternatives rejected
Why C99 instead of MicroPython or TinyML?
MicroPython has an unpredictable garbage collector that causes millisecond-long latency spikes during critical telemetry reads. TinyML is great for neural nets, but decision trees transpiled to raw C switch-cases run 10x faster and use virtually zero RAM.
Why Web Serial instead of a local desktop app?
Asking doctors or lab techs to install serial drivers and Python environments always breaks. Web Serial runs straight in Chromium browsers without installs or admin permissions.
Field notes & edge cases
- 01Stack overflow on embedded hardware does not throw a polite exception. It just quietly overwrites the interrupt vector table until the board resets itself.
- 02Fixed-point integer arithmetic was chosen because floating-point hardware on sub-$2 chips either does not exist or burns too many clock cycles.
— / deploy
Explore source & live runtime
Source code, static headers, and benchmarks are open for review on GitHub.

