tpt-biosig
RustPrivacy-first, no_std Rust workspace for multi-modal biometric sensing — PPG, ECG, NIR vein imaging, EIT tissue mapping, and ultrasound on ESP32. Build your own Medical Tricorder.
Languages
tpt-biosig
Privacy-first, no_std biometric signal-processing workspace for the TPT
multi-modal wearable (optical PPG, NIR vein imaging, bioelectric ECG/EMG,
impedance BIA/EIT, acoustic PCG/ultrasound, and sensor fusion).
Strategy: software-first. Every algorithm is developed and host-tested on a normal PC before any HAL/ESP32 integration. Hardware drivers are deferred to
tpt-biosig-haland require the Espressif toolchain.
Workspace layout
| Crate | Tier | Purpose |
|---|---|---|
tpt-biosig-core | firmware | Raw sample types, BiometricPacket, sensor traits, FHIR R5 maps |
tpt-biosig-math | firmware | #![no_std] linear algebra, complex, FFT, decompositions, solvers |
tpt-biosig-dsp | firmware | Filters, peak detection, envelopes, Hilbert, windows |
tpt-biosig-hal | firmware | Hardware abstraction layer (ESP32 drivers) — Phase 10 |
tpt-biosig-optical | firmware | PPG/SpO2 + NIR vein segmentation |
tpt-biosig-impedance | firmware | BIA (Cole-Cole) + EIT reconstruction |
tpt-biosig-bioelectric | firmware | ECG/EMG processing, HRV |
tpt-biosig-acoustic | firmware | PCG, beamforming, B-mode, Doppler |
tpt-biosig-vision | firmware | Pupil tracking, optical flow |
tpt-biosig-fusion | firmware | Coordinate transform, calibration, volumetric reconstruction |
tpt-biosig-link | firmware | postcard codec, GATT UUIDs, MQTT topics, RLE |
tpt-biosig-gateway | host | Ingestion daemon, SQLite/InfluxDB backends |
tpt-biosig-dashboard | host | Axum REST + WebSocket API and WASM frontend |
All firmware crates are #![no_std] (most also no_alloc); gateway and
dashboard are std-only. #![forbid(unsafe_code)] is set on every crate
except tpt-biosig-hal, which is the intended home for unsafe register IO.
Building & testing
cargo check --workspace --all-features # whole workspace
cargo test --workspace --exclude tpt-biosig-hal
cargo clippy --workspace -- -D warnings
cargo fmt --check
The gateway and dashboard use feature flags sqlite and influxdb
(default on for the gateway). Run the full suite with:
cargo test -p tpt-biosig-gateway --features sqlite,influxdb
cargo test -p tpt-biosig-dashboard --all-features
no_std / embedded build checks
cargo check --target thumbv7em-none-eabi # proxy for all firmware crates
# ESP32-S3 / C6 require the Espressif toolchain:
cargo build --target xtensa-esp32s3-none-elf -p tpt-biosig-hal
cargo build --target riscv32imac-unknown-none-elf -p tpt-biosig-hal
See .cargo/config.toml for the target definitions.
Host simulation
examples/host-sim is a plain std binary that exercises the DSP/optical
pipelines on synthetic signals — no hardware required. Run it with:
cargo run -p host-sim
Licensing
Dual-licensed under either of MIT or Apache-2.0 at your option.