# ojasp21/micromouse architecture

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

- Interactive diagram: https://gitdiagram.com/ojasp21/micromouse
- Repository: https://github.com/ojasp21/micromouse

## Overview

This repository combines micromouse firmware experiments with two maze-solver simulations and a VL53L0X time-of-flight sensor component. The clearest user-to-result workflow is a simulation entry point querying walls, choosing a move, and issuing movement or turn commands to the simulator; floodfill follows a precomputed value gradient, while the separate left-wall follower uses a wall-following rule. The ToF firmware initializes the sensor and repeatedly reports range measurements. The README also describes PID testing and hardware design, but the tree does not show an integrated robot-control workflow. Several sensor-layer links are omitted because their callers were not excerpted.

Main entry points: [`firmware/tof_sensor/components/vl53l0x.c`](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/vl53l0x.c) (VL53L0X driver), [`firmware/tof_sensor/main/main.c`](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/main/main.c) (Range measurement app), [`firmware/simulation/floodfill/API.c`](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/floodfill/API.c) (Simulator API), [`firmware/simulation/left_follow_rule/API.c`](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/left_follow_rule/API.c) (Simulator API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Maze simulations"]
  node_floodfill["Floodfill solver<br/>[Main.c]"]
  node_flood_api["Simulator API<br/>[API.c]"]
  node_left_follow["Left-wall follower<br/>[Main.c]"]
  node_left_api["Simulator API<br/>[API.c]"]
end

subgraph group_sensing["Sensor firmware"]
  node_ir_analog["Analog IR test<br/>[main.c]"]
  node_ir_digital["Digital IR test<br/>[main.c]"]
end

subgraph group_control["Control experiments"]
  node_pid_app["PID firmware<br/>[main.c]"]
  node_pid_tuning["PID tuning code<br/>[c.cpp]"]
end

subgraph group_tof["ToF component"]
  node_tof_app["Range measurement app<br/>[main.c]"]
  node_tof_driver["VL53L0X driver<br/>[vl53l0x.c]"]
  node_tof_api["VL53L0X API<br/>[vl53l0x_api.c]"]
  node_tof_platform["I2C platform layer"]
end

node_maze_simulator(("Maze simulator"))
node_tof_sensor{{"VL53L0X sensor"}}
node_range_output["Range log output"]

node_floodfill -->|"queries and commands"| node_flood_api
node_flood_api -.->|"forwards API calls"| node_maze_simulator
node_left_follow -->|"queries and commands"| node_left_api
node_left_api -.->|"forwards API calls"| node_maze_simulator
node_tof_app -->|"initializes and reads"| node_tof_driver
node_tof_driver -->|"calls ranging API"| node_tof_api
node_tof_api -.->|"uses register access"| node_tof_platform
node_tof_sensor -.->|"provides measurements"| node_tof_driver
node_tof_app -->|"logs measurements"| node_range_output

click node_floodfill "https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/floodfill/Main.c"
click node_flood_api "https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/floodfill/API.c"
click node_left_follow "https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/left_follow_rule/Main.c"
click node_left_api "https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/left_follow_rule/API.c"
click node_ir_analog "https://github.com/ojasp21/micromouse/blob/main/firmware/ir_sensor/IR_ANALOG/main/main.c"
click node_ir_digital "https://github.com/ojasp21/micromouse/blob/main/firmware/ir_sensor/IR_DIGITAL/main/main.c"
click node_pid_app "https://github.com/ojasp21/micromouse/blob/main/firmware/pid_tuning/main/main.c"
click node_pid_tuning "https://github.com/ojasp21/micromouse/blob/main/firmware/pid_tuning/c.cpp"
click node_tof_app "https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/main/main.c"
click node_tof_driver "https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/vl53l0x.c"
click node_tof_api "https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/Api/core/src/vl53l0x_api.c"
click node_tof_platform "https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/Api/platform/src/vl53l0x_i2c_platform.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_floodfill,node_flood_api,node_left_follow,node_left_api toneBlue
class node_ir_analog,node_ir_digital toneAmber
class node_pid_app,node_pid_tuning toneMint
class node_tof_app,node_tof_driver,node_tof_api,node_tof_platform toneRose
class node_maze_simulator,node_tof_sensor,node_range_output toneIndigo
```

## Components

### Maze simulations

- [Floodfill solver](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/floodfill/Main.c): `firmware/simulation/floodfill/Main.c`
- [Simulator API](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/floodfill/API.c): `firmware/simulation/floodfill/API.c`
- [Left-wall follower](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/left_follow_rule/Main.c): `firmware/simulation/left_follow_rule/Main.c`
- [Simulator API](https://github.com/ojasp21/micromouse/blob/main/firmware/simulation/left_follow_rule/API.c): `firmware/simulation/left_follow_rule/API.c`

### Sensor firmware

- [Analog IR test](https://github.com/ojasp21/micromouse/blob/main/firmware/ir_sensor/IR_ANALOG/main/main.c): `firmware/ir_sensor/IR_ANALOG/main/main.c`
- [Digital IR test](https://github.com/ojasp21/micromouse/blob/main/firmware/ir_sensor/IR_DIGITAL/main/main.c): `firmware/ir_sensor/IR_DIGITAL/main/main.c`

### Control experiments

- [PID firmware](https://github.com/ojasp21/micromouse/blob/main/firmware/pid_tuning/main/main.c): `firmware/pid_tuning/main/main.c`
- [PID tuning code](https://github.com/ojasp21/micromouse/blob/main/firmware/pid_tuning/c.cpp): `firmware/pid_tuning/c.cpp`

### ToF component

- [Range measurement app](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/main/main.c): `firmware/tof_sensor/main/main.c`
- [VL53L0X driver](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/vl53l0x.c): `firmware/tof_sensor/components/vl53l0x.c`
- [VL53L0X API](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/Api/core/src/vl53l0x_api.c): `firmware/tof_sensor/components/Api/core/src/vl53l0x_api.c`
- [I2C platform layer](https://github.com/ojasp21/micromouse/blob/main/firmware/tof_sensor/components/Api/platform/src/vl53l0x_i2c_platform.c): `firmware/tof_sensor/components/Api/platform/src/vl53l0x_i2c_platform.c`

### Other components

- **Maze simulator**
- **VL53L0X sensor**
- **Range log output**

## Connections

- Floodfill solver → Simulator API: queries and commands (evidence: `firmware/simulation/floodfill/Main.c`)
- Simulator API → Maze simulator: forwards API calls
- Left-wall follower → Simulator API: queries and commands (evidence: `firmware/simulation/left_follow_rule/Main.c`)
- Simulator API → Maze simulator: forwards API calls
- Range measurement app → VL53L0X driver: initializes and reads (evidence: `firmware/tof_sensor/main/main.c`)
- VL53L0X driver → VL53L0X API: calls ranging API (evidence: `firmware/tof_sensor/components/vl53l0x.c`)
- VL53L0X API → I2C platform layer: uses register access
- VL53L0X sensor → VL53L0X driver: provides measurements
- Range measurement app → Range log output: logs measurements (evidence: `firmware/tof_sensor/main/main.c`)
