# maximtrofimov/stm32-rc-car architecture

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

- Interactive diagram: https://gitdiagram.com/maximtrofimov/stm32-rc-car
- Repository: https://github.com/maximtrofimov/stm32-rc-car

## Overview

This is a dual-STM32 RC car: a handheld remote samples joystick input, encodes mode and steering/throttle into a packet, and transmits it over NRF24L01; the car MCU receives manual controls or runs obstacle-avoidance behavior. The car firmware also includes sensor capture and motor/servo drivers. README documents separate custom remote and car PCB designs and mechanical CAD. Main-loop and sensor/avoidance excerpts show key calls; several driver implementations and all PCB/CAD internals were not sampled, so those relationships are included only where the README supports them.

Main entry points: [`Firmware/car_mcu/main.c`](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/main.c) (Car main loop), [`Firmware/remote_mcu/main.c`](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/main.c) (Joystick and mode), [`Firmware/remote_mcu/NRF24L01.c`](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/NRF24L01.c) (Remote radio), [`Firmware/car_mcu/autonomous.c`](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/autonomous.c) (Obstacle avoidance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_remote["Remote firmware"]
  node_remote_app["Joystick and mode<br/>[main.c]"]
  node_remote_radio["Remote radio<br/>[NRF24L01.c]"]
end

subgraph group_car_control["Car control"]
  node_car_app["Car main loop<br/>[main.c]"]
  node_autonomy["Obstacle avoidance<br/>[autonomous.c]"]
end

subgraph group_car_io["Car hardware drivers"]
  node_sonar["Ultrasonic sensing<br/>[HCSR04.c]"]
  node_car_radio["Car radio<br/>[NRF24L01.c]"]
  node_motors["Motor driver<br/>[TB6612FNG.c]"]
  node_steering["Servo driver<br/>[SG90.c]"]
end

subgraph group_hardware["Physical design"]
  node_car_pcb["Car PCB<br/>[car_pcb.kicad_sch]"]
  node_remote_pcb["Remote PCB"]
  node_mechanical["Mechanical CAD"]
end

node_operator(("Operator"))
node_wireless{{"NRF24 link"}}

node_operator -->|"moves joystick"| node_remote_app
node_remote_app -->|"transmits packet"| node_remote_radio
node_remote_radio -->|"sends wirelessly"| node_wireless
node_wireless -->|"delivers packet"| node_car_radio
node_car_app -->|"receives packet"| node_car_radio
node_car_app -->|"sets throttle"| node_motors
node_car_app -->|"sets steering"| node_steering
node_car_app -.->|"runs autonomous"| node_autonomy
node_autonomy -->|"reads distances"| node_sonar
node_remote_pcb -->|"hosts MCU"| node_remote_app
node_car_pcb -->|"hosts MCU"| node_car_app

click node_remote_app "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/main.c"
click node_remote_radio "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/NRF24L01.c"
click node_car_app "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/main.c"
click node_autonomy "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/autonomous.c"
click node_sonar "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/HCSR04.c"
click node_car_radio "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/NRF24L01.c"
click node_motors "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/TB6612FNG.c"
click node_steering "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/SG90.c"
click node_car_pcb "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Hardware/car_pcb/car_pcb.kicad_sch"
click node_remote_pcb "https://github.com/maximtrofimov/stm32-rc-car/blob/main/Hardware/remote_pcb/remote_pcb.kicad_sch"
click node_mechanical "https://github.com/maximtrofimov/stm32-rc-car/tree/main/Mechanical"

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_remote_app,node_remote_radio toneBlue
class node_car_app,node_autonomy toneAmber
class node_sonar,node_car_radio,node_motors,node_steering toneMint
class node_car_pcb,node_remote_pcb,node_mechanical toneRose
class node_operator,node_wireless toneIndigo
```

## Components

### Remote firmware

- [Joystick and mode](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/main.c): `Firmware/remote_mcu/main.c`
- [Remote radio](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/remote_mcu/NRF24L01.c): `Firmware/remote_mcu/NRF24L01.c`

### Car control

- [Car main loop](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/main.c): `Firmware/car_mcu/main.c`
- [Obstacle avoidance](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/autonomous.c): `Firmware/car_mcu/autonomous.c`

### Car hardware drivers

- [Ultrasonic sensing](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/HCSR04.c): `Firmware/car_mcu/HCSR04.c`
- [Car radio](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/NRF24L01.c): `Firmware/car_mcu/NRF24L01.c`
- [Motor driver](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/TB6612FNG.c): `Firmware/car_mcu/TB6612FNG.c`
- [Servo driver](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Firmware/car_mcu/SG90.c): `Firmware/car_mcu/SG90.c`

### Physical design

- [Car PCB](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Hardware/car_pcb/car_pcb.kicad_sch): `Hardware/car_pcb/car_pcb.kicad_sch`
- [Remote PCB](https://github.com/maximtrofimov/stm32-rc-car/blob/main/Hardware/remote_pcb/remote_pcb.kicad_sch): `Hardware/remote_pcb/remote_pcb.kicad_sch`
- [Mechanical CAD](https://github.com/maximtrofimov/stm32-rc-car/tree/main/Mechanical): `Mechanical`

### Other components

- **Operator**
- **NRF24 link**

## Connections

- Operator → Joystick and mode: moves joystick (evidence: `README.md`)
- Joystick and mode → Remote radio: transmits packet (evidence: `Firmware/remote_mcu/main.c`)
- Remote radio → NRF24 link: sends wirelessly (evidence: `README.md`)
- NRF24 link → Car radio: delivers packet (evidence: `README.md`)
- Car main loop → Car radio: receives packet (evidence: `Firmware/car_mcu/main.c`)
- Car main loop → Motor driver: sets throttle (evidence: `Firmware/car_mcu/main.c`)
- Car main loop → Servo driver: sets steering (evidence: `Firmware/car_mcu/main.c`)
- Car main loop → Obstacle avoidance: runs autonomous (evidence: `README.md`)
- Obstacle avoidance → Ultrasonic sensing: reads distances (evidence: `Firmware/car_mcu/autonomous.c`)
- Remote PCB → Joystick and mode: hosts MCU (evidence: `README.md`)
- Car PCB → Car main loop: hosts MCU (evidence: `README.md`)
