# janithdisanayake/arduino-robot architecture

> Architecture diagram of the GitHub repository janithdisanayake/arduino-robot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/janithdisanayake/arduino-robot
- Repository: https://github.com/janithdisanayake/arduino-robot

## Overview

##### Project type and purpose
- This is an embedded robotics project built around the Arduino platform.
- Purpose: a small mobile robot that can follow a line and avoid obstacles using IR and ultrasonic sensors, driving DC motors via an L298 motor driver.

##### File structure
- Top-level files:
- Project Report.pdf – design and proposal documentation
- README.md – overview, instructions, schematics
- Sketch directories:
- Robot-Line_Following/Robot-Line_Following.ino – line-following prototype
- Robot-Obstacle/Robot-Obstacle.ino – obstacle-avoidance prototype
- myRobot/myRobot.ino – intermediate code
- myRobotX/myRobotX.ino – final integrated code (line following + obstacle avoidance)
- newlineFollower/newlineFollower.ino – alternate line-following code
- readme-essentials folder holds images and docs for schematics

##### README for additional insights
- Lists hardware components (Arduino Uno R3, L298 driver, IR sensors, ultrasonic sensor, servo, batteries, chassis, breadboard).
- Shows wiring schematics and logic flow for both line following and obstacle avoidance.
- Notes that myRobotX is the final combined firmware.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Hardware Components
    subgraph "Hardware Components"
        Battery["Battery Pack"]:::hardware
        Regulator["Voltage Regulator"]:::hardware
        Arduino["MCU: Arduino Uno R3"]:::hardware
        IRSensor["IR Sensor Array"]:::hardware
        USensor["Ultrasonic Sensor"]:::hardware
        L298["L298 Motor Driver"]:::hardware
        Motors["DC Motors & Wheels"]:::hardware
        Servo["Servo Motor (Pan/Tilt)"]:::hardware
        Breadboard["Breadboard"]:::hardware
    end

    %% Firmware Modules inside MCU
    subgraph "Firmware Modules inside MCU"
        LineFollow["Line-Following Logic"]:::firmware
        Obstacle["Obstacle-Avoidance Logic"]:::firmware
        Motion["Motion Control"]:::firmware
    end

    %% Project Files and Documentation
    subgraph "Project Files and Documentation"
        RepoReadme["README.md"]:::doc
        Report["Project Report.pdf"]:::doc
        Schematics["Supporting Schematics & Images"]:::doc
        RFirmware1["Line-Following Prototype Firmware"]:::doc
        RFirmware2["Alternate Line-Follower Implementation"]:::doc
        RFirmware3["Obstacle-Avoidance Prototype Firmware"]:::doc
        RFirmware4["Intermediate Combined Firmware"]:::doc
        RFirmware5["Final Integrated Firmware"]:::doc
    end

    %% Power and Data Flows
    Battery --> Regulator
    Regulator --> Arduino
    Regulator --> L298
    Breadboard --> IRSensor
    Breadboard --> USensor
    IRSensor --> Arduino
    USensor --> Arduino
    Arduino --> LineFollow
    Arduino --> Obstacle
    Arduino --> Motion
    LineFollow --> L298
    Obstacle --> L298
    Motion --> L298
    L298 --> Motors
    Arduino --> Servo

    %% Click Events
    click RFirmware1 "https://github.com/janithdisanayake/arduino-robot/blob/main/Robot-Line_Following/Robot-Line_Following.ino"
    click RFirmware2 "https://github.com/janithdisanayake/arduino-robot/blob/main/newlineFollower/newlineFollower.ino"
    click RFirmware3 "https://github.com/janithdisanayake/arduino-robot/blob/main/Robot-Obstacle/Robot-Obstacle.ino"
    click RFirmware4 "https://github.com/janithdisanayake/arduino-robot/blob/main/myRobot/myRobot.ino"
    click RFirmware5 "https://github.com/janithdisanayake/arduino-robot/blob/main/myRobotX/myRobotX.ino"
    click Report "https://github.com/janithdisanayake/arduino-robot/blob/main/Project Report.pdf"
    click RepoReadme "https://github.com/janithdisanayake/arduino-robot/blob/main/README.md"
    click Schematics "https://github.com/janithdisanayake/arduino-robot/tree/main/readme-essentials/"

    %% Styles
    classDef hardware fill:#a2fca2,stroke:#333,stroke-width:1px;
    classDef firmware fill:#a2c2f7,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef doc fill:#f7f7a2,stroke:#333,stroke-width:1px;
```
