tpt-biosig

Rust

Privacy-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.

0 stars0 forks0 watchersApache License 2.0

Languages

Rust99.6%HTML0.4%
README

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-hal and require the Espressif toolchain.

Workspace layout

CrateTierPurpose
tpt-biosig-corefirmwareRaw sample types, BiometricPacket, sensor traits, FHIR R5 maps
tpt-biosig-mathfirmware#![no_std] linear algebra, complex, FFT, decompositions, solvers
tpt-biosig-dspfirmwareFilters, peak detection, envelopes, Hilbert, windows
tpt-biosig-halfirmwareHardware abstraction layer (ESP32 drivers) — Phase 10
tpt-biosig-opticalfirmwarePPG/SpO2 + NIR vein segmentation
tpt-biosig-impedancefirmwareBIA (Cole-Cole) + EIT reconstruction
tpt-biosig-bioelectricfirmwareECG/EMG processing, HRV
tpt-biosig-acousticfirmwarePCG, beamforming, B-mode, Doppler
tpt-biosig-visionfirmwarePupil tracking, optical flow
tpt-biosig-fusionfirmwareCoordinate transform, calibration, volumetric reconstruction
tpt-biosig-linkfirmwarepostcard codec, GATT UUIDs, MQTT topics, RLE
tpt-biosig-gatewayhostIngestion daemon, SQLite/InfluxDB backends
tpt-biosig-dashboardhostAxum 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.