# siddhesh-04/cnc-plotter architecture

> Architecture diagram of the GitHub repository siddhesh-04/cnc-plotter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/siddhesh-04/cnc-plotter
- Repository: https://github.com/siddhesh-04/cnc-plotter

## Overview

This repository is a small embedded/robotics project centered on a DIY CNC plotter, not a software service. The architecture is split between a firmware-controlled motion system and a set of sample inputs/media used to drive and validate it.

1. **Core runtime: Arduino-based motion controller**
   - The execution environment is an **Arduino UNO** running a **modified GRBL firmware**.
   - GRBL is the central control layer: it interprets G-code, handles axis motion, and coordinates basic machine behaviors like homing and travel limits.

2. **Motion subsystem: 2-axis Cartesian plotter**
   - The machine uses two **28BYJ-48 stepper motors** for **X and Y movement**.
   - Each motor is driven through a **ULN2003 driver board**, with **GT2 belts/pulleys** converting motor rotation into linear carriage motion.

3. **Toolhead subsystem: pen lift**
   - A single **SG90 servo** controls the pen up/down action.
   - This is a separate control concern from XY motion, but still part of the embedded firmware workflow.

4. **Safety and reference subsystem**
   - The hardware includes **two limit switches** for axis homing and travel limits.
   - These switches provide the machine’s physical boundary/reference layer, which GRBL depends on for repeatable positioning.

5. **Power architecture**
   - The plotter is powered from a **12V battery pack** for the steppers, with an **LM2596 buck converter** regulating down to **5V** where needed.
   - This makes power delivery a distinct hardware boundary from the logic/control domain of the Arduino.

6. **Mechanical structure**
   - The frame is built from **MDF/acrylic**, with **steel rods or 3D-printed brackets** as guides/supports.
   - Mechanically, the system is a compact low-cost XY plotter with a lightweight pen holder optimized for simple drawing tasks.

7. **Host-side workflow**
   - Design files are created externally, typically in **Inkscape**, then converted to **G-code** using the **GcodeTools plugin**.
   - A PC-side sender such as **Universal G-Code Sender (UGS)** streams that G-code to the Arduino over serial.

8. **Command/data flow**
   - The practical pipeline is: **vector artwork or drawing → G-code generation → serial transmission via UGS → GRBL on Arduino → driver boards/servo → physical plotting**.
   - This is the main architectural flow to capture in a diagram.

9. **Repository contents as support artifacts**
   - `gcodeSamples/` contains ready-to-run G-code test cases for shapes and drawings.
   - `assets/` contains demo media, a project overview PDF, and wiring-related visuals.
   - These are not runtime components, but they support setup, validation, and presentation.

10. **Firmware packaging**
   - The `Firmware/` directory contains the embedded side of the system, including a `libraries.rar` archive, indicating custom or bundled Arduino dependencies.
   - The README references `grblUpload.ino` as the upload entry point, suggesting the firmware is intended to be flashed directly to the UNO rather than deployed as a multi-service application.

11. **Overall architectural boundary**
   - The project has a clear split between:
     - **Offline authoring/tooling** on a PC,
     - **Embedded control** on the Arduino,
     - **Electromechanical execution** on the plotter hardware.
   - There is no backend database, cloud service, or web layer; the architecture is primarily **embedded control + external G-code generation**.

12. **Best diagram framing**
   - If drawing the architecture, place the **PC tools** on the left, the **serial link** in the middle, and the **Arduino/GRBL + motor/servo/limit-switch hardware** on the right.
   - Treat the sample G-code and demo assets as documentation/validation artifacts, separate from the live control path.

