# bengrumm/stm32-rc-car architecture

> Architecture diagram of the GitHub repository bengrumm/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/bengrumm/stm32-rc-car
- Repository: https://github.com/bengrumm/stm32-rc-car

## Overview

This repository implements an STM32-based, four-wheel-drive RC car with touchscreen and Bluetooth control, plus obstacle detection and driver notification. The board’s main loop initializes the hardware and handles touch input; touchscreen commands can program and run a sequence, while Bluetooth UART input can drive the car directly. The README also identifies the Android phone app and the HC-06 link. The app source was not sampled, so its internal behavior is represented only at the documented subsystem level; firmware relationships below are based on excerpts and the source index.

Main entry points: [`STM-Code/obastacleDetector.c`](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/obastacleDetector.c) (Obstacle Detector), [`STM-Code/motors.c`](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/motors.c) (Motor Driver), [`STM-Code/Main.c`](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/Main.c) (Board Main Loop), [`STM-Code/bluetoothConnection.c`](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/bluetoothConnection.c) (Bluetooth UART)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_firmware["Board Firmware"]
  node_main["Board Main Loop<br/>[Main.c]"]
end

subgraph group_control["Driving Controls"]
  node_touch["Touchscreen UI<br/>[GUI.c]"]
  node_sequence["Programmed Driving<br/>[GUI.c]"]
  node_phone["Phone App"]
  node_bluetooth["Bluetooth UART"]
end

subgraph group_safety["Safety and Feedback"]
  node_obstacle["Obstacle Detector"]
  node_buzzer["Buzzer"]
end

subgraph group_hardware["Car Hardware"]
  node_motors["Motor Driver<br/>[motors.c]"]
  node_car["RC Car Motors"]
  node_hc06["HC-06 Module"]
  node_sensor["Infrared Sensor"]
end

node_driver(("Driver"))

node_driver -->|"touches"| node_touch
node_main -->|"reads touch"| node_touch
node_main -->|"initializes"| node_bluetooth
node_main -->|"initializes"| node_obstacle
node_main -->|"initializes"| node_motors
node_touch -->|"handles presses"| node_sequence
node_sequence -->|"drives commands"| node_motors
node_phone -.->|"sends commands"| node_hc06
node_hc06 -.->|"UART input"| node_bluetooth
node_bluetooth -->|"drives commands"| node_motors
node_obstacle -->|"stops forward motion"| node_motors
node_obstacle -->|"sends alert"| node_bluetooth
node_obstacle -->|"signals obstacle"| node_buzzer
node_sensor -.->|"triggers interrupt"| node_obstacle
node_motors -.->|"drives"| node_car

click node_main "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/Main.c"
click node_touch "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/GUI.c"
click node_sequence "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/GUI.c"
click node_phone "https://github.com/bengrumm/stm32-rc-car/tree/main/Blutooth-Phone-App/app/src/main/java/com/example/bluetoothrccontroller"
click node_bluetooth "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/bluetoothConnection.c"
click node_obstacle "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/obastacleDetector.c"
click node_buzzer "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/obastacleDetector.c"
click node_motors "https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/motors.c"

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 toneBlue
class node_touch,node_sequence,node_phone,node_bluetooth toneAmber
class node_obstacle,node_buzzer toneMint
class node_motors,node_car,node_hc06,node_sensor toneRose
class node_driver toneIndigo
```

## Components

### Board Firmware

- [Board Main Loop](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/Main.c): `STM-Code/Main.c`

### Driving Controls

- [Touchscreen UI](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/GUI.c): `STM-Code/GUI.c`
- [Programmed Driving](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/GUI.c): `STM-Code/GUI.c`
- [Phone App](https://github.com/bengrumm/stm32-rc-car/tree/main/Blutooth-Phone-App/app/src/main/java/com/example/bluetoothrccontroller): `Blutooth-Phone-App/app/src/main/java/com/example/bluetoothrccontroller`
- [Bluetooth UART](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/bluetoothConnection.c): `STM-Code/bluetoothConnection.c`

### Safety and Feedback

- [Obstacle Detector](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/obastacleDetector.c): `STM-Code/obastacleDetector.c`
- [Buzzer](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/obastacleDetector.c): `STM-Code/obastacleDetector.c`

### Car Hardware

- [Motor Driver](https://github.com/bengrumm/stm32-rc-car/blob/main/STM-Code/motors.c): `STM-Code/motors.c`
- **RC Car Motors**
- **HC-06 Module**
- **Infrared Sensor**

### Other components

- **Driver**

## Connections

- Driver → Touchscreen UI: touches (evidence: `README.md`)
- Board Main Loop → Touchscreen UI: reads touch (evidence: `STM-Code/Main.c`)
- Board Main Loop → Bluetooth UART: initializes (evidence: `STM-Code/Main.c`)
- Board Main Loop → Obstacle Detector: initializes (evidence: `STM-Code/Main.c`)
- Board Main Loop → Motor Driver: initializes (evidence: `STM-Code/Main.c`)
- Touchscreen UI → Programmed Driving: handles presses (evidence: `STM-Code/GUI.c`)
- Programmed Driving → Motor Driver: drives commands (evidence: `STM-Code/GUI.c`)
- Phone App → HC-06 Module: sends commands (evidence: `README.md`)
- HC-06 Module → Bluetooth UART: UART input (evidence: `README.md`)
- Bluetooth UART → Motor Driver: drives commands (evidence: `STM-Code/bluetoothConnection.c`)
- Obstacle Detector → Motor Driver: stops forward motion (evidence: `STM-Code/obastacleDetector.c`)
- Obstacle Detector → Bluetooth UART: sends alert (evidence: `STM-Code/obastacleDetector.c`)
- Obstacle Detector → Buzzer: signals obstacle (evidence: `STM-Code/obastacleDetector.c`)
- Infrared Sensor → Obstacle Detector: triggers interrupt (evidence: `README.md`)
- Motor Driver → RC Car Motors: drives (evidence: `README.md`)
