# gpapazachariou/esp32_diploma architecture

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

- Interactive diagram: https://gitdiagram.com/gpapazachariou/esp32_diploma
- Repository: https://github.com/gpapazachariou/esp32_diploma

## Overview

This is the ESP32 lower-controller firmware for Waveshare UGV robots. The principal workflow is an upper computer or web client sending JSON commands, which the controller handles to drive motion and optional camera gimbal or RoArm modules; it also processes sensor data and provides status through the OLED and web interface. The graph preserves documented capabilities, including ESP-NOW and LED control. Source excerpts are limited, so several firmware dispatch links are documented or marked unverified rather than inferred from module names.

Main entry points: [`General_Driver/General_Driver.ino`](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/General_Driver.ino) (ESP32 firmware), [`General_Driver/json_cmd.h`](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/json_cmd.h) (JSON command handling), [`General_Driver/IMU.cpp`](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/IMU.cpp) (IMU processing), [`SCServo/SCS.cpp`](https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCS.cpp) (Servo protocol)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Interfaces"]
  node_firmware["ESP32 firmware<br/>[General_Driver.ino]"]
  node_uart["UART commands<br/>[uart_ctrl.h]"]
  node_http["HTTP server<br/>[http_server.h]"]
  node_web_page["Web interface<br/>[web_page.h]"]
  node_json["JSON command handling<br/>[json_cmd.h]"]
  node_wifi["Wi-Fi control<br/>[wifi_ctrl.h]"]
  node_espnow["ESP-NOW<br/>[esp_now_ctrl.h]"]
end

subgraph group_control["Robot control"]
  node_motion["Motion control<br/>[movtion_module.h]"]
  node_drive["Drive configuration<br/>[ugv_config.h]"]
  node_advance["UGV control<br/>[ugv_advance.h]"]
  node_gimbal["Camera gimbal<br/>[gimbal_module.h]"]
  node_roarm["RoArm-M2<br/>[RoArm-M2_module.h]"]
  node_led["LED switches<br/>[ugv_led_ctrl.h]"]
end

subgraph group_sensors["Sensors and status"]
  node_imu_ctrl["IMU integration<br/>[IMU_ctrl.h]"]
  node_imu["IMU processing<br/>[IMU.cpp]"]
  node_qmi["QMI8658 driver<br/>[QMI8658.cpp]"]
  node_ak["AK09918 driver<br/>[AK09918.cpp]"]
  node_oled["OLED display<br/>[oled_ctrl.h]"]
  node_battery["Battery status<br/>[battery_ctrl.h]"]
  node_files["Device files<br/>[files_ctrl.h]"]
end

subgraph group_servo["Servo support"]
  node_servo_api["Servo command API<br/>[SCSCL.cpp]"]
  node_servo_proto["Servo protocol<br/>[SCS.cpp]"]
  node_servo_serial["Servo serial transport<br/>[SCSerial.cpp]"]
  node_sms_sts["SMS/STS servo API<br/>[SMS_STS.cpp]"]
end

node_host(("Upper computer"))
node_web_client(("Web client"))

node_host -->|"sends JSON"| node_uart
node_uart -.->|"feeds commands"| node_firmware
node_web_client -->|"uses interface"| node_web_page
node_web_page -->|"sends requests"| node_http
node_http -.->|"routes requests"| node_firmware
node_firmware -.->|"dispatches commands"| node_json
node_firmware -.->|"configures connectivity"| node_wifi
node_firmware -->|"supports messaging"| node_espnow
node_json -.->|"controls motion"| node_motion
node_motion -.->|"uses drive settings"| node_drive
node_firmware -.->|"controls UGV"| node_advance
node_json -->|"controls gimbal"| node_gimbal
node_json -->|"controls arm"| node_roarm
node_json -->|"sets LED switches"| node_led
node_firmware -.->|"initializes IMU"| node_imu_ctrl
node_imu_ctrl -->|"delegates processing"| node_imu
node_imu -->|"uses sensor"| node_qmi
node_imu -->|"uses magnetometer"| node_ak
node_firmware -->|"updates display"| node_oled
node_firmware -.->|"reads battery"| node_battery
node_firmware -.->|"uses device files"| node_files
node_roarm -.->|"uses servo API"| node_servo_api
node_servo_api -->|"issues servo commands"| node_servo_proto
node_sms_sts -->|"issues servo commands"| node_servo_proto
node_servo_proto -->|"uses transport"| node_servo_serial

