# renanaqn/iot_rtos architecture

> Architecture diagram of the GitHub repository renanaqn/iot_rtos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/renanaqn/iot_rtos
- Repository: https://github.com/renanaqn/iot_rtos

## Overview

##### Main Components
- IoT Device Core: Represent the Arduino (or similar microcontroller) as the base hardware running the sketches.
- RTOS (if applicable): Since the project is from an IoT course that mentions “IoT_RTOS” as its title, include an RTOS layer that manages tasks such as sensor readings, data processing, and network communications.
- External Services: Since MQTT usually involves an external broker, include an “MQTT Broker” node to show the external system that the device communicates with.

##### Relationships and Interactions
- A clear separation between local processing (the core firmware in the .ino files) and external communication (MQTT client sending and receiving messages).
- If applicable, denote any differences in the systems handling between the MQTT and non-MQTT versions (for example, a direct local action versus remote command processing).

##### Architectural Patterns and Design Principles
- Modular nature of IoT applications – different sketches represent variants or evolutions in functionality.
- When involving MQTT, reference the publish/subscribe pattern which is central to its architecture.

##### Relevant Technologies
- Hardware: Arduino/ESP boards (implied by .ino files).
- Communication: MQTT protocol (for the MQTT project) and possibly WiFi/Ethernet interfaces.
- Software: RTOS components (if used in the sketches, as implied by the project title “IoT_RTOS”).

- Optionally, add brief notes or legends linking each component to the corresponding .ino file examples (e.g., “ProjetoFinal_MQTT.ino – Demonstrates full IoT communication via MQTT”).
- Annotations if necessary to highlight design differences between practice exercises and the final projects.

##### Detailed Component Separation
- Hardware Layer: Microcontroller board, sensors, actuators, and communication modules.
- Software/Firmware Layer: The main Arduino sketch code, RTOS scheduling (if used), and protocol-handling modules.
- Network/Cloud Layer: Represent external MQTT broker and any data processing or storage that might be envisioned as part of the IoT system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        sensor("Sensor Module"):::hardware
        actuator("Actuator Module"):::hardware
        board("Arduino Board"):::hardware
    end
    sensor --> board
    actuator --> board

    %% Firmware/Firmware Layer
    subgraph "Firmware/Firmware Layer"
        rtos("RTOS Task Scheduler"):::firmware

        subgraph "Final Projects"
            mqtt("MQTT Communication Module"):::firmware
            nonmqtt("Non-MQTT Communication Module"):::firmware
        end

        subgraph "Practice Sketches"
            pratica02("Prática_02.ino"):::firmware
            pratica04("Prática_04.ino"):::firmware
            pratica05("Prática_05.ino"):::firmware
            pratica05fila3("Prática_05_Fila3.ino"):::firmware
            pratica06("Prática_06.ino"):::firmware
            pratica07("Prática_07.ino"):::firmware
            pratica08("Prática_08.ino"):::firmware
            pratica09("Prática_09.ino"):::firmware
            pratica10("Prática_10.ino"):::firmware
        end
    end
    board --> rtos
    rtos -->|schedules| mqtt
    rtos -->|schedules| nonmqtt
    rtos -->|schedules| pratica02

    %% Network/Cloud Layer
    subgraph "Network/Cloud Layer"
        wifi("WiFi/Ethernet Module"):::communication
        mqtbroker("MQTT Broker"):::cloud
        localproc("Local Processing"):::communication
    end
    mqtt -->|"uses"| wifi
    wifi -->|"connects"| mqtbroker
    nonmqtt -->|"triggers"| localproc

    %% Click Events
    click mqtt "https://github.com/renanaqn/iot_rtos/blob/main/ProjetoFinal_MQTT.ino"
    click nonmqtt "https://github.com/renanaqn/iot_rtos/blob/main/ProjetoFinal_semMQTT.ino"
    click pratica02 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_02.ino"
    click pratica04 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_04.ino"
    click pratica05 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_05.ino"
    click pratica05fila3 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_05_Fila3.ino"
    click pratica06 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_06.ino"
    click pratica07 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_07.ino"
    click pratica08 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_08.ino"
    click pratica09 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_09.ino"
    click pratica10 "https://github.com/renanaqn/iot_rtos/blob/main/Prática_10.ino"

    %% Styles
    classDef hardware fill:#a2d5f2,stroke:#000,stroke-width:2px;
    classDef firmware fill:#ffffcc,stroke:#000,stroke-width:2px;
    classDef communication fill:#d5f2a2,stroke:#000,stroke-width:2px;
    classDef cloud fill:#ffebcc,stroke:#000,stroke-width:2px;
```
