# yawpremuh/mag-stirr architecture

> Architecture diagram of the GitHub repository yawpremuh/mag-stirr, 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/yawpremuh/mag-stirr
- Repository: https://github.com/yawpremuh/mag-stirr

## Overview

This repository contains Python controls for a 12-zone magnetic stirrer spanning three Arduino boards. The principal workflow maps a requested tube to a board and zone, converts a speed percentage to PWM, and sends a serial command; the separate legacy script also opens the boards and issues zone commands. The README is empty, and the Arduino sketch contents were not sampled, so firmware behavior and links to the sketches cannot be confirmed.

Main entry points: [`Stirrer.py`](https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py) (Stirrer Controller), [`zone_stir.py`](https://github.com/yawpremuh/mag-stirr/blob/main/zone_stir.py) (Legacy Zone Controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_controller["Controller API"]
  node_tube_mapping["Tube Mapping<br/>[Stirrer.py]"]
  node_controller_api["Stirrer Controller<br/>[Stirrer.py]"]
  node_command_encoding["Speed and Commands<br/>[Stirrer.py]"]
end

subgraph group_legacy["Legacy Script"]
  node_legacy_api["Legacy Zone Controls<br/>[zone_stir.py]"]
  node_legacy_run["Individual Zone Run<br/>[zone_stir.py]"]
end

subgraph group_hardware["Hardware Interface"]
  node_serial_boards{{"Arduino Boards"}}
end

node_operator(("Operator"))

node_operator -->|"maps tube"| node_tube_mapping
node_operator -->|"sets zones"| node_controller_api
node_controller_api -->|"uses mapping"| node_tube_mapping
node_controller_api -->|"encodes speed"| node_command_encoding
node_command_encoding -->|"writes serial"| node_serial_boards
node_legacy_run -->|"calls zone setter"| node_legacy_api
node_legacy_api -->|"writes serial"| node_serial_boards
node_operator -->|"runs script"| node_legacy_run

click node_tube_mapping "https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py"
click node_controller_api "https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py"
click node_command_encoding "https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py"
click node_legacy_api "https://github.com/yawpremuh/mag-stirr/blob/main/zone_stir.py"
click node_legacy_run "https://github.com/yawpremuh/mag-stirr/blob/main/zone_stir.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_tube_mapping,node_controller_api,node_command_encoding toneBlue
class node_legacy_api,node_legacy_run toneAmber
class node_serial_boards toneMint
class node_operator toneIndigo
```

## Components

### Controller API

- [Tube Mapping](https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py): `Stirrer.py`
- [Stirrer Controller](https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py): `Stirrer.py`
- [Speed and Commands](https://github.com/yawpremuh/mag-stirr/blob/main/Stirrer.py): `Stirrer.py`

### Legacy Script

- [Legacy Zone Controls](https://github.com/yawpremuh/mag-stirr/blob/main/zone_stir.py): `zone_stir.py`
- [Individual Zone Run](https://github.com/yawpremuh/mag-stirr/blob/main/zone_stir.py): `zone_stir.py`

### Hardware Interface

- **Arduino Boards**

### Other components

- **Operator**

## Connections

- Operator → Tube Mapping: maps tube
- Operator → Stirrer Controller: sets zones
- Stirrer Controller → Tube Mapping: uses mapping
- Stirrer Controller → Speed and Commands: encodes speed
- Speed and Commands → Arduino Boards: writes serial
- Individual Zone Run → Legacy Zone Controls: calls zone setter
- Legacy Zone Controls → Arduino Boards: writes serial
- Operator → Individual Zone Run: runs script