click node_firmware "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/General_Driver.ino"
click node_uart "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/uart_ctrl.h"
click node_http "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/http_server.h"
click node_web_page "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/web_page.h"
click node_json "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/json_cmd.h"
click node_wifi "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/wifi_ctrl.h"
click node_espnow "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/esp_now_ctrl.h"
click node_motion "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/movtion_module.h"
click node_drive "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_config.h"
click node_advance "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_advance.h"
click node_gimbal "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/gimbal_module.h"
click node_roarm "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/RoArm-M2_module.h"
click node_led "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_led_ctrl.h"
click node_imu_ctrl "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/IMU_ctrl.h"
click node_imu "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/IMU.cpp"
click node_qmi "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/QMI8658.cpp"
click node_ak "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/AK09918.cpp"
click node_oled "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/oled_ctrl.h"
click node_battery "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/battery_ctrl.h"
click node_files "https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/files_ctrl.h"
click node_servo_api "https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCSCL.cpp"
click node_servo_proto "https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCS.cpp"
click node_servo_serial "https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCSerial.cpp"
click node_sms_sts "https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SMS_STS.cpp"

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_firmware,node_uart,node_http,node_web_page,node_json,node_wifi,node_espnow,node_web_client toneBlue
class node_motion,node_drive,node_advance,node_gimbal,node_roarm,node_led toneAmber
class node_imu_ctrl,node_imu,node_qmi,node_ak,node_oled,node_battery,node_files toneMint
class node_servo_api,node_servo_proto,node_servo_serial,node_sms_sts toneRose
class node_host toneIndigo
```

## Components

### Interfaces

- [ESP32 firmware](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/General_Driver.ino): `General_Driver/General_Driver.ino`
- [UART commands](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/uart_ctrl.h): `General_Driver/uart_ctrl.h`
- [HTTP server](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/http_server.h): `General_Driver/http_server.h`
- [Web interface](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/web_page.h): `General_Driver/web_page.h`
- [JSON command handling](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/json_cmd.h): `General_Driver/json_cmd.h`
- [Wi-Fi control](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/wifi_ctrl.h): `General_Driver/wifi_ctrl.h`
- [ESP-NOW](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/esp_now_ctrl.h): `General_Driver/esp_now_ctrl.h`

### Robot control

- [Motion control](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/movtion_module.h): `General_Driver/movtion_module.h`
- [Drive configuration](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_config.h): `General_Driver/ugv_config.h`
- [UGV control](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_advance.h): `General_Driver/ugv_advance.h`
- [Camera gimbal](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/gimbal_module.h): `General_Driver/gimbal_module.h`
- [RoArm-M2](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/RoArm-M2_module.h): `General_Driver/RoArm-M2_module.h`
- [LED switches](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/ugv_led_ctrl.h): `General_Driver/ugv_led_ctrl.h`

### Sensors and status

- [IMU integration](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/IMU_ctrl.h): `General_Driver/IMU_ctrl.h`
- [IMU processing](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/IMU.cpp): `General_Driver/IMU.cpp`
- [QMI8658 driver](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/QMI8658.cpp): `General_Driver/QMI8658.cpp`
- [AK09918 driver](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/AK09918.cpp): `General_Driver/AK09918.cpp`
- [OLED display](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/oled_ctrl.h): `General_Driver/oled_ctrl.h`
- [Battery status](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/battery_ctrl.h): `General_Driver/battery_ctrl.h`
- [Device files](https://github.com/gpapazachariou/esp32_diploma/blob/main/General_Driver/files_ctrl.h): `General_Driver/files_ctrl.h`

### Servo support

- [Servo command API](https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCSCL.cpp): `SCServo/SCSCL.cpp`
- [Servo protocol](https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCS.cpp): `SCServo/SCS.cpp`
- [Servo serial transport](https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SCSerial.cpp): `SCServo/SCSerial.cpp`
- [SMS/STS servo API](https://github.com/gpapazachariou/esp32_diploma/blob/main/SCServo/SMS_STS.cpp): `SCServo/SMS_STS.cpp`

### Other components

- **Upper computer**
- **Web client**

## Connections

- Upper computer → UART commands: sends JSON (evidence: `README.md`)
- UART commands → ESP32 firmware: feeds commands
- Web client → Web interface: uses interface (evidence: `README.md`)
- Web interface → HTTP server: sends requests (evidence: `General_Driver/web_page.h`)
- HTTP server → ESP32 firmware: routes requests
- ESP32 firmware → JSON command handling: dispatches commands
- ESP32 firmware → Wi-Fi control: configures connectivity
- ESP32 firmware → ESP-NOW: supports messaging (evidence: `README.md`)
- JSON command handling → Motion control: controls motion
- Motion control → Drive configuration: uses drive settings
- ESP32 firmware → UGV control: controls UGV
- JSON command handling → Camera gimbal: controls gimbal (evidence: `README.md`)
- JSON command handling → RoArm-M2: controls arm (evidence: `README.md`)
- JSON command handling → LED switches: sets LED switches (evidence: `README.md`)
- ESP32 firmware → IMU integration: initializes IMU
- IMU integration → IMU processing: delegates processing (evidence: `General_Driver/IMU_ctrl.h`)
- IMU processing → QMI8658 driver: uses sensor
- IMU processing → AK09918 driver: uses magnetometer
- ESP32 firmware → OLED display: updates display (evidence: `README.md`)
- ESP32 firmware → Battery status: reads battery
- ESP32 firmware → Device files: uses device files
- RoArm-M2 → Servo command API: uses servo API
- Servo command API → Servo protocol: issues servo commands (evidence: `SCServo/SCSCL.cpp`)
- SMS/STS servo API → Servo protocol: issues servo commands (evidence: `SCServo/SMS_STS.cpp`)
- Servo protocol → Servo serial transport: uses transport
