# juldebidour/airpure_project architecture

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

- Interactive diagram: https://gitdiagram.com/juldebidour/airpure_project
- Repository: https://github.com/juldebidour/airpure_project

## Overview

##### Project type and purpose
- From the README and file names, this is an embedded/IoT “air‐quality” monitoring project (“Airpure_Project”) built around an Arduino (or compatible) microcontroller and at least one gas sensor (MQ135). It reads sensor data, processes it, and outputs or transmits air‐quality measurements.

##### File structure
- Top‐level directories:
- BIBLIOTHÈQUES UTILES CAPTEURS: contains the MQ135 sensor library (source, headers, examples).
- CODES: holds the Arduino sketches (“.ino” files) that implement the firmware.
- Documentation PDFs: project brief, CDC (specifications), presentation slides.
- No separate “backend” or “frontend” directories—this is a single‐board embedded system.
- Key build/dependency files: library.properties, MQ135CODE.ino, keywords.txt.

##### README for additional insights
- It simply identifies the project as a group deliverable for Transpromotion 2023/24.
- No high-level architecture details are provided there, so we infer from the code and libraries.

a. Main components
- Sensors: MQ135 gas sensor (optionally combined with DHTxx for temperature/humidity)
- Microcontroller board: Arduino UNO/compatible
- Sensor library module: MQ135-1.1.1 (C++ source + headers)
- Firmware: the two sketches (MQ_Fonctionne.ino, TranspromoMQ.ino)
- I/O interfaces: Serial port (USB) and/or wireless module (if used)
- Power supply: USB or battery (implicitly required)
- (If applicable) Data consumer: PC, logger, or cloud service reading serial data

b. Relationships and interactions
1. Hardware: the MQ135 sensor outputs an analog voltage → routed into the MCU’s ADC input.
2. Firmware: on power‐up, the MCU loads TranspromoMQ.ino; it invokes the MQ135 library to sample and convert to PPM.
3. Data processing: raw ADC values → library functions → calibrated concentration values.
4. Output: processed data → sent over Serial (USB) or to a connected logger/display or wireless module.
5. (Optional) A host PC reads serial data, logs it, or displays it in real time.

c. Architectural patterns or principles
- Layered design:
Layer 1: Hardware (sensors, power, MCU)
Layer 2: Hardware‐abstraction (MQ135 library, ADC wrapper)
Layer 3: Application logic (Arduino sketch, control loops, data formatting)
Layer 4: I/O interface (Serial or network transport)
- Reuse of open‐source sensor library for abstraction and calibration logic.

d. Key technologies/frameworks
- Arduino C++ toolchain (avr-gcc under the hood)
- MQ135-1.1.1 library (C++ .cpp/.h, configured by library.properties)
- Possibly DHTxx sensor example code (bundled in the library’s examples)
- Serial (USB) communication protocol

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        direction TB
        Power["Power Supply"]:::hardware
        Sensor["MQ135 Sensor"]:::hardware
        ADC["Arduino ADC Input"]:::hardware
        MCU["Arduino MCU"]:::hardware
        Power -->|"provides power"| Sensor
        Sensor -->|"Vout (analog)"| ADC
        ADC -->|"ADC reading"| MCU
    end

    %% Library Layer
    subgraph "Hardware-Abstraction Layer"
        direction TB
        MQ135Lib["MQ135 Library"]:::library
        Prop["library.properties"]:::library
        Keys["keywords.txt"]:::library
        MQ135Lib --> Prop
        MQ135Lib --> Keys
    end
    MCU -->|"calls functions"| MQ135Lib

    %% Library Examples
    subgraph "Library Examples" 
        direction TB
        Ex1["MQ135.ino"]:::library
        Ex2["MQ135_DHTxx.ino"]:::library
        Ex3["MQ135CODE.ino"]:::library
    end
    MQ135Lib --> Ex1
    MQ135Lib --> Ex2
    MQ135Lib --> Ex3

    %% Application Layer
    subgraph "Application Logic"
        direction TB
        MainSketch["TranspromoMQ.ino"]:::app
        TestSketch["MQ_Fonctionne.ino"]:::app
    end
    MCU --> MainSketch
    MCU --> TestSketch
    MainSketch -->|"uses MQ135Lib"| MQ135Lib
    TestSketch -->|"uses MQ135Lib"| MQ135Lib

    %% I/O Interface
    subgraph "I/O Interface"
        direction TB
        Serial["Serial (USB)"]:::io
        HostPC["Host PC / Logger"]:::external
    end
    MainSketch -->|"Serial payload"| Serial
    Serial -->|"data stream"| HostPC

    %% Documentation
    subgraph "Documentation"
        direction TB
        README["README.md"]:::doc
        Brief["Projet Transpromotion Qualité de l'Air.pdf"]:::doc
        Slides["AIRPURE.pdf"]:::doc
        CDC["CDC_AIRPURE.pdf"]:::doc
    end

    %% Click Events
    click MQ135Lib "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1"
    click Prop "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1/library.properties"
    click Keys "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1/keywords.txt"
    click Ex1 "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1/examples/MQ135/MQ135.ino"
    click Ex2 "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1/examples/MQ135_DHTxx/MQ135_DHTxx.ino"
    click Ex3 "https://github.com/juldebidour/airpure_project/blob/main/BIBLIOTHÈQUES UTILES CAPTEURS/MQ135-1.1.1/MQ135CODE/MQ135CODE.ino"
    click MainSketch "https://github.com/juldebidour/airpure_project/blob/main/CODES/TranspromoMQ.ino"
    click TestSketch "https://github.com/juldebidour/airpure_project/blob/main/CODES/MQ_Fonctionne.ino"
    click README "https://github.com/juldebidour/airpure_project/blob/main/README.md"
    click Brief "https://github.com/juldebidour/airpure_project/blob/main/Projet Transpromotion Qualité de l'Air .pdf"
    click Slides "https://github.com/juldebidour/airpure_project/blob/main/Soutenance Intermédiaire 08:11:2023/AIRPURE.pdf"
    click CDC "https://github.com/juldebidour/airpure_project/blob/main/Soutenance Intermédiaire 08:11:2023/CDC_AIRPURE.pdf"

    %% Styles
    classDef hardware fill:#b6e3a4,stroke:#333,stroke-width:1px
    classDef library fill:#a4cdf6,stroke:#333,stroke-width:1px
    classDef app fill:#f6c89f,stroke:#333,stroke-width:1px
    classDef io fill:#f2e394,stroke:#333,stroke-width:1px
    classDef external fill:#dddddd,stroke:#333,stroke-width:1px
    classDef doc fill:#d5a6bd,stroke:#333,stroke-width:1px
```
