# 0x23/micromanipulatorstepper architecture

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

- Interactive diagram: https://gitdiagram.com/0x23/micromanipulatorstepper
- Repository: https://github.com/0x23/micromanipulatorstepper

## Overview

Open Micro-Manipulator is a USB-serial-controlled XYZ micro-manipulator. Its principal workflow is a host sending G-code through the Python API; firmware parses commands, plans motion, evaluates joint-space trajectories, and drives closed-loop actuators. Homing, joint calibration, and timed tool outputs are additional device capabilities. The tree and README establish these product areas, while sampled source confirms parser dispatch, firmware update-loop calls, trajectory evaluation, servo feedback, and homing behavior. Robot orchestration and several subsystems are unsampled, so their internal wiring is shown only where documented, not inferred in detail.

Main entry points: [`firmware/MotionControllerRP/src/robot.cpp`](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot.cpp) (Robot Orchestrator), [`firmware/MotionControllerRP/src/motion_control/motion_controller.cpp`](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/motion_controller.cpp) (Motion Controller), [`firmware/MotionControllerRP/src/servo_control/servo_controller.cpp`](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/servo_controller.cpp) (Servo Controller), [`software/PythonAPI/open_micro_stage_api.py`](https://github.com/0x23/micromanipulatorstepper/blob/main/software/PythonAPI/open_micro_stage_api.py) (Python API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Host Interface"]
  node_api["Python API"]
  node_firmware["Firmware Runtime<br/>[main.cpp]"]
  node_parser["G-code Parser<br/>[command_parser.cpp]"]
end

subgraph group_planning["Motion Planning"]
  node_robot["Robot Orchestrator<br/>[robot.cpp]"]
  node_kinematics["Delta Kinematics"]
  node_planner["Path Planner<br/>[path_planner.cpp]"]
  node_segments["Path Segments<br/>[path_segment.cpp]"]
  node_motion["Motion Controller"]
end

subgraph group_actuation["Actuation"]
  node_joint["Robot Joint<br/>[robot_joint.cpp]"]
  node_servo["Servo Controller"]
  node_homing["Homing Controller"]
  node_calibration["Actuator Calibration"]
  node_encoder["Magnetic Encoder<br/>[MT6835_encoder.cpp]"]
  node_motor["Motor Driver"]
  node_tool["PWM Tool<br/>[pwm_tool.cpp]"]
end

subgraph group_analysis["Magnetic Analysis"]
  node_simulator["Field Simulator"]
  node_magnetics["Magnetic Field Model"]
  node_plotter["Calibration Plotter"]
end

node_operator(("Host Application"))
node_usb(("USB Serial"))

node_operator -->|"calls controls"| node_api
node_api -->|"sends commands"| node_usb
node_usb -->|"delivers serial"| node_firmware
node_firmware -->|"updates parser and planner"| node_robot
node_robot -->|"updates commands"| node_parser
node_parser -->|"dispatches commands"| node_robot
node_robot -->|"converts coordinates"| node_kinematics
node_robot -->|"submits paths"| node_planner
node_robot -->|"updates trajectories"| node_motion
node_motion -->|"pops joint segments"| node_planner
node_motion -->|"evaluates segment"| node_segments
node_robot -->|"commands joints"| node_joint
node_joint -->|"controls actuator"| node_servo
node_servo -->|"reads position"| node_encoder
node_servo -->|"sets field angle"| node_motor
node_robot -->|"runs homing"| node_homing
node_robot -->|"calibrates joints"| node_calibration
node_robot -->|"sets tool outputs"| node_tool
node_simulator -->|"computes field"| node_magnetics
node_plotter -.->|"plots calibration data"| node_api

click node_api "https://github.com/0x23/micromanipulatorstepper/blob/main/software/PythonAPI/open_micro_stage_api.py"
click node_firmware "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/main.cpp"
click node_parser "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/command_parser/command_parser.cpp"
click node_robot "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot.cpp"
click node_kinematics "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/kinematic_models/kinematic_model_delta3d.cpp"
click node_planner "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/path_planner.cpp"
click node_segments "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/path_segment.cpp"
click node_motion "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/motion_controller.cpp"
click node_joint "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot_joint/robot_joint.cpp"
click node_servo "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/servo_controller.cpp"
click node_homing "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/homing_controller.cpp"
click node_calibration "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/actuator_calibration.cpp"
click node_encoder "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/hardware/MT6835_encoder.cpp"
click node_motor "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/hardware/TB6612_motor_driver.cpp"
click node_tool "https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot_tool/pwm_tool.cpp"
click node_simulator "https://github.com/0x23/micromanipulatorstepper/blob/main/software/EncoderMagneticFieldSim/magnetic_field_sim.py"
click node_plotter "https://github.com/0x23/micromanipulatorstepper/blob/main/software/PythonAPI/calibration_plotter.py"

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_api,node_firmware,node_parser toneBlue
class node_robot,node_kinematics,node_planner,node_segments,node_motion toneAmber
class node_joint,node_servo,node_homing,node_calibration,node_encoder,node_motor,node_tool toneMint
class node_simulator,node_magnetics,node_plotter toneRose
class node_operator,node_usb toneIndigo
```

## Components

### Host Interface

- [Python API](https://github.com/0x23/micromanipulatorstepper/blob/main/software/PythonAPI/open_micro_stage_api.py): `software/PythonAPI/open_micro_stage_api.py`
- [Firmware Runtime](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/main.cpp): `firmware/MotionControllerRP/src/main.cpp`
- [G-code Parser](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/command_parser/command_parser.cpp): `firmware/MotionControllerRP/src/command_parser/command_parser.cpp`

### Motion Planning

- [Robot Orchestrator](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot.cpp): `firmware/MotionControllerRP/src/robot.cpp`
- [Delta Kinematics](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/kinematic_models/kinematic_model_delta3d.cpp): `firmware/MotionControllerRP/src/kinematic_models/kinematic_model_delta3d.cpp`
- [Path Planner](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/path_planner.cpp): `firmware/MotionControllerRP/src/motion_control/path_planner.cpp`
- [Path Segments](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/path_segment.cpp): `firmware/MotionControllerRP/src/motion_control/path_segment.cpp`
- [Motion Controller](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/motion_control/motion_controller.cpp): `firmware/MotionControllerRP/src/motion_control/motion_controller.cpp`

### Actuation

- [Robot Joint](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot_joint/robot_joint.cpp): `firmware/MotionControllerRP/src/robot_joint/robot_joint.cpp`
- [Servo Controller](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/servo_controller.cpp): `firmware/MotionControllerRP/src/servo_control/servo_controller.cpp`
- [Homing Controller](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/homing_controller.cpp): `firmware/MotionControllerRP/src/servo_control/homing_controller.cpp`
- [Actuator Calibration](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/servo_control/actuator_calibration.cpp): `firmware/MotionControllerRP/src/servo_control/actuator_calibration.cpp`
- [Magnetic Encoder](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/hardware/MT6835_encoder.cpp): `firmware/MotionControllerRP/src/hardware/MT6835_encoder.cpp`
- [Motor Driver](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/hardware/TB6612_motor_driver.cpp): `firmware/MotionControllerRP/src/hardware/TB6612_motor_driver.cpp`
- [PWM Tool](https://github.com/0x23/micromanipulatorstepper/blob/main/firmware/MotionControllerRP/src/robot_tool/pwm_tool.cpp): `firmware/MotionControllerRP/src/robot_tool/pwm_tool.cpp`

### Magnetic Analysis

- [Field Simulator](https://github.com/0x23/micromanipulatorstepper/blob/main/software/EncoderMagneticFieldSim/magnetic_field_sim.py): `software/EncoderMagneticFieldSim/magnetic_field_sim.py`
- **Magnetic Field Model**
- [Calibration Plotter](https://github.com/0x23/micromanipulatorstepper/blob/main/software/PythonAPI/calibration_plotter.py): `software/PythonAPI/calibration_plotter.py`

### Other components

- **Host Application**
- **USB Serial**

## Connections

- Host Application → Python API: calls controls
- Python API → USB Serial: sends commands
- USB Serial → Firmware Runtime: delivers serial
- Firmware Runtime → Robot Orchestrator: updates parser and planner
- Robot Orchestrator → G-code Parser: updates commands
- G-code Parser → Robot Orchestrator: dispatches commands
- Robot Orchestrator → Delta Kinematics: converts coordinates
- Robot Orchestrator → Path Planner: submits paths
- Robot Orchestrator → Motion Controller: updates trajectories
- Motion Controller → Path Planner: pops joint segments
- Motion Controller → Path Segments: evaluates segment
- Robot Orchestrator → Robot Joint: commands joints
- Robot Joint → Servo Controller: controls actuator
- Servo Controller → Magnetic Encoder: reads position
- Servo Controller → Motor Driver: sets field angle
- Robot Orchestrator → Homing Controller: runs homing
- Robot Orchestrator → Actuator Calibration: calibrates joints
- Robot Orchestrator → PWM Tool: sets tool outputs
- Field Simulator → Magnetic Field Model: computes field
- Calibration Plotter → Python API: plots calibration data
