# emanuelmath/tranqui-firmware-esp32s3 architecture

> Architecture diagram of the GitHub repository emanuelmath/tranqui-firmware-esp32s3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/emanuelmath/tranqui-firmware-esp32s3
- Repository: https://github.com/emanuelmath/tranqui-firmware-esp32s3

## Overview

Tranqui is ESP32-S3 firmware for real-time biosensor monitoring and haptic feedback. Its workflow acquires FSR force and MAX30102 pulse data, processes physiological metrics, evaluates system status, and shares telemetry with physical indicators and a local web dashboard. The graph includes signal processing, calibration, cross-core synchronization, JSON serialization, and dashboard delivery. Relationships are based on sampled source references and README statements; unsampled implementations are represented only where documented, so some internal links are omitted.

Main entry points: [`src/app/sistema.cpp`](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/app/sistema.cpp) (System tasks), [`src/health/evaluador_estado.cpp`](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/health/evaluador_estado.cpp) (Status evaluator), [`src/network/servidor_web.cpp`](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/network/servidor_web.cpp) (Web server), [`src/sensors/sensor_fsr.cpp`](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sensors/sensor_fsr.cpp) (FSR acquisition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_firmware["Arduino entry<br/>[Tranqui.ino]"]
  node_system["System tasks<br/>[sistema.cpp]"]
  node_hardware_config["Hardware configuration<br/>[hardware_config.h]"]
end

subgraph group_sensing["Sensing and signal processing"]
  node_calibration["Signal calibration<br/>[calibracion.h]"]
  node_fsr_sensor["FSR acquisition<br/>[sensor_fsr.cpp]"]
  node_force_math["Force conversion<br/>[fuerza_math.cpp]"]
  node_oximeter["Oximeter acquisition"]
  node_ppg["PPG metrics<br/>[ppg.cpp]"]
  node_biquad["Biquad filters<br/>[biquad.cpp]"]
end

subgraph group_feedback["Status and feedback"]
  node_actuators["Haptic actuators<br/>[actuadores.cpp]"]
  node_evaluator["Status evaluator"]
  node_leds["LED status lights<br/>[semaforo_leds.cpp]"]
end

subgraph group_telemetry["Telemetry and web"]
  node_shared_state[("Shared telemetry")]
  node_telemetry_model["Telemetry model<br/>[telemetria.h]"]
  node_json["JSON serializer"]
  node_web_server["Web server<br/>[servidor_web.cpp]"]
  node_dashboard["Live dashboard<br/>[pagina_web.h]"]
end

node_fsr_hardware(("FSR sensor"))
node_pulse_hardware(("MAX30102 sensor"))
node_browser(("Browser user"))

node_firmware -->|"starts"| node_system
node_system -->|"runs acquisition"| node_fsr_sensor
node_system -->|"runs acquisition"| node_oximeter
node_system -->|"evaluates state"| node_evaluator
node_system -->|"initializes"| node_actuators
node_system -->|"initializes"| node_leds
node_system -->|"starts server"| node_web_server
node_system -->|"uses settings"| node_hardware_config
node_fsr_hardware -.->|"provides readings"| node_fsr_sensor
node_fsr_sensor -->|"converts force"| node_force_math
node_fsr_sensor -->|"triggers"| node_actuators
node_fsr_sensor -->|"uses thresholds"| node_calibration
node_pulse_hardware -.->|"provides samples"| node_oximeter
node_oximeter -->|"processes samples"| node_ppg
node_oximeter -->|"pushes waveform"| node_shared_state
node_oximeter -->|"uses thresholds"| node_calibration
node_ppg -->|"filters signals"| node_biquad
node_ppg -->|"uses parameters"| node_calibration
node_evaluator -->|"reads force"| node_fsr_sensor
node_evaluator -->|"reads pulse status"| node_oximeter
node_evaluator -->|"publishes telemetry"| node_shared_state
node_evaluator -->|"updates indicators"| node_leds
node_evaluator -->|"checks limits"| node_calibration
node_web_server -->|"reads telemetry"| node_shared_state
node_web_server -->|"serializes events"| node_json
node_web_server -->|"serves page"| node_dashboard
node_browser -->|"opens dashboard"| node_web_server
node_web_server -->|"streams events"| node_browser
node_dashboard -->|"renders metrics"| node_browser
node_shared_state -->|"stores values"| node_telemetry_model
node_json -->|"serializes values"| node_telemetry_model

click node_firmware "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/Tranqui.ino"
click node_system "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/app/sistema.cpp"
click node_hardware_config "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/config/hardware_config.h"
click node_calibration "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/config/calibracion.h"
click node_fsr_sensor "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sensors/sensor_fsr.cpp"
click node_force_math "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/fuerza_math.cpp"
click node_oximeter "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sensors/sensor_oximetro.cpp"
click node_ppg "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/ppg.cpp"
click node_biquad "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/biquad.cpp"
click node_actuators "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/device/actuadores.cpp"
click node_evaluator "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/health/evaluador_estado.cpp"
click node_leds "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/device/semaforo_leds.cpp"
click node_shared_state "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sync/estado_compartido.cpp"
click node_telemetry_model "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/telemetria.h"
click node_json "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/protocol/json_telemetria.cpp"
click node_web_server "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/network/servidor_web.cpp"
click node_dashboard "https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/network/pagina_web.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_firmware,node_system,node_hardware_config,node_browser toneBlue
class node_calibration,node_fsr_sensor,node_force_math,node_oximeter,node_ppg,node_biquad toneAmber
class node_actuators,node_evaluator,node_leds toneMint
class node_shared_state,node_telemetry_model,node_json,node_web_server,node_dashboard toneRose
class node_fsr_hardware,node_pulse_hardware toneIndigo
```

## Components

### Runtime orchestration

- [Arduino entry](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/Tranqui.ino): `Tranqui.ino`
- [System tasks](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/app/sistema.cpp): `src/app/sistema.cpp`
- [Hardware configuration](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/config/hardware_config.h): `src/config/hardware_config.h`

### Sensing and signal processing

- [Signal calibration](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/config/calibracion.h): `src/config/calibracion.h`
- [FSR acquisition](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sensors/sensor_fsr.cpp): `src/sensors/sensor_fsr.cpp`
- [Force conversion](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/fuerza_math.cpp): `src/domain/fuerza_math.cpp`
- [Oximeter acquisition](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sensors/sensor_oximetro.cpp): `src/sensors/sensor_oximetro.cpp`
- [PPG metrics](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/ppg.cpp): `src/domain/ppg.cpp`
- [Biquad filters](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/biquad.cpp): `src/domain/biquad.cpp`

### Status and feedback

- [Haptic actuators](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/device/actuadores.cpp): `src/device/actuadores.cpp`
- [Status evaluator](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/health/evaluador_estado.cpp): `src/health/evaluador_estado.cpp`
- [LED status lights](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/device/semaforo_leds.cpp): `src/device/semaforo_leds.cpp`

### Telemetry and web

- [Shared telemetry](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/sync/estado_compartido.cpp): `src/sync/estado_compartido.cpp`
- [Telemetry model](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/domain/telemetria.h): `src/domain/telemetria.h`
- [JSON serializer](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/protocol/json_telemetria.cpp): `src/protocol/json_telemetria.cpp`
- [Web server](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/network/servidor_web.cpp): `src/network/servidor_web.cpp`
- [Live dashboard](https://github.com/emanuelmath/tranqui-firmware-esp32s3/blob/main/src/network/pagina_web.h): `src/network/pagina_web.h`

### Other components

- **FSR sensor**
- **MAX30102 sensor**
- **Browser user**

## Connections

- Arduino entry → System tasks: starts (evidence: `README.md`)
- System tasks → FSR acquisition: runs acquisition (evidence: `src/app/sistema.cpp`)
- System tasks → Oximeter acquisition: runs acquisition (evidence: `src/app/sistema.cpp`)
- System tasks → Status evaluator: evaluates state (evidence: `src/app/sistema.cpp`)
- System tasks → Haptic actuators: initializes (evidence: `src/app/sistema.cpp`)
- System tasks → LED status lights: initializes (evidence: `src/app/sistema.cpp`)
- System tasks → Web server: starts server (evidence: `src/app/sistema.cpp`)
- System tasks → Hardware configuration: uses settings (evidence: `src/app/sistema.cpp`)
- FSR sensor → FSR acquisition: provides readings
- FSR acquisition → Force conversion: converts force (evidence: `src/sensors/sensor_fsr.cpp`)
- FSR acquisition → Haptic actuators: triggers (evidence: `src/sensors/sensor_fsr.cpp`)
- FSR acquisition → Signal calibration: uses thresholds (evidence: `src/sensors/sensor_fsr.cpp`)
- MAX30102 sensor → Oximeter acquisition: provides samples
- Oximeter acquisition → PPG metrics: processes samples (evidence: `src/sensors/sensor_oximetro.cpp`)
- Oximeter acquisition → Shared telemetry: pushes waveform (evidence: `src/sensors/sensor_oximetro.cpp`)
- Oximeter acquisition → Signal calibration: uses thresholds (evidence: `src/sensors/sensor_oximetro.cpp`)
- PPG metrics → Biquad filters: filters signals
- PPG metrics → Signal calibration: uses parameters (evidence: `src/domain/ppg.cpp`)
- Status evaluator → FSR acquisition: reads force (evidence: `src/health/evaluador_estado.cpp`)
- Status evaluator → Oximeter acquisition: reads pulse status (evidence: `src/health/evaluador_estado.cpp`)
- Status evaluator → Shared telemetry: publishes telemetry (evidence: `src/health/evaluador_estado.cpp`)
- Status evaluator → LED status lights: updates indicators (evidence: `src/health/evaluador_estado.cpp`)
- Status evaluator → Signal calibration: checks limits (evidence: `src/health/evaluador_estado.cpp`)
- Web server → Shared telemetry: reads telemetry (evidence: `src/network/servidor_web.cpp`)
- Web server → JSON serializer: serializes events (evidence: `src/network/servidor_web.cpp`)
- Web server → Live dashboard: serves page (evidence: `src/network/servidor_web.cpp`)
- Browser user → Web server: opens dashboard (evidence: `README.md`)
- Web server → Browser user: streams events (evidence: `README.md`)
- Live dashboard → Browser user: renders metrics (evidence: `src/network/pagina_web.h`)
- Shared telemetry → Telemetry model: stores values
- JSON serializer → Telemetry model: serializes values
