System architecture

Local-first from sensor to session review

A verified view of how ResQ turns physical chest compressions into live, understandable training feedback.

Architecture layers

One system, seven clear responsibilities

Each layer can be inspected and tested independently while participating in a single local training workflow.

Mechanical & sensing

Soft chest overlay, pneumatic bladder concept, pressure channels, Hall-effect displacement sensing, physical controls.

Pressure + magnetic sensing
Embedded firmware

Sensor acquisition, calibration, CPR metrics, persistent configuration, state transitions, telemetry, fault recovery.

ESP32-C3 · ESP-IDF · FreeRTOS
Local messaging

Status, heartbeat, telemetry, events, calibration evidence, and commands use the canonical resq/{deviceId}/... namespace.

Wi-Fi · Mosquitto · MQTT
Backend

Device registration, readiness, session lifecycle, telemetry processing, scoring, user access, streaming, and exports.

Java · Spring Boot
Persistence

Local device, calibration, user, session, score, and synchronization-queue records.

SQLite
Desktop & dashboards

Windows service orchestration plus responsive instructor and trainee experiences delivered through REST and SSE.

Tauri · Rust · React · TypeScript
Optional cloud

Queued synchronization is isolated from live training so internet or cloud failure does not interrupt a local session.

Under Active Development
Data path

Physical action becomes local feedback

Real-time data stays close to the training station; only optional synchronization crosses the local boundary.

InputCPR compression
→
SensingPressure + displacement
→
EmbeddedMetrics + state
→
MessagingLocal MQTT
→
ApplicationProcess + persist
→
ExperienceLive SSE dashboard
Firmware state machine

Explicit states for a recoverable device

State names below are taken from the production firmware. Error, interruption, reset, and shutdown paths are part of the implementation—not decorative diagram branches.

BOOT
CONFIG_CHECK
PROVISIONING
WIFI_CONNECTING
BACKEND_REGISTERING
MQTT_CONNECTING
PAIRED_IDLE
CALIBRATING
CALIBRATION_FAIL
READY_FOR_SESSION
SESSION_ACTIVE
SESSION_INTERRUPTED
ERROR
RESETTING
TURN_OFF

Normal operation progresses through configuration and connectivity into idle, calibration, readiness, and active-session states. Failure and recovery transitions depend on the triggering condition.

Calibration & readiness

Evidence before assessment

ResQ does not treat “connected” as automatically ready. The device and sensors must pass the supported calibration workflow before a scored session starts.

01Device connected
→
02Sensor check
→
03Rest baseline
→
04Compression reference
→
05Pressure validation
→
PassReady for session
Pass

Calibration evidence stored

Readiness can be presented with the relevant state and calibration evidence before the instructor begins training.

Fail

Reason and recovery action shown

Correct the physical setup or sensor condition, then retry. A failed readiness check does not silently continue into scoring.

CPR metrics

Focused measurements, understandable coaching

Institution-specific target ranges remain configurable. The website does not claim universal clinical thresholds or certification.

Compression depth

Displacement estimates derived from calibrated sensor input.

Compression rate

Timing-derived cadence calculated throughout an active session.

Full recoil

Per-cycle detection of whether the chest returns sufficiently between compressions.

Pause time

Interruptions and periods without valid compressions are tracked.

Hand placement & balance

Pressure distribution supports coaching around left/right loading.

Session summary

Completed sessions combine metric performance into reviewable results.

MQTT contract

A single canonical topic namespace

Historical documentation used two patterns. Production firmware uses resq/{deviceId}/...; the LocalHub retains compatibility parsing for older topics but does not make them canonical.

status

Retained device state and readiness information.

heartbeat

Connectivity and health cadence for live device presence.

telemetry

Active sensor and CPR metric samples.

events

Session, calibration, and error events.

cmd/...

Backend-to-firmware actions with request correlation.

debug

Diagnostic information for controlled development workflows.

ResQ smart CPR training manikin prototype
Local-first resilience

The physical prototype stays connected to a local training loop

The instructor machine hosts every time-sensitive component: broker, backend, database, and dashboards. Internet or cloud failure cannot interrupt a local session.

Implemented

Local sessions, scoring, history, and LAN dashboard access.

Under Active Development

Optional long-term cloud synchronization and remote aggregation.

Continue exploring

See how the architecture became a working product

Follow the implementation, test evidence, releases, and remaining roadmap.

Development status