# axden-dev/nrf52_smart_ecg_ppg_example architecture

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

- Interactive diagram: https://gitdiagram.com/axden-dev/nrf52_smart_ecg_ppg_example
- Repository: https://github.com/axden-dev/nrf52_smart_ecg_ppg_example

## Overview

This is NRF52832 firmware for an ECG/PPG vital-signs device. The intended workflow is sensor acquisition, ECG and optical-signal processing, then Bluetooth transmission for viewing through mobile/web clients and the AxDen Aggregator; UART output also supports terminal checks. The source excerpts establish sensor-driver and BLE-service behavior, but main.c and several processing modules were not inspected, so their runtime call sequence and detailed wiring are not asserted.

Main entry points: [`main.c`](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/main.c) (Application), [`max30003.c`](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30003.c) (MAX30003 ECG), [`max30101.c`](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30101.c) (MAX30101 PPG), [`ble_service.c`](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/ble_service.c) (BLE GATT service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Firmware control"]
  node_main["Application<br/>[main.c]"]
  node_board["Board pins<br/>[board_define.h]"]
  node_protocol["Device protocol<br/>[protocol.h]"]
end

subgraph group_sensors["Sensor acquisition"]
  node_ecg_sensor["MAX30003 ECG<br/>[max30003.c]"]
  node_ppg_sensor["MAX30101 PPG<br/>[max30101.c]"]
  node_temp_sensor["SI7051 temperature<br/>[si7051.c]"]
end

subgraph group_processing["Signal processing"]
  node_ecg_processing["ECG analysis<br/>[ecg_algorithm.c]"]
  node_ppg_processing["HR / SpO2 analysis"]
end

subgraph group_interfaces["Device interfaces"]
  node_ble["BLE GATT service<br/>[ble_service.c]"]
  node_uart["UART terminal I/O<br/>[uart_usb_in_out.c]"]
end

node_user(("Device operator"))
node_phone(("Mobile client"))
node_aggregator["AxDen Aggregator"]
node_web(("Web client"))
node_terminal(("Serial terminal"))

node_main -.->|"acquires ECG"| node_ecg_sensor
node_main -.->|"acquires PPG"| node_ppg_sensor
node_main -.->|"acquires temperature"| node_temp_sensor
node_ecg_sensor -.->|"ECG samples"| node_ecg_processing
node_ppg_sensor -.->|"optical samples"| node_ppg_processing
node_main -.->|"transmits vitals"| node_ble
node_ble -->|"BLE data"| node_phone
node_ble -->|"BLE data"| node_aggregator
node_aggregator -->|"presents readings"| node_web
node_main -.->|"reports status"| node_uart
node_uart -->|"serial output"| node_terminal
node_ecg_sensor -->|"uses pin map"| node_board
node_ppg_sensor -->|"uses pin map"| node_board

click node_main "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/main.c"
click node_board "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/board_define.h"
click node_protocol "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/protocol.h"
click node_ecg_sensor "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30003.c"
click node_ppg_sensor "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30101.c"
click node_temp_sensor "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/si7051.c"
click node_ecg_processing "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/ecg_algorithm.c"
click node_ppg_processing "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/heartrate_spo2_algorithm.c"
click node_ble "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/ble_service.c"
click node_uart "https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/uart_usb_in_out.c"

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_main,node_board,node_protocol,node_phone,node_web toneBlue
class node_ecg_sensor,node_ppg_sensor,node_temp_sensor toneAmber
class node_ecg_processing,node_ppg_processing toneMint
class node_ble,node_uart toneRose
class node_user,node_aggregator,node_terminal toneIndigo
```

## Components

### Firmware control

- [Application](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/main.c): `main.c`
- [Board pins](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/board_define.h): `board_define.h`
- [Device protocol](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/protocol.h): `protocol.h`

### Sensor acquisition

- [MAX30003 ECG](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30003.c): `max30003.c`
- [MAX30101 PPG](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/max30101.c): `max30101.c`
- [SI7051 temperature](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/si7051.c): `si7051.c`

### Signal processing

- [ECG analysis](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/ecg_algorithm.c): `ecg_algorithm.c`
- [HR / SpO2 analysis](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/heartrate_spo2_algorithm.c): `heartrate_spo2_algorithm.c`

### Device interfaces

- [BLE GATT service](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/ble_service.c): `ble_service.c`
- [UART terminal I/O](https://github.com/axden-dev/nrf52_smart_ecg_ppg_example/blob/main/uart_usb_in_out.c): `uart_usb_in_out.c`

### Other components

- **Device operator**
- **Mobile client**
- **AxDen Aggregator**
- **Web client**
- **Serial terminal**

## Connections

- Application → MAX30003 ECG: acquires ECG
- Application → MAX30101 PPG: acquires PPG
- Application → SI7051 temperature: acquires temperature
- MAX30003 ECG → ECG analysis: ECG samples
- MAX30101 PPG → HR / SpO2 analysis: optical samples
- Application → BLE GATT service: transmits vitals
- BLE GATT service → Mobile client: BLE data (evidence: `README.md`)
- BLE GATT service → AxDen Aggregator: BLE data (evidence: `README.md`)
- AxDen Aggregator → Web client: presents readings (evidence: `README.md`)
- Application → UART terminal I/O: reports status
- UART terminal I/O → Serial terminal: serial output (evidence: `README.md`)
- MAX30003 ECG → Board pins: uses pin map
- MAX30101 PPG → Board pins: uses pin map
