# carlosgabrriel/tccifmg architecture

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

- Interactive diagram: https://gitdiagram.com/carlosgabrriel/tccifmg
- Repository: https://github.com/carlosgabrriel/tccifmg

## Overview

This repository is a low-cost motor-vibration monitoring prototype. Its main workflow samples three-axis acceleration on an ESP32, publishes readings over MQTT, computes and filters an FFT in Python, then exposes the spectrum for visualization. The README also documents connection-status LEDs and real-time charts. The Python source confirms a WebSocket output, but the sampled files do not establish how index.html consumes it; that link is therefore unverified. README filenames differ from the files in the tree, so the graph uses only paths actually present.

Main entry points: [`codigo_esp32.cpp`](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_esp32.cpp) (ESP32 acquisition), [`codigo_rec.py`](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py) (MQTT subscriber), [`index.html`](https://github.com/carlosgabrriel/tccifmg/blob/main/index.html) (Visualization page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Sensor device"]
  node_mpu["MPU6050 sensor"]
  node_esp32["ESP32 acquisition<br/>[codigo_esp32.cpp]"]
  node_status_leds["Connection LEDs<br/>[codigo_esp32.cpp]"]
end

subgraph group_transport["Data transport"]
  node_broker[("HiveMQ broker")]
end

subgraph group_processing["Signal processing"]
  node_mqtt_receive["MQTT subscriber<br/>[codigo_rec.py]"]
  node_sample_buffer["Axis sample buffer<br/>[codigo_rec.py]"]
  node_fft_filter["FFT and filtering<br/>[codigo_rec.py]"]
  node_spectrum["Spectrum result<br/>[codigo_rec.py]"]
end

subgraph group_presentation["Visualization"]
  node_websocket["WebSocket server<br/>[codigo_rec.py]"]
  node_web_ui["Visualization page<br/>[index.html]"]
end

node_motor(("Motor vibration"))

node_motor -->|"vibrates"| node_mpu
node_mpu -->|"I2C readings"| node_esp32
node_esp32 -->|"publishes MQTT"| node_broker
node_esp32 -->|"updates status"| node_status_leds
node_broker -->|"delivers topic"| node_mqtt_receive
node_mqtt_receive -->|"appends samples"| node_sample_buffer
node_sample_buffer -->|"computes spectrum"| node_fft_filter
node_fft_filter -->|"stores result"| node_spectrum
node_spectrum -->|"sends JSON"| node_websocket
node_websocket -.->|"streams spectrum"| node_web_ui

click node_esp32 "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_esp32.cpp"
click node_status_leds "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_esp32.cpp"
click node_mqtt_receive "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py"
click node_sample_buffer "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py"
click node_fft_filter "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py"
click node_spectrum "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py"
click node_websocket "https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py"
click node_web_ui "https://github.com/carlosgabrriel/tccifmg/blob/main/index.html"

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_mpu,node_esp32,node_status_leds toneBlue
class node_broker toneAmber
class node_mqtt_receive,node_sample_buffer,node_fft_filter,node_spectrum toneMint
class node_websocket,node_web_ui toneRose
class node_motor toneIndigo
```

## Components

### Sensor device

- **MPU6050 sensor**
- [ESP32 acquisition](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_esp32.cpp): `codigo_esp32.cpp`
- [Connection LEDs](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_esp32.cpp): `codigo_esp32.cpp`

### Data transport

- **HiveMQ broker**

### Signal processing

- [MQTT subscriber](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py): `codigo_rec.py`
- [Axis sample buffer](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py): `codigo_rec.py`
- [FFT and filtering](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py): `codigo_rec.py`
- [Spectrum result](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py): `codigo_rec.py`

### Visualization

- [WebSocket server](https://github.com/carlosgabrriel/tccifmg/blob/main/codigo_rec.py): `codigo_rec.py`
- [Visualization page](https://github.com/carlosgabrriel/tccifmg/blob/main/index.html): `index.html`

### Other components

- **Motor vibration**

## Connections

- Motor vibration → MPU6050 sensor: vibrates (evidence: `README.md`)
- MPU6050 sensor → ESP32 acquisition: I2C readings (evidence: `README.md`)
- ESP32 acquisition → HiveMQ broker: publishes MQTT (evidence: `codigo_esp32.cpp`)
- ESP32 acquisition → Connection LEDs: updates status (evidence: `codigo_esp32.cpp`)
- HiveMQ broker → MQTT subscriber: delivers topic (evidence: `codigo_rec.py`)
- MQTT subscriber → Axis sample buffer: appends samples (evidence: `codigo_rec.py`)
- Axis sample buffer → FFT and filtering: computes spectrum (evidence: `codigo_rec.py`)
- FFT and filtering → Spectrum result: stores result (evidence: `codigo_rec.py`)
- Spectrum result → WebSocket server: sends JSON (evidence: `codigo_rec.py`)
- WebSocket server → Visualization page: streams spectrum