Main entry points: [`Firmware`](https://github.com/siddhesh-04/cnc-plotter/tree/main/Firmware) (GRBL), [`gcodeSamples`](https://github.com/siddhesh-04/cnc-plotter/tree/main/gcodeSamples) (G-code Samples), [`assets`](https://github.com/siddhesh-04/cnc-plotter/tree/main/assets) (Demo Media)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["PC Workflow"]
  node_n1["Inkscape<br/>authoring tool"]
  node_n2["GcodeTools<br/>export plugin"]
  node_n3["UGS Sender<br/>serial sender"]
  node_n4["Serial Link<br/>transport"]
end

subgraph group_g2["Embedded Control"]
  node_n5["Arduino UNO<br/>controller"]
  node_n6["GRBL<br/>motion firmware"]
  node_n7["Firmware Bundle<br/>arduino package"]
end

subgraph group_g3["Plotter Hardware"]
  node_n8["XY Motion<br/>motion stage"]
  node_n9["X Stepper<br/>motor"]
  node_n10["Y Stepper<br/>motor"]
  node_n11["ULN2003 Drivers<br/>motor driver"]
  node_n12["Pen Servo<br/>toolhead"]
  node_n13["Limit Switches<br/>safety sensors"]
  node_n14[("Power Chain<br/>power subsystem")]
  node_n15["Frame<br/>mechanical structure"]
end

subgraph group_g4["Repository Support"]
  node_n16["G-code Samples<br/>test inputs"]
  node_n17["Demo Media<br/>documentation"]
end

node_n1 -->|"artwork"| node_n2
node_n2 -->|"G-code"| node_n3
node_n3 -->|"stream"| node_n4
node_n4 -->|"commands"| node_n5
node_n5 -->|"runs"| node_n6
node_n6 -->|"coordinates"| node_n8
node_n8 -->|"X axis"| node_n9
node_n8 -->|"Y axis"| node_n10
node_n9 -->|"driven by"| node_n11
node_n10 -->|"driven by"| node_n11
node_n6 -->|"tool control"| node_n12
node_n6 -->|"homing"| node_n13
node_n14 -->|"motor power"| node_n11
node_n14 -->|"5V rail"| node_n12
node_n15 -->|"supports"| node_n8
node_n16 -.->|"validate"| node_n3
node_n17 -.->|"documents"| node_n15
node_n7 -->|"packages"| node_n6

click node_n6 "https://github.com/siddhesh-04/cnc-plotter/tree/main/Firmware"
click node_n7 "https://github.com/siddhesh-04/cnc-plotter/tree/main/Firmware"
click node_n16 "https://github.com/siddhesh-04/cnc-plotter/tree/main/gcodeSamples"
click node_n17 "https://github.com/siddhesh-04/cnc-plotter/tree/main/assets"

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_n1,node_n2,node_n3,node_n4 toneBlue
class node_n5,node_n6,node_n7 toneAmber
class node_n8,node_n9,node_n10,node_n11,node_n12,node_n13,node_n14,node_n15 toneMint
class node_n16,node_n17 toneRose
```

## Components

### PC Workflow

Offline design and G-code preparation on the host machine.

- **Inkscape**: authoring tool · External vector design step used to create plotter artwork.
- **GcodeTools**: export plugin · Converts vector artwork into machine-readable G-code.
- **UGS Sender**: serial sender · Streams G-code from a PC to the controller over serial.
- **Serial Link**: transport · USB/serial command path between host and Arduino.

### Embedded Control

Arduino firmware and machine control logic.

- **Arduino UNO**: controller · Microcontroller board running the plotter firmware.
- [GRBL](https://github.com/siddhesh-04/cnc-plotter/tree/main/Firmware): motion firmware · Interprets G-code and coordinates motion, homing, and limits. · `Firmware`
- [Firmware Bundle](https://github.com/siddhesh-04/cnc-plotter/tree/main/Firmware): arduino package · Repository firmware package and bundled Arduino dependencies. · `Firmware`

### Plotter Hardware

Electromechanical motion, tooling, sensing, and power.

- **XY Motion**: motion stage · Two-axis Cartesian carriage movement for plotting.
- **X Stepper**: motor · 28BYJ-48 motor driving the X axis.
- **Y Stepper**: motor · 28BYJ-48 motor driving the Y axis.
- **ULN2003 Drivers**: motor driver · Driver boards that energize the stepper motors.
- **Pen Servo**: toolhead · SG90 servo used to lift and lower the pen.
- **Limit Switches**: safety sensors · Homing and travel-limit reference inputs for GRBL.
- **Power Chain**: power subsystem · 12V battery input and 5V buck regulation for the machine.
- **Frame**: mechanical structure · MDF/acrylic body with rods and brackets supporting motion.

### Repository Support

Sample inputs and media used for validation and presentation.

- [G-code Samples](https://github.com/siddhesh-04/cnc-plotter/tree/main/gcodeSamples): test inputs · Ready-to-run drawing programs used for validation and demos. · `gcodeSamples`
- [Demo Media](https://github.com/siddhesh-04/cnc-plotter/tree/main/assets): documentation · Project overview PDF and prototype video supporting presentation. · `assets`

## Connections

- Inkscape → GcodeTools: artwork · Vector drawings are prepared for machine conversion.
- GcodeTools → UGS Sender: G-code · Plugin output is sent to the serial streaming tool.
- UGS Sender → Serial Link: stream · UGS transmits commands over the serial connection.
- Serial Link → Arduino UNO: commands · The Arduino receives streamed motion commands.
- Arduino UNO → GRBL: runs · The UNO hosts the GRBL firmware runtime.
- GRBL → XY Motion: coordinates · GRBL drives the two-axis plotting stage.
- XY Motion → X Stepper: X axis · The X carriage is actuated by a stepper motor.
- XY Motion → Y Stepper: Y axis · The Y carriage is actuated by a stepper motor.
- X Stepper → ULN2003 Drivers: driven by · Stepper coils are switched through ULN2003 boards.
- Y Stepper → ULN2003 Drivers: driven by · Stepper coils are switched through ULN2003 boards.
- GRBL → Pen Servo: tool control · GRBL/firmware workflow also manages pen up/down motion.
- GRBL → Limit Switches: homing · Limit switches provide boundary and reference inputs.
- Power Chain → ULN2003 Drivers: motor power · The power chain supplies the stepper driver boards.
- Power Chain → Pen Servo: 5V rail · Regulated 5V supply supports servo-level electronics.
- Frame → XY Motion: supports · The frame carries and guides the motion stage.
- G-code Samples → UGS Sender: validate · Sample G-code can be streamed through the sender for testing.
- Demo Media → Frame: documents · Repository media captures the build and machine setup.
- Firmware Bundle → GRBL: packages · Firmware contents support the GRBL-based upload workflow.
