{"id":48832266,"url":"https://github.com/1999azzar/6dof_arm","last_synced_at":"2026-04-14T21:01:49.199Z","repository":{"id":345727827,"uuid":"1111576151","full_name":"1999AZZAR/6DoF_arm","owner":"1999AZZAR","description":"A complete Arduino-based 6DOF robot arm control system with Python Qt6 GUI interface for easy control and monitoring.","archived":false,"fork":false,"pushed_at":"2026-03-20T11:12:48.000Z","size":12966,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-21T03:28:40.736Z","etag":null,"topics":["arduino","arm-robot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1999AZZAR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-07T08:10:02.000Z","updated_at":"2026-03-20T11:12:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/1999AZZAR/6DoF_arm","commit_stats":null,"previous_names":["1999azzar/6dof_arm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/1999AZZAR/6DoF_arm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2F6DoF_arm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2F6DoF_arm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2F6DoF_arm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2F6DoF_arm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1999AZZAR","download_url":"https://codeload.github.com/1999AZZAR/6DoF_arm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1999AZZAR%2F6DoF_arm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31815080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T18:05:02.291Z","status":"ssl_error","status_checked_at":"2026-04-14T18:05:01.765Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arm-robot"],"created_at":"2026-04-14T21:01:48.035Z","updated_at":"2026-04-14T21:01:49.183Z","avatar_url":"https://github.com/1999AZZAR.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 6DOF Robot Arm Control System\n\nA complete Arduino-based 6DOF robot arm control system with Python Qt6 GUI interface and ESP32 WiFi bridge REST API for network-based control.\n\n**[Try the Interactive Demo](https://wokwi.com/projects/449667336179085313)** - Experience it online first!\n\n## Table of Contents\n\n- [Interactive Demo](#interactive-demo)\n- [Features](#features)\n- [Hardware Requirements](#hardware-requirements)\n- [Software Requirements](#software-requirements)\n- [Installation](#installation)\n- [Project Structure](#project-structure)\n- [Usage](#usage)\n  - [Arduino Code](#arduino-code)\n  - [Python GUI](#python-gui)\n- [Serial Protocol](#serial-protocol)\n  - [Commands (Python to Arduino)](#commands-python--arduino)\n  - [Responses (Arduino to Python)](#responses-arduino--python)\n- [Safety Features](#safety-features)\n- [Sequence Management](#sequence-management)\n- [Customization](#customization)\n  - [Joint Limits](#joint-limits)\n  - [Movement Speed](#movement-speed)\n  - [Preset Positions](#preset-positions)\n- [Keyboard Shortcuts](#keyboard-shortcuts)\n- [ESP32 WiFi Bridge](#esp32-wifi-bridge)\n  - [Bridge Setup](#bridge-setup)\n  - [Wiring](#wiring)\n  - [REST API Reference](#rest-api-reference)\n- [Troubleshooting](#troubleshooting)\n  - [Connection Issues](#connection-issues)\n  - [Movement Issues](#movement-issues)\n  - [GUI Issues](#gui-issues)\n- [Development](#development)\n  - [Adding New Features](#adding-new-features)\n  - [Code Structure](#code-structure)\n- [License](#license)\n- [Contributing](#contributing)\n- [Support](#support)\n\n## Features\n\n- **Serial Communication**: Text-based protocol at 115200 baud\n- **Real-time Control**: Live joint position control with debounced sliders\n- **Joint Limit Validation**: All commands checked against mechanical limits before execution\n- **Safety Features**: Emergency stop (keyboard shortcut), movement validation\n- **Preset Positions**: Home, Min, Max, Wave\n- **Sequence Management**: Record, play, delete, save/load to file\n- **Auto-reconnect**: GUI detects USB disconnection and reconnects automatically\n- **Keyboard Shortcuts**: Esc for emergency stop, Ctrl+H for home, Ctrl+R for recording\n- **ESP32 WiFi Bridge**: REST API over HTTP for network-based control, mDNS discovery, optional API key authentication, CORS-enabled\n- **Optimized Codebase**: Servo array architecture, char buffer serial input, compatible with Arduino Uno and Mega\n\n## System Architecture\n\n![System Architecture Flowchart](assets/render.png)\n*Complete system architecture showing all components and data flows*\n\n### Hardware Assembly\n![Robot Arm Assembly](assets/arm_assambler.jpg)\n*Complete 6DOF robot arm assembly showing servo motor connections and mechanical structure*\n\n### Component Layout\n![Robot Arm Components](assets/arm_component.jpg)\n*Detailed view of robot arm components and joint configurations*\n\n## Hardware Requirements\n\n- **Arduino Uno** or **Arduino Mega** (recommended)\n- 6DOF Robot Arm with servo motors\n- USB cable for serial communication\n- Servo motors connected to pins 4, 5, 6, 7, 8, 9\n\n## Software Requirements\n\n- Arduino IDE (for uploading code to Arduino)\n- Python 3.8+\n- PyQt6\n- pyserial\n\n## Installation\n\n1. **Arduino Setup**:\n   ```bash\n   # For Arduino Uno:\n   arduino-cli compile --fqbn arduino:avr:uno --build-path ../build_uno .\n   arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:uno .\n\n   # For Arduino Mega:\n   arduino-cli compile --fqbn arduino:avr:mega --build-path ../build_mega .\n   arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega .\n   ```\n\n2. **Python Dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## Interactive Demo\n\n**Try it online first!** - No hardware required\n\nExperience the 6DOF Robot Arm in your browser:\n- [**Wokwi Online Simulator**](https://wokwi.com/projects/449667336179085313)\n- Test all commands in real-time\n- See servo movements visually\n- Suitable for learning and testing\n\nThe system consists of layered architecture for reliable control:\n\n**User Interface Layer** -\u003e **Communication Layer** -\u003e **Control Layer** -\u003e **Hardware Layer**\n\nFor detailed system flow and component interactions, see the [complete system flowchart](assets/flowchart.mermaid).\n\n## Project Structure\n\n```\n6DoF_arm/\n├── .git/\n├── .gitignore\n├── code/                        # Arduino controller\n│   ├── code.ino                 # Main Arduino sketch\n│   └── config.h                 # Configuration (pins, limits, commands)\n├── bridge/                      # ESP32 WiFi bridge\n│   ├── bridge.ino               # REST API gateway\n│   ├── config.h                 # Bridge configuration\n│   └── secrets.h.example        # WiFi credentials template\n├── arm_control_gui.py           # Python Qt6 GUI\n├── requirements.txt             # Python dependencies\n├── assets/\n│   ├── flowchart.mermaid\n│   ├── render.png\n│   ├── gui.png\n│   ├── arm_assambler.jpg\n│   └── arm_component.jpg\n├── LICENSE\n└── README.md\n```\n\n## Usage\n\n### Arduino Code\n\nThe Arduino code (`code/code.ino` and `code/config.h`) provides:\n\n- Serial communication at 115200 baud with char buffer input (no heap fragmentation)\n- Joint control with limit validation against `JOINT_MIN[]` / `JOINT_MAX[]`\n- Servo array architecture (no duplicated switch-case blocks)\n- Emergency stop functionality\n- Real-time position feedback\n- Portable serial reading in `loop()` (works on all boards)\n\n**Joint Pin Mapping**:\n- Joint 1 (Base): Pin 9, range 0-180 degrees\n- Joint 2 (Shoulder): Pin 8, range 30-150 degrees\n- Joint 3 (Elbow): Pin 7, range 0-180 degrees\n- Joint 4 (Wrist Rotation): Pin 6, range 0-180 degrees\n- Joint 5 (Wrist Bend): Pin 5, range 0-180 degrees\n- Joint 6 (Gripper): Pin 4, range 90-180 degrees\n\n### Python GUI\n\nRun the GUI application:\n\n```bash\npython arm_control_gui.py\n```\n\n![GUI Interface](assets/gui.png)\n*Python Qt6 GUI interface showing joint controls, preset positions, and status monitoring*\n\n**GUI Features**:\n\n1. **Connection Panel**:\n   - Select serial port from dropdown\n   - Connect/Disconnect button\n   - Scan button to refresh available ports\n   - Auto-reconnect on USB disconnection\n\n2. **Joint Control**:\n   - 6 sliders for individual joint control (J1-J6)\n   - Real-time position display with min/max labels\n   - Joint limits enforced automatically\n   - Debounced slider commands (80ms) to prevent serial flooding\n\n3. **Speed Control**:\n   - Movement Speed: Configurable 5-200ms delay between steps\n   - Real-time Adjustment: Change speed without restarting Arduino\n   - Default: 15ms (optimized for smooth and fast movement)\n\n4. **Preset Positions**:\n   - Home: Default safe position\n   - Min: Move all joints to minimum positions\n   - Max: Move all joints to maximum positions\n   - Wave: Friendly wave gesture (raises arm and waves left-right)\n\n5. **Safety Controls**:\n   - Emergency Stop: Immediately halts all movement (also via Esc key)\n   - Get Status: Requests current position from Arduino\n\n6. **Status Display**:\n   - Real-time communication log (capped at 200 lines, oldest removed first)\n   - Error messages and feedback\n\n## Serial Protocol\n\n### Commands (Python to Arduino)\n\n```\nJ1:90        - Set joint 1 to 90 degrees (validated against limits)\nJ2:45        - Set joint 2 to 45 degrees\nHOME         - Move to home position\nMIN          - Move all joints to minimum positions\nMAX          - Move all joints to maximum positions\nWAVE         - Perform friendly wave gesture\nSET_SPEED:15 - Set movement speed to 15ms (5-200ms range)\nSTOP         - Emergency stop\nSTATUS       - Request current positions\n```\n\n### Responses (Arduino to Python)\n\n```\nOK:J1:90,J2:45,J3:0,J4:108,J5:80,J6:152    - Current positions\nERROR:Joint 2 range is 30-150                  - Limit violation\nERROR:Unknown command: XYZ                     - Command error\nSEQUENCE:                                      - Sequence list header\n0:MySequence                                   - Sequence entry\n```\n\n## Prebuilt Command Testing\n\n### Basic Movement Commands\n\n**Individual Joint Control:**\n```bash\nJ1:90      # Move base to 90 degrees\nJ2:45      # Move shoulder to 45 degrees\nJ3:60      # Move elbow to 60 degrees\nJ4:120     # Move wrist rotation to 120 degrees\nJ5:80      # Move wrist bend to 80 degrees\nJ6:150     # Move gripper to 150 degrees\nSTATUS     # Check current positions\n```\n\n**Position Commands:**\n```bash\nHOME       # Move to home position (92,85,45,108,80,152)\nSTATUS     # Verify home position\nMIN        # Move to minimum positions (0,30,0,0,0,90)\nSTATUS     # Verify minimum positions\nMAX        # Move to maximum positions (180,150,180,180,180,180)\nSTATUS     # Verify maximum positions\nWAVE       # Perform friendly wave gesture\nSTATUS     # Verify position after wave\nSTOP       # Emergency stop (if needed)\n```\n\n**Speed Control:**\n```bash\nSET_SPEED:15   # Set fast/smooth movement (15ms delay)\nSET_SPEED:50   # Set normal movement (50ms delay)\nSET_SPEED:100  # Set slow/precise movement (100ms delay)\nSET_SPEED:3    # Error: below minimum (5ms)\nSET_SPEED:250  # Error: above maximum (200ms)\n```\n\n### Joint Limits Testing\n\n**Valid Ranges:**\n```bash\nJ1:0       # Base minimum\nJ1:180     # Base maximum\nJ2:30      # Shoulder minimum (mechanical limit)\nJ2:150     # Shoulder maximum (mechanical limit)\nJ3:0       # Elbow minimum\nJ3:180     # Elbow maximum\nJ6:90      # Gripper minimum\nJ6:180     # Gripper maximum\n```\n\n**Error Testing:**\n```bash\nJ1:200     # Error: over 180 degrees\nJ2:10      # Error: under 30 degrees\nJ2:160     # Error: over 150 degrees\nJ6:50      # Error: under 90 degrees\nJ7:90      # Error: invalid joint number\n```\n\n### Sequence Commands\n\n**Recording Sequences:**\n```bash\nRECORD_START:0:PickSequence   # Start recording sequence 0\nJ1:45                         # Record base movement\nJ2:90                         # Record shoulder movement\nJ3:135                        # Record elbow movement\nJ4:60                         # Record wrist rotation\nRECORD_STOP                   # Stop recording\nLIST_SEQUENCES               # Verify sequence saved\n```\n\n**Playing Sequences:**\n```bash\nPLAY_SEQUENCE:0              # Play recorded sequence\nSTATUS                       # Check final position\n```\n\n**Sequence Management:**\n```bash\nLIST_SEQUENCES               # Show all sequences\nDELETE_SEQUENCE:0            # Delete sequence 0\nLIST_SEQUENCES               # Verify deletion\n```\n\n### Arduino Serial Monitor Setup\n\n1. **Upload code** to Arduino Uno/Mega\n2. **Open Serial Monitor** (Tools -\u003e Serial Monitor)\n3. **Set baud rate** to `115200`\n4. **Line ending** to `Newline` or `Both NL \u0026 CR`\n5. **Send commands** one by one and observe responses\n\n### Complete Test Sequence\n\n```bash\n# Initial status\nSTATUS\n\n# Test individual joints\nJ1:90\nSTATUS\nJ2:45\nSTATUS\nJ3:60\nSTATUS\n\n# Test home command\nHOME\nSTATUS\n\n# Test wave command\nWAVE\nSTATUS\n\n# Test emergency stop\nJ1:180\nSTOP\nSTATUS\n\n# Test sequence recording\nRECORD_START:0:TestMove\nJ1:30\nJ2:80\nJ3:120\nRECORD_STOP\n\n# Test sequence playback\nLIST_SEQUENCES\nPLAY_SEQUENCE:0\nSTATUS\n\n# Clean up\nDELETE_SEQUENCE:0\nLIST_SEQUENCES\n```\n\n## Benchmark Results\n\n### Arduino Uno (Optimized)\n- **Flash Usage**: ~29% (9500/32256 bytes)\n- **RAM Usage**: ~81% (1675/2048 bytes)\n- **Status**: Reliable, all features functional\n- **Movement Speed**: Configurable 5-200ms (default 15ms)\n- **Sequences**: 2 sequences x 15 waypoints each\n- **Commands**: HOME, MIN, MAX, WAVE, SET_SPEED, full sequence control\n\n### Arduino Mega (Optimized)\n- **Flash Usage**: ~4% (10660/253952 bytes)\n- **RAM Usage**: ~21% (1786/8192 bytes)\n- **Status**: Full headroom, recommended for expansion\n- **Movement Speed**: Configurable 5-200ms (default 15ms)\n- **Sequences**: 2 sequences x 15 waypoints each\n- **Commands**: HOME, MIN, MAX, WAVE, SET_SPEED, full sequence control\n\n## Safety Features\n\n- **Joint Limit Validation**: Every angle command is checked against `JOINT_MIN[]` and `JOINT_MAX[]` before servo movement. Out-of-range values return an error with the valid range.\n- **Angle Clamping**: Internal movement functions clamp angles to valid range as a secondary safeguard.\n- **Emergency Stop**: Immediate halt of all movements via button or Esc key.\n- **Command Validation**: All commands are validated for format and parameters before execution.\n- **Movement Interruption**: Emergency stop can interrupt ongoing movements including sequence playback.\n\n## Sequence Management\n\nThe system supports creating and managing movement sequences for automated operations.\n\n### Recording Sequences\n\n1. Enter a sequence name in the text field\n2. Click \"Start Recording\" or press Ctrl+R (button turns red)\n3. Move joints using sliders - each movement is recorded as a waypoint\n4. Click \"Stop Recording\" or press Ctrl+R again when finished\n\n### Managing Sequences\n\n- **Play**: Execute the selected sequence from the list\n- **Delete**: Remove the selected sequence\n- **Refresh**: Update the sequence list from Arduino\n- **Save to File**: Export current positions and sequence list to JSON\n- **Load from File**: Import positions and speed from JSON, send to Arduino\n\n### Sequence Protocol\n\n```\nRECORD_START:sequence_index:name    - Start recording sequence\nRECORD_STOP                        - Stop recording\nPLAY_SEQUENCE:sequence_index       - Play recorded sequence\nLIST_SEQUENCES                     - Get list of sequences\nDELETE_SEQUENCE:sequence_index     - Delete sequence\n```\n\n### Arduino Storage\n\n- **Capacity**: Up to 2 sequences in Arduino memory\n- **Length**: Each sequence can have up to 15 waypoints\n- **Persistence**: Sequences are stored in RAM (lost on power cycle)\n\n## Keyboard Shortcuts\n\n| Shortcut | Action |\n|---|---|\n| Esc | Emergency Stop |\n| Ctrl+H | Move to Home position |\n| Ctrl+R | Start/Stop recording |\n| Ctrl+Shift+C | Connect/Disconnect serial |\n\n## Customization\n\n### Joint Limits\n\nModify `JOINT_MIN` and `JOINT_MAX` in `code/config.h`:\n\n```cpp\nconst int JOINT_MIN[NUM_JOINTS] = {0, 30, 0, 0, 0, 90};\nconst int JOINT_MAX[NUM_JOINTS] = {180, 150, 180, 180, 180, 180};\n```\n\nAlso update `JOINT_LIMITS` in `arm_control_gui.py` to match.\n\n### Movement Speed\n\n**Via Serial Commands:**\n```bash\nSET_SPEED:15   # Fast and smooth (default)\nSET_SPEED:50   # Normal speed\nSET_SPEED:100  # Slow and precise\n```\n\n**Via GUI:**\n- Use the speed control spinbox (5-200ms range)\n- Click \"Set\" to apply changes immediately\n\n**Arduino Code Default (in `config.h`):**\n```cpp\n#define DEFAULT_MOVE_SPEED 15\n#define MIN_MOVE_SPEED 5\n#define MAX_MOVE_SPEED 200\n```\n\n### Preset Positions\n\nModify `HOME_POSITIONS` in `code/config.h` and `HOME_POSITIONS` in `arm_control_gui.py`.\n\n## ESP32 WiFi Bridge\n\nThe ESP32 bridge turns the robot arm into a network-accessible device with a REST API, similar to how industrial robot controllers operate. The Arduino firmware requires no modifications -- the ESP32 speaks the same serial protocol.\n\n```\n[HTTP Client] \u003c--WiFi--\u003e [ESP32 Bridge] \u003c--UART--\u003e [Arduino Uno/Mega] \u003c--PWM--\u003e [Servos]\n```\n\n### Bridge Setup\n\n1. **Install dependencies** in Arduino IDE:\n   - Board: \"ESP32 Dev Module\" (via Boards Manager)\n   - Library: ArduinoJson (via Library Manager)\n\n2. **Configure WiFi credentials**:\n   ```bash\n   cd bridge/\n   cp secrets.h.example secrets.h\n   # Edit secrets.h with your WiFi SSID, password, and optional API key\n   ```\n\n3. **Upload to ESP32**:\n   ```bash\n   arduino-cli compile --fqbn esp32:esp32:esp32 --build-path ../build_bridge .\n   arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32 .\n   ```\n\n4. **Access the API** at `http://robot-arm.local` (mDNS) or the IP printed on serial monitor.\n\n### Wiring\n\n| ESP32 Pin | Arduino Pin | Function |\n|---|---|---|\n| GPIO 16 (RX2) | TX (pin 1) | Arduino transmit to ESP32 |\n| GPIO 17 (TX2) | RX (pin 0) | ESP32 transmit to Arduino |\n| GND | GND | Common ground |\n\nDisconnect the Arduino USB cable when using the ESP32 bridge, since both share the same UART on Uno. Arduino Mega users can modify the bridge to use `Serial1` to keep USB available for debugging.\n\n### REST API Reference\n\nAll endpoints return JSON. Set `X-API-Key` header if authentication is configured in `secrets.h`. CORS is enabled for browser clients.\n\n#### System\n\n| Method | Endpoint | Description |\n|---|---|---|\n| GET | `/api/health` | Health check: Arduino status, WiFi RSSI, uptime |\n| GET | `/api/info` | System info: firmware version, IP, hostname, free heap |\n| GET | `/api/status` | Current joint positions |\n\n#### Joint Control\n\n| Method | Endpoint | Body | Description |\n|---|---|---|---|\n| POST | `/api/joint` | `{\"joint\": 1, \"angle\": 90}` | Move single joint |\n| POST | `/api/joints` | `{\"joints\": {\"J1\": 90, \"J2\": 45}}` | Move multiple joints |\n\n#### Presets and Safety\n\n| Method | Endpoint | Description |\n|---|---|---|\n| POST | `/api/home` | Move to home position |\n| POST | `/api/stop` | Emergency stop (no auth required) |\n| POST | `/api/preset/min` | All joints to minimum |\n| POST | `/api/preset/max` | All joints to maximum |\n| POST | `/api/preset/wave` | Wave gesture |\n| POST | `/api/speed` | Set speed: `{\"speed_ms\": 15}` |\n\n#### Program Management\n\n| Method | Endpoint | Body | Description |\n|---|---|---|---|\n| GET | `/api/program/list` | -- | List stored programs |\n| POST | `/api/program/record` | `{\"slot\": 0, \"name\": \"pick\"}` | Start recording |\n| POST | `/api/program/stop` | -- | Stop recording |\n| POST | `/api/program/run` | `{\"slot\": 0}` | Execute program |\n| POST | `/api/program/delete` | `{\"slot\": 0}` | Delete program |\n\n#### Example Usage (curl)\n\n```bash\n# Check health\ncurl http://robot-arm.local/api/health\n\n# Get current positions\ncurl http://robot-arm.local/api/status\n\n# Move joint 1 to 90 degrees\ncurl -X POST http://robot-arm.local/api/joint \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"joint\": 1, \"angle\": 90}'\n\n# Move multiple joints\ncurl -X POST http://robot-arm.local/api/joints \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"joints\": {\"J1\": 90, \"J2\": 45, \"J3\": 60}}'\n\n# Go home\ncurl -X POST http://robot-arm.local/api/home\n\n# Emergency stop\ncurl -X POST http://robot-arm.local/api/stop\n\n# Set speed\ncurl -X POST http://robot-arm.local/api/speed \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"speed_ms\": 50}'\n\n# Record a program\ncurl -X POST http://robot-arm.local/api/program/record \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"slot\": 0, \"name\": \"pick_and_place\"}'\n\n# (move joints via /api/joint calls while recording)\n\n# Stop recording\ncurl -X POST http://robot-arm.local/api/program/stop\n\n# Run the program\ncurl -X POST http://robot-arm.local/api/program/run \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"slot\": 0}'\n\n# List programs\ncurl http://robot-arm.local/api/program/list\n\n# With API key authentication\ncurl -H \"X-API-Key: your-key\" http://robot-arm.local/api/status\n```\n\n#### Response Format\n\nSuccess:\n```json\n{\n  \"status\": \"ok\",\n  \"positions\": {\"J1\": 92, \"J2\": 85, \"J3\": 45, \"J4\": 108, \"J5\": 80, \"J6\": 152}\n}\n```\n\nError:\n```json\n{\n  \"error\": \"Joint 2 range is 30-150\"\n}\n```\n\nProgram list:\n```json\n{\n  \"status\": \"ok\",\n  \"programs\": [\n    {\"slot\": 0, \"name\": \"pick_and_place\"},\n    {\"slot\": 1, \"name\": \"wave_demo\"}\n  ]\n}\n```\n\n## Troubleshooting\n\n### Connection Issues\n\n1. Check that Arduino Uno/Mega is connected (`arduino-cli board list`)\n2. Verify correct port selection (typically `/dev/ttyACM0` or `/dev/ttyUSB0`)\n3. Ensure Arduino code is uploaded and running\n4. Check serial baud rate (115200)\n5. If the GUI shows \"Connection lost\", it will auto-reconnect when the port reappears\n\n### Movement Issues\n\n1. Verify servo connections: pins 4, 5, 6, 7, 8, 9 on both Uno and Mega\n2. Check servo power supply (adequate current for 6 servos)\n3. Confirm joint limits are appropriate for your arm\n4. Test individual joints with manual commands\n5. Check for \"ERROR:Joint N range is X-Y\" messages indicating limit violations\n\n### GUI Issues\n\n1. Ensure PyQt6 and pyserial are installed\n2. Check Python version (3.8+ required)\n3. Run GUI with proper display (not headless)\n4. If sliders feel unresponsive, the 80ms debounce is working as intended\n\n## Development\n\n### System Documentation\n\n- **Complete System Flowchart**: [View detailed Mermaid flowchart](assets/flowchart.mermaid)\n  - User interface interactions\n  - Serial communication protocol\n  - Command processing flows\n  - Hardware control sequences\n  - Safety and validation systems\n  - Sequence management operations\n\n- **Rendered Flowchart**: [View rendered flowchart diagram](assets/render.png)\n  - Visual representation of system architecture\n  - Component relationships and data flows\n  - Hierarchical organization of system layers\n\n### Adding New Features\n\n- **New Commands**: Add to `processCommand()` in `code/code.ino`\n- **New GUI Elements**: Extend `_build_right_panel()` in `arm_control_gui.py`\n- **Additional Safety**: Add validation in `clampAngle()` or `processJointCommand()`\n\n### Code Structure\n\n- **Arduino**: Servo array, char buffer input, modular command processing\n- **Python**: Object-oriented Qt6 application with threaded serial I/O\n- **Communication**: Text protocol with debounced slider commands\n- **Compatibility**: Tested and optimized for Arduino Uno and Mega\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions welcome! Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Submit a pull request\n\n## Support\n\nFor issues and questions:\n\n1. Check the troubleshooting section\n2. Review the serial protocol documentation\n3. Open an issue on GitHub\n\n---\n\n**Note**: Always test safety features before operating with real hardware. Ensure proper power supplies and mechanical constraints to prevent damage to equipment or injury.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2F6dof_arm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1999azzar%2F6dof_arm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1999azzar%2F6dof_arm/lists"}