# amiruddinsiddiqui/environmental_data_logging_system architecture

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

- Interactive diagram: https://gitdiagram.com/amiruddinsiddiqui/environmental_data_logging_system
- Repository: https://github.com/amiruddinsiddiqui/environmental_data_logging_system

## Overview

This is an STM32-based environmental telemetry system with an ESP32 network bridge. Its main workflow schedules BMP280 measurements, receives and compensates sensor data, then logs, displays, and transmits readings; the ESP32 receives serial telemetry and publishes it over Wi-Fi to MQTT subscribers. The graph includes the documented local and remote monitoring branches. Some peripheral implementations and the MQTT publisher’s internal flow were not excerpted, so those relationships are shown only where the source index or README supports them.

Main entry points: [`Core/Application/app.c`](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/app.c) (Acquisition Orchestrator), [`ESP32_PUB_MQTT/main/main.c`](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/main.c) (ESP32 Task Setup), [`Drivers/Peripherals/UART/uart.c`](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/UART/uart.c) (STM32 UART), [`Drivers/Sensors/BMP280/bmp280.c`](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Sensors/BMP280/bmp280.c) (BMP280 Driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_stm32["STM32 Firmware"]
  node_app["Acquisition Orchestrator<br/>[app.c]"]
  node_entry["Firmware Entry<br/>[main.c]"]
end

subgraph group_sensing["Sensing and Interfaces"]
  node_timer["5-Second Scheduler<br/>[tim.c]"]
  node_bmp["BMP280 Driver<br/>[bmp280.c]"]
  node_i2c["I2C Interface<br/>[i2c.c]"]
  node_dma["DMA Transfer<br/>[dma.c]"]
  node_spi["SPI Interfaces<br/>[spi.c]"]
  node_uart["STM32 UART<br/>[uart.c]"]
end

subgraph group_local["Local Outputs"]
  node_sd["CSV Logging<br/>[sd_storage.c]"]
  node_fatfs["FatFs Filesystem<br/>[fatfs.c]"]
  node_card[("microSD Card")]
  node_display["TFT Rendering<br/>[tftrender.c]"]
  node_ili["ILI9341 Driver<br/>[ili9341.c]"]
end

subgraph group_esp["ESP32 Bridge"]
  node_espentry["ESP32 Task Setup<br/>[main.c]"]
  node_esp_uart["UART Receiver<br/>[uart2.c]"]
  node_wifi["Wi-Fi Station<br/>[wifi_sta.c]"]
  node_mqtt["MQTT Publisher<br/>[mqtt_pub.c]"]
end

subgraph group_remote["Remote Telemetry"]
  node_broker["MQTT Broker"]
end

node_sensor(("BMP280 Sensor"))
node_pc(("PC Serial Monitor"))
node_phone(("Phone Subscriber"))

node_entry -->|"starts"| node_app
node_app -->|"initializes"| node_timer
node_app -->|"initializes and reads"| node_bmp
node_sensor -->|"provides measurements"| node_bmp
node_bmp -->|"reads over I2C"| node_i2c
node_i2c -->|"configures transfer"| node_dma
node_app -->|"initializes"| node_dma
node_app -->|"logs readings"| node_sd
node_sd -->|"writes CSV"| node_fatfs
node_fatfs -->|"stores files"| node_card
node_app -->|"updates readings"| node_display
node_display -->|"renders through"| node_ili
node_app -->|"initializes"| node_spi
node_app -->|"transmits telemetry"| node_uart
node_uart -->|"prints diagnostics"| node_pc
node_uart -->|"sends serial packets"| node_esp_uart
node_espentry -->|"starts task"| node_esp_uart
node_espentry -->|"initializes and waits"| node_wifi
node_espentry -->|"starts client and task"| node_mqtt
node_wifi -.->|"provides Wi-Fi link"| node_broker
node_mqtt -->|"publishes telemetry"| node_broker
node_phone -->|"subscribes"| node_broker
node_broker -->|"delivers messages"| node_phone

click node_app "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/app.c"
click node_entry "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/src/main.c"
click node_timer "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/TIM/tim.c"
click node_bmp "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Sensors/BMP280/bmp280.c"
click node_i2c "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/I2C/i2c.c"
click node_dma "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/DMA/dma.c"
click node_spi "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/SPI/spi.c"
click node_sd "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/Storage/sd_storage.c"
click node_fatfs "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/FATFS/App/fatfs.c"
click node_display "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/UI/tftrender.c"
click node_ili "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Display/ili9341.c"
click node_uart "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/UART/uart.c"
click node_espentry "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/main.c"
click node_esp_uart "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/uart/uart2.c"
click node_wifi "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/wifi/wifi_sta.c"
click node_mqtt "https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/mqtt/mqtt_pub.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_app,node_entry toneBlue
class node_timer,node_bmp,node_i2c,node_dma,node_spi,node_uart toneAmber
class node_sd,node_fatfs,node_card,node_display,node_ili toneMint
class node_espentry,node_esp_uart,node_wifi,node_mqtt toneRose
class node_broker,node_sensor,node_pc,node_phone toneIndigo
```

## Components

### STM32 Firmware

- [Acquisition Orchestrator](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/app.c): `Core/Application/app.c`
- [Firmware Entry](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/src/main.c): `Core/src/main.c`

### Sensing and Interfaces

- [5-Second Scheduler](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/TIM/tim.c): `Drivers/Peripherals/TIM/tim.c`
- [BMP280 Driver](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Sensors/BMP280/bmp280.c): `Drivers/Sensors/BMP280/bmp280.c`
- [I2C Interface](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/I2C/i2c.c): `Drivers/Peripherals/I2C/i2c.c`
- [DMA Transfer](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/DMA/dma.c): `Drivers/Peripherals/DMA/dma.c`
- [SPI Interfaces](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/SPI/spi.c): `Drivers/Peripherals/SPI/spi.c`
- [STM32 UART](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Peripherals/UART/uart.c): `Drivers/Peripherals/UART/uart.c`

### Local Outputs

- [CSV Logging](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/Storage/sd_storage.c): `Core/Application/Storage/sd_storage.c`
- [FatFs Filesystem](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/FATFS/App/fatfs.c): `FATFS/App/fatfs.c`
- **microSD Card**
- [TFT Rendering](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Core/Application/UI/tftrender.c): `Core/Application/UI/tftrender.c`
- [ILI9341 Driver](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/Drivers/Display/ili9341.c): `Drivers/Display/ili9341.c`

### ESP32 Bridge

- [ESP32 Task Setup](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/main.c): `ESP32_PUB_MQTT/main/main.c`
- [UART Receiver](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/uart/uart2.c): `ESP32_PUB_MQTT/main/uart/uart2.c`
- [Wi-Fi Station](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/wifi/wifi_sta.c): `ESP32_PUB_MQTT/main/wifi/wifi_sta.c`
- [MQTT Publisher](https://github.com/amiruddinsiddiqui/environmental_data_logging_system/blob/main/ESP32_PUB_MQTT/main/mqtt/mqtt_pub.c): `ESP32_PUB_MQTT/main/mqtt/mqtt_pub.c`

### Remote Telemetry

- **MQTT Broker**

### Other components

- **BMP280 Sensor**
- **PC Serial Monitor**
- **Phone Subscriber**

## Connections

- Firmware Entry → Acquisition Orchestrator: starts (evidence: `Core/src/main.c`)
- Acquisition Orchestrator → 5-Second Scheduler: initializes (evidence: `Core/Application/app.c`)
- Acquisition Orchestrator → BMP280 Driver: initializes and reads (evidence: `Core/Application/app.c`)
- BMP280 Sensor → BMP280 Driver: provides measurements (evidence: `readme.md`)
- BMP280 Driver → I2C Interface: reads over I2C (evidence: `Drivers/Sensors/BMP280/bmp280.c`)
- I2C Interface → DMA Transfer: configures transfer (evidence: `Drivers/Peripherals/I2C/i2c.c`)
- Acquisition Orchestrator → DMA Transfer: initializes (evidence: `Core/Application/app.c`)
- Acquisition Orchestrator → CSV Logging: logs readings (evidence: `Core/Application/app.c`)
- CSV Logging → FatFs Filesystem: writes CSV (evidence: `Core/Application/Storage/sd_storage.c`)
- FatFs Filesystem → microSD Card: stores files (evidence: `readme.md`)
- Acquisition Orchestrator → TFT Rendering: updates readings (evidence: `Core/Application/app.c`)
- TFT Rendering → ILI9341 Driver: renders through (evidence: `Core/Application/UI/tftrender.c`)
- Acquisition Orchestrator → SPI Interfaces: initializes (evidence: `Core/Application/app.c`)
- Acquisition Orchestrator → STM32 UART: transmits telemetry (evidence: `Core/Application/app.c`)
- STM32 UART → PC Serial Monitor: prints diagnostics (evidence: `readme.md`)
- STM32 UART → UART Receiver: sends serial packets (evidence: `readme.md`)
- ESP32 Task Setup → UART Receiver: starts task (evidence: `ESP32_PUB_MQTT/main/main.c`)
- ESP32 Task Setup → Wi-Fi Station: initializes and waits (evidence: `ESP32_PUB_MQTT/main/main.c`)
- ESP32 Task Setup → MQTT Publisher: starts client and task (evidence: `ESP32_PUB_MQTT/main/main.c`)
- Wi-Fi Station → MQTT Broker: provides Wi-Fi link
- MQTT Publisher → MQTT Broker: publishes telemetry (evidence: `readme.md`)
- Phone Subscriber → MQTT Broker: subscribes (evidence: `readme.md`)
- MQTT Broker → Phone Subscriber: delivers messages (evidence: `readme.md`)
