# can-fish/stm32-projects architecture

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

- Interactive diagram: https://gitdiagram.com/can-fish/stm32-projects
- Repository: https://github.com/can-fish/stm32-projects

## Overview

This repository contains three independent STM32F103 embedded applications: a line-following and obstacle-avoiding car, a temperature-controlled/manual fan, and a temperature-humidity monitor with threshold alarms. Each workflow is coordinated by its project’s main loop, which reads sensors or user input, applies control or threshold logic, and updates actuators and the OLED. The wiring below follows the README and sampled main files; unsampled driver internals are not expanded.

Main entry points: [`智能小车/User/main.c`](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/User/main.c) (Car control loop), [`温控智能风扇/User/main.c`](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/User/main.c) (Fan control loop), [`湿温度检测装置/user/main.c`](https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/user/main.c) (Monitor loop), [`智能小车/Hardware/Tracking.c`](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Tracking.c) (Line sensors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_car["Smart car"]
  node_car_main["Car control loop<br/>[main.c]"]
end

subgraph group_fan["Temperature fan"]
  node_fan_main["Fan control loop<br/>[main.c]"]
end

subgraph group_monitor["Climate monitor"]
  node_climate_main["Monitor loop<br/>[main.c]"]
end

subgraph group_drivers["Board drivers"]
  node_car_track["Line sensors<br/>[Tracking.c]"]
  node_car_mpu["Gyro sensing<br/>[MPU6050.c]"]
  node_car_range["Distance sensing<br/>[Ultrasonic.c]"]
  node_car_keys["Key input<br/>[Key.c]"]
  node_car_motors["Drive motors<br/>[Motor1.c]"]
  node_car_motor2["Second motor<br/>[Motor2.c]"]
  node_car_oled["Status display<br/>[OLED.c]"]
  node_fan_adc["NTC sampling<br/>[AD.c]"]
  node_fan_encoder["Speed input<br/>[Encoder.c]"]
  node_fan_keys["Mode input<br/>[Key.c]"]
  node_fan_motor["Fan motor<br/>[Motor.c]"]
  node_fan_led["Mode indicators<br/>[LED.c]"]
  node_fan_oled["Status display<br/>[OLED.c]"]
  node_climate_sensor["DHT11 sensing<br/>[dht11.c]"]
  node_climate_oled["Climate display<br/>[OLED.c]"]
  node_climate_alarm["Buzzer driver<br/>[FMQ.c]"]
end

node_car_user(("Car operator"))
node_fan_user(("Fan operator"))
node_climate_user(("Room occupant"))

node_car_user -->|"starts"| node_car_main
node_car_main -->|"reads line"| node_car_track
node_car_main -->|"reads angle"| node_car_mpu
node_car_main -->|"reads distance"| node_car_range
node_car_main -->|"reads keys"| node_car_keys
node_car_main -->|"sets speed"| node_car_motors
node_car_main -->|"sets speed"| node_car_motor2
node_car_main -->|"renders status"| node_car_oled
node_fan_user -->|"operates"| node_fan_main
node_fan_main -->|"reads ADC"| node_fan_adc
node_fan_main -->|"reads rotation"| node_fan_encoder
node_fan_main -->|"reads keys"| node_fan_keys
node_fan_main -->|"sets speed"| node_fan_motor
node_fan_main -->|"sets indicators"| node_fan_led
node_fan_main -->|"renders status"| node_fan_oled
node_climate_user -->|"views readings"| node_climate_main
node_climate_main -->|"reads climate"| node_climate_sensor
node_climate_main -->|"renders readings"| node_climate_oled
node_climate_main -->|"controls alarm"| node_climate_alarm

click node_car_main "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/User/main.c"
click node_car_track "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Tracking.c"
click node_car_mpu "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/MPU6050.c"
click node_car_range "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Ultrasonic.c"
click node_car_keys "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Key.c"
click node_car_motors "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Motor1.c"
click node_car_motor2 "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Motor2.c"
click node_car_oled "https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/OLED.c"
click node_fan_main "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/User/main.c"
click node_fan_adc "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/AD.c"
click node_fan_encoder "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Encoder.c"
click node_fan_keys "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Key.c"
click node_fan_motor "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Motor.c"
click node_fan_led "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/LED.c"
click node_fan_oled "https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/OLED.c"
click node_climate_main "https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/user/main.c"
click node_climate_sensor "https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/DHT11/dht11.c"
click node_climate_oled "https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/OLED.c"
click node_climate_alarm "https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/FMQ.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_car_main toneBlue
class node_fan_main toneAmber
class node_climate_main toneMint
class node_car_track,node_car_mpu,node_car_range,node_car_keys,node_car_motors,node_car_motor2,node_car_oled,node_fan_adc,node_fan_encoder,node_fan_keys,node_fan_motor,node_fan_led,node_fan_oled,node_climate_sensor,node_climate_oled,node_climate_alarm toneRose
class node_car_user,node_fan_user,node_climate_user toneIndigo
```

## Components

### Smart car

- [Car control loop](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/User/main.c): `智能小车/User/main.c`

### Temperature fan

- [Fan control loop](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/User/main.c): `温控智能风扇/User/main.c`

### Climate monitor

- [Monitor loop](https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/user/main.c): `湿温度检测装置/user/main.c`

### Board drivers

- [Line sensors](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Tracking.c): `智能小车/Hardware/Tracking.c`
- [Gyro sensing](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/MPU6050.c): `智能小车/Hardware/MPU6050.c`
- [Distance sensing](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Ultrasonic.c): `智能小车/Hardware/Ultrasonic.c`
- [Key input](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Key.c): `智能小车/Hardware/Key.c`
- [Drive motors](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Motor1.c): `智能小车/Hardware/Motor1.c`
- [Second motor](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/Motor2.c): `智能小车/Hardware/Motor2.c`
- [Status display](https://github.com/can-fish/stm32-projects/blob/main/%E6%99%BA%E8%83%BD%E5%B0%8F%E8%BD%A6/Hardware/OLED.c): `智能小车/Hardware/OLED.c`
- [NTC sampling](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/AD.c): `温控智能风扇/Hardware/AD.c`
- [Speed input](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Encoder.c): `温控智能风扇/Hardware/Encoder.c`
- [Mode input](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Key.c): `温控智能风扇/Hardware/Key.c`
- [Fan motor](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/Motor.c): `温控智能风扇/Hardware/Motor.c`
- [Mode indicators](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/LED.c): `温控智能风扇/Hardware/LED.c`
- [Status display](https://github.com/can-fish/stm32-projects/blob/main/%E6%B8%A9%E6%8E%A7%E6%99%BA%E8%83%BD%E9%A3%8E%E6%89%87/Hardware/OLED.c): `温控智能风扇/Hardware/OLED.c`
- [DHT11 sensing](https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/DHT11/dht11.c): `湿温度检测装置/Hardware/DHT11/dht11.c`
- [Climate display](https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/OLED.c): `湿温度检测装置/Hardware/OLED.c`
- [Buzzer driver](https://github.com/can-fish/stm32-projects/blob/main/%E6%B9%BF%E6%B8%A9%E5%BA%A6%E6%A3%80%E6%B5%8B%E8%A3%85%E7%BD%AE/Hardware/FMQ.c): `湿温度检测装置/Hardware/FMQ.c`

### Other components

- **Car operator**
- **Fan operator**
- **Room occupant**

## Connections

- Car operator → Car control loop: starts
- Car control loop → Line sensors: reads line
- Car control loop → Gyro sensing: reads angle
- Car control loop → Distance sensing: reads distance
- Car control loop → Key input: reads keys
- Car control loop → Drive motors: sets speed
- Car control loop → Second motor: sets speed
- Car control loop → Status display: renders status
- Fan operator → Fan control loop: operates
- Fan control loop → NTC sampling: reads ADC
- Fan control loop → Speed input: reads rotation
- Fan control loop → Mode input: reads keys
- Fan control loop → Fan motor: sets speed
- Fan control loop → Mode indicators: sets indicators
- Fan control loop → Status display: renders status
- Room occupant → Monitor loop: views readings
- Monitor loop → DHT11 sensing: reads climate
- Monitor loop → Climate display: renders readings
- Monitor loop → Buzzer driver: controls alarm
