# binh705-engineer/two-wheeled-self-balancing-vehicle architecture

> Architecture diagram of the GitHub repository binh705-engineer/two-wheeled-self-balancing-vehicle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/binh705-engineer/two-wheeled-self-balancing-vehicle
- Repository: https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle

## Overview

This repository combines Arduino firmware with SolidWorks models for a two-wheeled balancing robot. The documented runtime workflow is IMU sensing, filtering, PID correction, and motor actuation; encoder feedback is described as conditional. The CAD files represent the robot’s mechanical design. No firmware excerpts were provided, so firmware-stage relationships below reflect README documentation rather than inspected calls; the README does not establish how the CAD parts are assembled.

Main entry points: [`Code/XECB3.ino`](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino) (Arduino firmware), [`Description/Assem2.SLDASM`](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/Assem2.SLDASM) (Robot assembly), [`Description/mpu-6050-imu-sensor-1.snapshot.5/MPU 6050 IMU.SLDASM`](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/mpu-6050-imu-sensor-1.snapshot.5/MPU%206050%20IMU.SLDASM) (MPU-6050 IMU), [`Description/encoder.SLDPRT`](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/encoder.SLDPRT) (Wheel encoders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Balance control"]
  node_firmware["Arduino firmware<br/>[XECB3.ino]"]
  node_sensing["Tilt sensing<br/>[XECB3.ino]"]
  node_filtering["Signal filtering<br/>[XECB3.ino]"]
  node_pid["PID control<br/>[XECB3.ino]"]
  node_encoder_feedback["Encoder feedback<br/>[XECB3.ino]"]
end

subgraph group_hardware["Robot hardware"]
  node_imu["MPU-6050 IMU"]
  node_driver["L298N driver"]
  node_motors["Gear motors<br/>[dongco.SLDPRT]"]
  node_encoders["Wheel encoders<br/>[encoder.SLDPRT]"]
  node_display["LCD display"]
end

subgraph group_mechanical["Mechanical design"]
  node_robot_assembly["Robot assembly<br/>[Assem2.SLDASM]"]
  node_frame_mounts["Frame and mounts<br/>[giado.SLDPRT]"]
  node_gearbox["Gearbox housing<br/>[hopgiamtoc.SLDPRT]"]
  node_wheel_couplers["Wheel couplers<br/>[khopnoibanh.SLDPRT]"]
end

node_operator(("Operator"))

node_operator -->|"uploads firmware"| node_firmware
node_imu -->|"provides tilt data"| node_sensing
node_firmware -->|"reads sensor"| node_sensing
node_sensing -->|"filters readings"| node_filtering
node_filtering -->|"feeds tilt estimate"| node_pid
node_pid -->|"sends correction"| node_driver
node_driver -->|"drives"| node_motors
node_encoders -.->|"provides wheel speed"| node_encoder_feedback
node_encoder_feedback -.->|"feeds back speed"| node_firmware
node_firmware -->|"shows status"| node_display
node_robot_assembly -.->|"uses design parts"| node_frame_mounts
node_robot_assembly -.->|"uses design parts"| node_gearbox
node_robot_assembly -.->|"uses design parts"| node_wheel_couplers

click node_firmware "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino"
click node_sensing "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino"
click node_filtering "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino"
click node_pid "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino"
click node_encoder_feedback "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino"
click node_imu "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/mpu-6050-imu-sensor-1.snapshot.5/MPU%206050%20IMU.SLDASM"
click node_motors "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/dongco.SLDPRT"
click node_encoders "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/encoder.SLDPRT"
click node_display "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/LCD1602%20with%20I2C/User%20Library-LCD1602%20with%20I2C.SLDASM"
click node_robot_assembly "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/Assem2.SLDASM"
click node_frame_mounts "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/giado.SLDPRT"
click node_gearbox "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/hopgiamtoc.SLDPRT"
click node_wheel_couplers "https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/khopnoibanh.SLDPRT"

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_sensing,node_filtering,node_pid,node_encoder_feedback toneBlue
class node_imu,node_driver,node_motors,node_encoders,node_display toneAmber
class node_robot_assembly,node_frame_mounts,node_gearbox,node_wheel_couplers toneMint
class node_operator toneIndigo
```

## Components

### Balance control

- [Arduino firmware](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino): `Code/XECB3.ino`
- [Tilt sensing](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino): `Code/XECB3.ino`
- [Signal filtering](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino): `Code/XECB3.ino`
- [PID control](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino): `Code/XECB3.ino`
- [Encoder feedback](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Code/XECB3.ino): `Code/XECB3.ino`

### Robot hardware

- [MPU-6050 IMU](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/mpu-6050-imu-sensor-1.snapshot.5/MPU%206050%20IMU.SLDASM): `Description/mpu-6050-imu-sensor-1.snapshot.5/MPU 6050 IMU.SLDASM`
- **L298N driver**
- [Gear motors](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/dongco.SLDPRT): `Description/dongco.SLDPRT`
- [Wheel encoders](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/encoder.SLDPRT): `Description/encoder.SLDPRT`
- [LCD display](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/LCD1602%20with%20I2C/User%20Library-LCD1602%20with%20I2C.SLDASM): `Description/LCD1602 with I2C/User Library-LCD1602 with I2C.SLDASM`

### Mechanical design

- [Robot assembly](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/Assem2.SLDASM): `Description/Assem2.SLDASM`
- [Frame and mounts](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/giado.SLDPRT): `Description/giado.SLDPRT`
- [Gearbox housing](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/hopgiamtoc.SLDPRT): `Description/hopgiamtoc.SLDPRT`
- [Wheel couplers](https://github.com/binh705-engineer/two-wheeled-self-balancing-vehicle/blob/main/Description/khopnoibanh.SLDPRT): `Description/khopnoibanh.SLDPRT`

### Other components

- **Operator**

## Connections

- Operator → Arduino firmware: uploads firmware (evidence: `README.md`)
- MPU-6050 IMU → Tilt sensing: provides tilt data (evidence: `README.md`)
- Arduino firmware → Tilt sensing: reads sensor (evidence: `README.md`)
- Tilt sensing → Signal filtering: filters readings (evidence: `README.md`)
- Signal filtering → PID control: feeds tilt estimate (evidence: `README.md`)
- PID control → L298N driver: sends correction (evidence: `README.md`)
- L298N driver → Gear motors: drives (evidence: `README.md`)
- Wheel encoders → Encoder feedback: provides wheel speed (evidence: `README.md`)
- Encoder feedback → Arduino firmware: feeds back speed (evidence: `README.md`)
- Arduino firmware → LCD display: shows status (evidence: `README.md`)
- Robot assembly → Frame and mounts: uses design parts
- Robot assembly → Gearbox housing: uses design parts
- Robot assembly → Wheel couplers: uses design parts
