# shreekamesh/servo-calibrator architecture

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

- Interactive diagram: https://gitdiagram.com/shreekamesh/servo-calibrator
- Repository: https://github.com/shreekamesh/servo-calibrator

## Overview

Servo-Calibrator provides a browser interface for controlling and calibrating a multi-servo Arduino robot, with a Python HTTP server bridging browser requests to USB serial and firmware. The documented workflow is connect, adjust servo angles or poses, and save settings. The excerpts show browser-to-server routes and firmware command handling, but do not show the sketch wiring or the Python-to-firmware command translation in compatible terms; those links are left unverified. Additional interface capabilities include pose editing, tuning, action-code generation and settings management.

Main entry points: [`index.html`](https://github.com/shreekamesh/servo-calibrator/blob/main/index.html) (Web page), [`Robot.cpp`](https://github.com/shreekamesh/servo-calibrator/blob/main/Robot.cpp) (Robot behavior), [`SerialProtocol.cpp`](https://github.com/shreekamesh/servo-calibrator/blob/main/SerialProtocol.cpp) (Command protocol), [`ServoManager.cpp`](https://github.com/shreekamesh/servo-calibrator/blob/main/ServoManager.cpp) (Servo control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Browser interface"]
  node_ui["Control and editor UI<br/>[script.js]"]
  node_page["Web page<br/>[index.html]"]
  node_styles["Interface styling<br/>[style.css]"]
end

subgraph group_server["Python server"]
  node_http["HTTP API<br/>[web_server.py]"]
  node_serial["Serial link<br/>[web_server.py]"]
end

subgraph group_firmware["Arduino firmware"]
  node_sketch["Firmware entry"]
  node_protocol["Command protocol<br/>[SerialProtocol.cpp]"]
  node_robot["Robot behavior<br/>[Robot.cpp]"]
  node_settings["Calibration settings<br/>[RobotSettings.cpp]"]
  node_servo["Servo control<br/>[ServoManager.cpp]"]
  node_config["Hardware configuration<br/>[Config.h]"]
  node_eeprom[("EEPROM storage")]
end

subgraph group_hardware["Servo hardware"]
  node_pwm["PWM servo driver"]
  node_arduino["Arduino board"]
  node_servos["Servo motors"]
end

node_operator(("Robot operator"))

node_operator -->|"opens"| node_page
node_page -.->|"loads"| node_ui
node_ui -->|"calls API"| node_http
node_http -->|"sends commands"| node_serial
node_serial -.->|"forwards commands"| node_protocol
node_sketch -.->|"updates"| node_protocol
node_protocol -->|"dispatches commands"| node_robot
node_robot -->|"sets angles"| node_servo
node_robot -->|"loads and saves"| node_settings
node_settings -->|"reads and writes"| node_eeprom
node_servo -->|"sets pulses"| node_pwm
node_config -->|"configures"| node_servo
node_arduino -.->|"drives"| node_pwm
node_pwm -.->|"controls"| node_servos
node_page -.->|"uses"| node_styles

click node_ui "https://github.com/shreekamesh/servo-calibrator/blob/main/script.js"
click node_page "https://github.com/shreekamesh/servo-calibrator/blob/main/index.html"
click node_styles "https://github.com/shreekamesh/servo-calibrator/blob/main/style.css"
click node_http "https://github.com/shreekamesh/servo-calibrator/blob/main/web_server.py"
click node_serial "https://github.com/shreekamesh/servo-calibrator/blob/main/web_server.py"
click node_sketch "https://github.com/shreekamesh/servo-calibrator/blob/main/ServoCalibrator.ino"
click node_protocol "https://github.com/shreekamesh/servo-calibrator/blob/main/SerialProtocol.cpp"
click node_robot "https://github.com/shreekamesh/servo-calibrator/blob/main/Robot.cpp"
click node_settings "https://github.com/shreekamesh/servo-calibrator/blob/main/RobotSettings.cpp"
click node_servo "https://github.com/shreekamesh/servo-calibrator/blob/main/ServoManager.cpp"
click node_config "https://github.com/shreekamesh/servo-calibrator/blob/main/Config.h"

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_ui,node_page,node_styles toneBlue
class node_http,node_serial toneAmber
class node_sketch,node_protocol,node_robot,node_settings,node_servo,node_config,node_eeprom toneMint
class node_pwm,node_arduino,node_servos toneRose
class node_operator toneIndigo
```

## Components

### Browser interface

- [Control and editor UI](https://github.com/shreekamesh/servo-calibrator/blob/main/script.js): `script.js`
- [Web page](https://github.com/shreekamesh/servo-calibrator/blob/main/index.html): `index.html`
- [Interface styling](https://github.com/shreekamesh/servo-calibrator/blob/main/style.css): `style.css`

### Python server

- [HTTP API](https://github.com/shreekamesh/servo-calibrator/blob/main/web_server.py): `web_server.py`
- [Serial link](https://github.com/shreekamesh/servo-calibrator/blob/main/web_server.py): `web_server.py`

### Arduino firmware

- [Firmware entry](https://github.com/shreekamesh/servo-calibrator/blob/main/ServoCalibrator.ino): `ServoCalibrator.ino`
- [Command protocol](https://github.com/shreekamesh/servo-calibrator/blob/main/SerialProtocol.cpp): `SerialProtocol.cpp`
- [Robot behavior](https://github.com/shreekamesh/servo-calibrator/blob/main/Robot.cpp): `Robot.cpp`
- [Calibration settings](https://github.com/shreekamesh/servo-calibrator/blob/main/RobotSettings.cpp): `RobotSettings.cpp`
- [Servo control](https://github.com/shreekamesh/servo-calibrator/blob/main/ServoManager.cpp): `ServoManager.cpp`
- [Hardware configuration](https://github.com/shreekamesh/servo-calibrator/blob/main/Config.h): `Config.h`
- **EEPROM storage**

### Servo hardware

- **PWM servo driver**
- **Arduino board**
- **Servo motors**

### Other components

- **Robot operator**

## Connections

- Robot operator → Web page: opens (evidence: `README.md`)
- Web page → Control and editor UI: loads
- Control and editor UI → HTTP API: calls API (evidence: `script.js`)
- HTTP API → Serial link: sends commands (evidence: `web_server.py`)
- Serial link → Command protocol: forwards commands
- Firmware entry → Command protocol: updates
- Command protocol → Robot behavior: dispatches commands (evidence: `SerialProtocol.cpp`)
- Robot behavior → Servo control: sets angles (evidence: `Robot.cpp`)
- Robot behavior → Calibration settings: loads and saves (evidence: `Robot.cpp`)
- Calibration settings → EEPROM storage: reads and writes (evidence: `RobotSettings.cpp`)
- Servo control → PWM servo driver: sets pulses (evidence: `ServoManager.cpp`)
- Hardware configuration → Servo control: configures (evidence: `ServoManager.cpp`)
- Arduino board → PWM servo driver: drives
- PWM servo driver → Servo motors: controls
- Web page → Interface styling: uses
