# josue-silva-t/control-telescope architecture

> Architecture diagram of the GitHub repository josue-silva-t/control-telescope, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/josue-silva-t/control-telescope
- Repository: https://github.com/josue-silva-t/control-telescope

## Overview

##### Main components
a. Motor-Control MCU (Moteres/MtP folder: MtP.ino, x.ino)
b. Camera-Control MCU (Camara.ino)
c. Embedded HTTP Server (app_httpd.cpp, camera_index.h, camera_pins.h, index.html) running on the Camera MCU or on a network-enabled board
d. Desktop Control Application (ControlT solution: Windows Forms – Form1.cs, Form2.cs, Program.cs)
e. End-User Interfaces
- Web UI (served by the Embedded HTTP Server via index.html)
- Desktop UI (ControlT Windows Forms)

##### Relationships and data flows
- The Desktop App (ControlT) communicates over USB/Serial with both MCUs to send control commands (azimuth, elevation, shutter) and receive status feedback.
- The Embedded HTTP Server interfaces directly with the Camera MCU’s GPIO (camera_pins.h) to trigger the shutter and stream any telemetry; it serves index.html to any web browser on the same network.
- End users can either run the Windows Forms desktop client or open the web UI in a browser to control the telescope.

##### Architectural patterns and technologies
- Embedded Firmware – Arduino-style sketches for motion control (Moteres/MtP) and camera control (Camara.ino).
- Custom HTTP daemon (app_httpd.cpp) implements a minimal web server on the Camera MCU.
- Rich Client – .NET Windows Forms (C#) for advanced local control and configuration.
- HTML/JavaScript static UI served by the MCU.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "End-User Interfaces"
        Browser["Web UI (Browser)"]:::web
        DesktopApp["ControlT Desktop App"]:::desktop
    end

    subgraph "Embedded Devices"
        MotorMCU["Motor Controller MCU"]:::firmware
        CameraMCU["Camera Controller MCU"]:::firmware
        HTTPServer["Embedded HTTP Server"]:::firmware
    end

    Browser -->|"HTTP requests"| HTTPServer
    HTTPServer -->|"HTTP responses (index.html, status JSON)"| Browser
    DesktopApp -->|"Serial/USB: move commands/status"| MotorMCU
    DesktopApp -->|"Serial/USB: shutter trigger/status"| CameraMCU
    HTTPServer -->|"GPIO: trigger shutter, read sensor"| CameraMCU

    click MotorMCU "https://github.com/josue-silva-t/control-telescope/blob/main/Moteres/MtP/MtP.ino"
    click MotorMCU "https://github.com/josue-silva-t/control-telescope/blob/main/Moteres/MtP/x.ino"
    click CameraMCU "https://github.com/josue-silva-t/control-telescope/blob/main/Camara.ino"
    click HTTPServer "https://github.com/josue-silva-t/control-telescope/blob/main/app_httpd.cpp"
    click HTTPServer "https://github.com/josue-silva-t/control-telescope/blob/main/camera_index.h"
    click HTTPServer "https://github.com/josue-silva-t/control-telescope/blob/main/camera_pins.h"
    click HTTPServer "https://github.com/josue-silva-t/control-telescope/blob/main/index.html"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/controlT.sln"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/controlT.csproj"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Program.cs"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form1.cs"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form1.Designer.cs"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form1.resx"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form1.es.resx"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form2.cs"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form2.Designer.cs"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/Form2.resx"
    click DesktopApp "https://github.com/josue-silva-t/control-telescope/blob/main/ControlT/App.config"
    click Browser "https://github.com/josue-silva-t/control-telescope/blob/main/index.html"

    classDef firmware fill:#ccffcc,stroke:#008000,color:#000000
    classDef desktop fill:#cce5ff,stroke:#005cbf,color:#000000
    classDef web fill:#fff3cd,stroke:#856404,color:#000000
    classDef protocol stroke-dasharray: 5 5,color:#999999
    class Browser,DesktopApp protocol
    class HTTPServer,MotorMCU,CameraMCU firmware
```
