# vngreentech/drone_mini architecture

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

- Interactive diagram: https://gitdiagram.com/vngreentech/drone_mini
- Repository: https://github.com/vngreentech/drone_mini

## Overview

This repository is an STM32 quadcopter flight controller, alongside a separate test-board firmware. The main firmware enters through Arduino setup/loop, initializes the application, and repeatedly runs its flight-control loop; the sampled application excerpt shows PID-based motor mixing, reset protection, and persistent PID settings. The tree and README identify receiver, IMU, motor, sensor, and OLED subsystems, but their full runtime wiring is not shown. Dashed links mark those unverified integrations; the test-board firmware is represented separately.

Main entry points: [`FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp`](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp) (Flight application), [`FW_DRONE_MINI/src/IMU/IMU.cpp`](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/IMU/IMU.cpp) (IMU acquisition), [`FW_DRONE_MINI/src/LCD/LCD.cpp`](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/LCD/LCD.cpp) (Flight display), [`FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp`](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp) (MPU6050 driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flight["Flight control"]
  node_main["Arduino entry<br/>[main.cpp]"]
  node_app["Flight application<br/>[APPLICATION.cpp]"]
  node_receiver["RC receiver<br/>[RECEIVER.cpp]"]
  node_imu["IMU acquisition<br/>[IMU.cpp]"]
  node_pid["PID control<br/>[PID.cpp]"]
  node_motor["Motor output<br/>[MOTOR.cpp]"]
  node_sensor["Sensor support<br/>[SENSOR.cpp]"]
  node_global["Hardware configuration<br/>[GLOBAL.h]"]
end

subgraph group_hardware["Device interfaces"]
  node_oled["Flight display<br/>[LCD.cpp]"]
  node_mpu["MPU6050 driver<br/>[MPU6050.cpp]"]
  node_motion["MotionApps DMP"]
  node_eeprom[("EEPROM storage")]
end

subgraph group_libraries["Embedded libraries"]
  node_i2c["I2C transport<br/>[I2Cdev.cpp]"]
  node_kalman["Kalman filter"]
  node_u8g["OLED graphics<br/>[u8g2.h]"]
end

subgraph group_test["Test board"]
  node_testfw["Board test firmware<br/>[FW_TEST_BOARD.cpp]"]
  node_testmpu["Test-board MPU driver<br/>[MPU6050.cpp]"]
end

node_pilot(("RC pilot"))
node_esc["ESCs and motors"]
node_display["OLED display"]

node_pilot -.->|"sends channels"| node_receiver
node_main -->|"starts and loops"| node_app
node_app -.->|"reads channels"| node_receiver
node_app -.->|"reads attitude"| node_imu
node_app -.->|"runs control"| node_pid
node_app -.->|"sets outputs"| node_motor
node_app -.->|"updates display"| node_oled
node_app -.->|"uses sensors"| node_sensor
node_app -->|"uses configuration"| node_global
node_app -->|"reads and saves"| node_eeprom
node_app -.->|"mixes motor commands"| node_esc
node_imu -.->|"acquires motion"| node_mpu
node_mpu -->|"accesses registers"| node_i2c
node_mpu -.->|"uses DMP"| node_motion
node_imu -.->|"filters readings"| node_kalman
node_oled -.->|"renders interface"| node_u8g
node_oled -.->|"writes display"| node_display
node_testfw -->|"initializes and reads"| node_testmpu
node_testfw -->|"renders test values"| node_display

click node_main "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/main.cpp"
click node_app "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp"
click node_receiver "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/RECEIVER/RECEIVER.cpp"
click node_imu "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/IMU/IMU.cpp"
click node_pid "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/PID/PID.cpp"
click node_motor "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/MOTOR/MOTOR.cpp"
click node_sensor "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/SENSOR/SENSOR.cpp"
click node_global "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/GLOBAL/GLOBAL.h"
click node_oled "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/LCD/LCD.cpp"
click node_mpu "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp"
click node_motion "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050_6Axis_MotionApps20.cpp"
click node_i2c "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/I2Cdev.cpp"
click node_kalman "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/SimpleKalmanFilter/src/SimpleKalmanFilter.cpp"
click node_u8g "https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/U8g2/src/clib/u8g2.h"
click node_testfw "https://github.com/vngreentech/drone_mini/blob/main/FW_TEST_BOARD_UAV_MINI/src/FW_TEST_BOARD.cpp"
click node_testmpu "https://github.com/vngreentech/drone_mini/blob/main/FW_TEST_BOARD_UAV_MINI/lib/MPU6050_LIB/MPU6050.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_main,node_app,node_receiver,node_imu,node_pid,node_motor,node_sensor,node_global toneBlue
class node_oled,node_mpu,node_motion,node_eeprom toneAmber
class node_i2c,node_kalman,node_u8g toneMint
class node_testfw,node_testmpu toneRose
class node_pilot,node_esc,node_display toneIndigo
```

## Components

### Flight control

- [Arduino entry](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/main.cpp): `FW_DRONE_MINI/src/main.cpp`
- [Flight application](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp): `FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp`
- [RC receiver](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/RECEIVER/RECEIVER.cpp): `FW_DRONE_MINI/src/RECEIVER/RECEIVER.cpp`
- [IMU acquisition](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/IMU/IMU.cpp): `FW_DRONE_MINI/src/IMU/IMU.cpp`
- [PID control](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/PID/PID.cpp): `FW_DRONE_MINI/src/PID/PID.cpp`
- [Motor output](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/MOTOR/MOTOR.cpp): `FW_DRONE_MINI/src/MOTOR/MOTOR.cpp`
- [Sensor support](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/SENSOR/SENSOR.cpp): `FW_DRONE_MINI/src/SENSOR/SENSOR.cpp`
- [Hardware configuration](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/GLOBAL/GLOBAL.h): `FW_DRONE_MINI/src/GLOBAL/GLOBAL.h`

### Device interfaces

- [Flight display](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/src/LCD/LCD.cpp): `FW_DRONE_MINI/src/LCD/LCD.cpp`
- [MPU6050 driver](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp): `FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp`
- [MotionApps DMP](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050_6Axis_MotionApps20.cpp): `FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050_6Axis_MotionApps20.cpp`
- **EEPROM storage**

### Embedded libraries

- [I2C transport](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/MPU6050_LIB/I2Cdev.cpp): `FW_DRONE_MINI/lib/MPU6050_LIB/I2Cdev.cpp`
- [Kalman filter](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/SimpleKalmanFilter/src/SimpleKalmanFilter.cpp): `FW_DRONE_MINI/lib/SimpleKalmanFilter/src/SimpleKalmanFilter.cpp`
- [OLED graphics](https://github.com/vngreentech/drone_mini/blob/main/FW_DRONE_MINI/lib/U8g2/src/clib/u8g2.h): `FW_DRONE_MINI/lib/U8g2/src/clib/u8g2.h`

### Test board

- [Board test firmware](https://github.com/vngreentech/drone_mini/blob/main/FW_TEST_BOARD_UAV_MINI/src/FW_TEST_BOARD.cpp): `FW_TEST_BOARD_UAV_MINI/src/FW_TEST_BOARD.cpp`
- [Test-board MPU driver](https://github.com/vngreentech/drone_mini/blob/main/FW_TEST_BOARD_UAV_MINI/lib/MPU6050_LIB/MPU6050.cpp): `FW_TEST_BOARD_UAV_MINI/lib/MPU6050_LIB/MPU6050.cpp`

### Other components

- **RC pilot**
- **ESCs and motors**
- **OLED display**

## Connections

- RC pilot → RC receiver: sends channels
- Arduino entry → Flight application: starts and loops (evidence: `FW_DRONE_MINI/src/main.cpp`)
- Flight application → RC receiver: reads channels
- Flight application → IMU acquisition: reads attitude
- Flight application → PID control: runs control
- Flight application → Motor output: sets outputs
- Flight application → Flight display: updates display
- Flight application → Sensor support: uses sensors
- Flight application → Hardware configuration: uses configuration
- Flight application → EEPROM storage: reads and saves (evidence: `FW_DRONE_MINI/src/APPLICATION/APPLICATION.cpp`)
- Flight application → ESCs and motors: mixes motor commands
- IMU acquisition → MPU6050 driver: acquires motion
- MPU6050 driver → I2C transport: accesses registers (evidence: `FW_DRONE_MINI/lib/MPU6050_LIB/MPU6050.cpp`)
- MPU6050 driver → MotionApps DMP: uses DMP
- IMU acquisition → Kalman filter: filters readings
- Flight display → OLED graphics: renders interface
- Flight display → OLED display: writes display
- Board test firmware → Test-board MPU driver: initializes and reads (evidence: `FW_TEST_BOARD_UAV_MINI/src/FW_TEST_BOARD.cpp`)
- Board test firmware → OLED display: renders test values (evidence: `FW_TEST_BOARD_UAV_MINI/src/FW_TEST_BOARD.cpp`)
