# nkakarla08/solar-tracking-system architecture

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

- Interactive diagram: https://gitdiagram.com/nkakarla08/solar-tracking-system
- Repository: https://github.com/nkakarla08/solar-tracking-system

## Overview

This is ESP32 firmware for a solar-panel tracker with automatic cleaning and a locally hosted monitoring/control dashboard. The documented workflow reads light and panel-power sensors, adjusts the panel in AUTO mode, and triggers cleaning below a 25% threshold; users can also select MANUAL mode and control the motor and relays through the dashboard. The sampled source shows sensor/PWM behavior, dashboard generation, HTTP handlers, and Wi-Fi access-point setup, but does not show all initialization and route-registration code. Other README-described behavior is represented as documented capability.

Main entry points: [`main/solarNikitha.c`](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c) (Tracking control task)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sensing["Sensing and Tracking"]
  node_control_task["Tracking control task<br/>[solarNikitha.c]"]
  node_pwm["Servo PWM<br/>[solarNikitha.c]"]
end

subgraph group_cleaning["Cleaning Control"]
  node_power_threshold["Power threshold<br/>[solarNikitha.c]"]
  node_relay_handlers["Relay handlers<br/>[solarNikitha.c]"]
end

subgraph group_web["Web Interface"]
  node_dashboard["Live dashboard<br/>[solarNikitha.c]"]
  node_http_routes["HTTP handlers<br/>[solarNikitha.c]"]
  node_wifi_ap["Wi-Fi access point<br/>[solarNikitha.c]"]
end

subgraph group_firmware["Device Firmware"]
  node_mode_control["Mode control<br/>[solarNikitha.c]"]
end

node_operator(("Panel operator"))
node_ldr(("LDR sensors"))
node_solar_sensor(("Solar sensor"))
node_servo(("Servo motor"))
node_cleaning_hardware(("Cleaning relays"))

node_ldr -->|"provides readings"| node_control_task
node_solar_sensor -->|"provides readings"| node_control_task
node_control_task -->|"sets duty"| node_pwm
node_pwm -->|"drives"| node_servo
node_control_task -->|"checks power"| node_power_threshold
node_power_threshold -->|"triggers cleaning"| node_relay_handlers
node_relay_handlers -->|"switches relays"| node_cleaning_hardware
node_operator -->|"views and controls"| node_dashboard
node_wifi_ap -->|"hosts"| node_dashboard
node_dashboard -->|"sends control requests"| node_http_routes
node_http_routes -->|"sets relay state"| node_relay_handlers
node_http_routes -->|"changes mode"| node_mode_control
node_mode_control -->|"selects control mode"| node_control_task
node_control_task -->|"updates display data"| node_dashboard

click node_control_task "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_power_threshold "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_relay_handlers "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_mode_control "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_dashboard "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_http_routes "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_wifi_ap "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"
click node_pwm "https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c"

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_control_task,node_pwm toneBlue
class node_power_threshold,node_relay_handlers toneAmber
class node_dashboard,node_http_routes,node_wifi_ap toneMint
class node_mode_control toneRose
class node_operator,node_ldr,node_solar_sensor,node_servo,node_cleaning_hardware toneIndigo
```

## Components

### Sensing and Tracking

- [Tracking control task](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`
- [Servo PWM](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`

### Cleaning Control

- [Power threshold](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`
- [Relay handlers](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`

### Web Interface

- [Live dashboard](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`
- [HTTP handlers](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`
- [Wi-Fi access point](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`

### Device Firmware

- [Mode control](https://github.com/nkakarla08/solar-tracking-system/blob/main/main/solarNikitha.c): `main/solarNikitha.c`

### Other components

- **Panel operator**
- **LDR sensors**
- **Solar sensor**
- **Servo motor**
- **Cleaning relays**

## Connections

- LDR sensors → Tracking control task: provides readings (evidence: `README.md`)
- Solar sensor → Tracking control task: provides readings (evidence: `README.md`)
- Tracking control task → Servo PWM: sets duty (evidence: `main/solarNikitha.c`)
- Servo PWM → Servo motor: drives (evidence: `README.md`)
- Tracking control task → Power threshold: checks power (evidence: `README.md`)
- Power threshold → Relay handlers: triggers cleaning (evidence: `README.md`)
- Relay handlers → Cleaning relays: switches relays (evidence: `main/solarNikitha.c`)
- Panel operator → Live dashboard: views and controls (evidence: `README.md`)
- Wi-Fi access point → Live dashboard: hosts (evidence: `README.md`)
- Live dashboard → HTTP handlers: sends control requests (evidence: `main/solarNikitha.c`)
- HTTP handlers → Relay handlers: sets relay state (evidence: `main/solarNikitha.c`)
- HTTP handlers → Mode control: changes mode (evidence: `main/solarNikitha.c`)
- Mode control → Tracking control task: selects control mode (evidence: `README.md`)
- Tracking control task → Live dashboard: updates display data (evidence: `main/solarNikitha.c`)
