# espressif/esp-who architecture

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

- Interactive diagram: https://gitdiagram.com/espressif/esp-who
- Repository: https://github.com/espressif/esp-who

## Overview

##### Project type and purpose
- This is an embedded image-processing platform (“ESP-WHO”) based on the Espressif ESP-IDF component model.
- It provides a collection of modular components (camera capture, ML inference, display drivers, peripheral drivers, application logic) and end-user examples (face detect, face recognition, QR-code, pedestrian detect) for various ESP32 series boards.

##### File structure
- Top-level folders:
- components/…: individual ESP-IDF components
- examples/…: complete projects tying components together
- tools/: build/CI helpers
- docs/, default_bin/: documentation and prebuilt firmware
- Inside components/, you see logical layers:
- who_peripherals: camera, LCD, SPI-flash, USB drivers
- who_frame_cap: frame capture pipeline
- who_detect, who_recognition, who_qrcode: core ML inference engines
- who_frame_lcd_disp: display pipeline
- who_app: application glue (“detect_app”, “qrcode_app”, “recognition_app”) + result handlers
- who_task: task scheduler / state machine
- Build files: each component has CMakeLists.txt and IDF metadata (idf_component.yml or Kconfig).

##### README
- Confirms ESP-WHO is built atop ESP-DL for asynchronous camera + model inference.
- Lists supported boards and features (camera, LCD, audio, buttons, etc.).
- Examples live under examples/… and use environment variable IDF_EXTRA_ACTIONS_PATH to pull in tools/.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hardware Layer
    subgraph "Hardware Layer"
        direction TB
        Camera["Camera Module"]:::hardware
        LCD["LCD Display"]:::hardware
        Buttons["Buttons/Touch"]:::hardware
        SPIFlash[(SPI-Flash / FATFS)]:::storage
        USB["USB Interface"]:::hardware
        IMU["IMU"]:::hardware
        Audio["Audio Peripheral"]:::hardware
    end

    %% Driver Layer
    subgraph "Peripheral Drivers"
        direction TB
        CamDrv["Camera Driver"]:::driver
        click CamDrv "https://github.com/espressif/esp-who/tree/master/components/who_peripherals/who_cam"
        LcdDrv["LCD Driver"]:::driver
        click LcdDrv "https://github.com/espressif/esp-who/tree/master/components/who_peripherals/who_lcd"
        SpiflashDrv["SPI-Flash FATFS Driver"]:::driver
        click SpiflashDrv "https://github.com/espressif/esp-who/tree/master/components/who_peripherals/who_spiflash_fatfs"
        UsbDrv["USB Driver"]:::driver
        click UsbDrv "https://github.com/espressif/esp-who/tree/master/components/who_peripherals/who_usb"
    end

    %% Processing / ML Layer
    subgraph "Processing / ML Components"
        direction TB
        FrameCap["Frame Capture Pipeline"]:::ml
        click FrameCap "https://github.com/espressif/esp-who/tree/master/components/who_frame_cap"
        FaceDet["Face Detection Engine"]:::ml
        click FaceDet "https://github.com/espressif/esp-who/tree/master/components/who_detect"
        QrDet["QR-Code Engine"]:::ml
        click QrDet "https://github.com/espressif/esp-who/tree/master/components/who_qrcode"
        RecDet["Face Recognition Engine"]:::ml
        click RecDet "https://github.com/espressif/esp-who/tree/master/components/who_recognition"
        DisplayPipe["Display Pipeline"]:::ml
        click DisplayPipe "https://github.com/espressif/esp-who/tree/master/components/who_frame_lcd_disp"
    end

    %% Application Layer
    subgraph "Application Logic"
        direction TB
        AppCommon["App Common Handlers"]:::app
        click AppCommon "https://github.com/espressif/esp-who/tree/master/components/who_app/who_app_common"
        DetectApp["Face Detect Application"]:::app
        click DetectApp "https://github.com/espressif/esp-who/tree/master/components/who_app/who_detect_app"
        QrApp["QR-Code Application"]:::app
        click QrApp "https://github.com/espressif/esp-who/tree/master/components/who_app/who_qrcode_app"
        RecApp["Recognition Application"]:::app
        click RecApp "https://github.com/espressif/esp-who/tree/master/components/who_app/who_recognition_app"
        TaskSch["Task Scheduler / State Machine"]:::app
        click TaskSch "https://github.com/espressif/esp-who/tree/master/components/who_task"
    end

    %% Tools & Examples
    subgraph "Build & Examples"
        direction TB
        Tools["Build & CI Tools"]:::tools
        click Tools "https://github.com/espressif/esp-who/tree/master/tools/"
        Examples["End-User Examples"]:::tools
        click Examples "https://github.com/espressif/esp-who/tree/master/examples/human_face_detect"
        Examples2["human_face_recognition"]:::tools
        click Examples2 "https://github.com/espressif/esp-who/tree/master/examples/human_face_recognition"
        Examples3["pedestrian_detect"]:::tools
        click Examples3 "https://github.com/espressif/esp-who/tree/master/examples/pedestrian_detect"
        Examples4["qrcode_recognition"]:::tools
        click Examples4 "https://github.com/espressif/esp-who/tree/master/examples/qrcode_recognition"
    end

    %% Data Flow
    Camera --> CamDrv --> FrameCap
    FrameCap --> FaceDet --> AppCommon
    FrameCap --> QrDet --> AppCommon
    FrameCap --> RecDet --> AppCommon
    AppCommon --> DisplayPipe --> LcdDrv --> LCD

    Buttons --> AppCommon
    SPIFlash <--> SpiflashDrv
    USB <--> UsbDrv
    UsbDrv --> TaskSch
    IMU --> SpiflashDrv
    Audio --> SpiflashDrv

    %% Control / Scheduling
    TaskSch -.-> FrameCap
    TaskSch -.-> FaceDet
    TaskSch -.-> QrDet
    TaskSch -.-> RecDet
    TaskSch -.-> DisplayPipe
    TaskSch -.-> AppCommon

    %% Examples & Tools Integration
    Examples --> Tools
    Examples2 --> Tools
    Examples3 --> Tools
    Examples4 --> Tools

    %% Styles
    classDef hardware fill:#e0ffe0,stroke:#333,stroke-width:1px
    classDef driver fill:#a8d5a2,stroke:#333,stroke-width:1px
    classDef ml fill:#a2c8f0,stroke:#333,stroke-width:1px
    classDef app fill:#f0a273,stroke:#333,stroke-width:1px
    classDef tools fill:#cccccc,stroke:#333,stroke-width:1px
    classDef storage fill:#f2e394,stroke:#333,stroke-width:1px
```
