# pranav-kuppachi/esp-32-smart-torch architecture

> Architecture diagram of the GitHub repository pranav-kuppachi/esp-32-smart-torch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pranav-kuppachi/esp-32-smart-torch
- Repository: https://github.com/pranav-kuppachi/esp-32-smart-torch

## Overview

This small embedded project reads ambient light or a potentiometer, converts the selected input to a percentage, and drives a color-coded LED output; the MODE button selects automatic or manual operation. The README documents the behavior and Wokwi simulation, but no source excerpts were provided, so implementation-level call relationships cannot be verified. `sketch.ino` represents the firmware behavior and `diagram.json` the simulated circuit.

Main entry points: [`sketch.ino`](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino) (LEDC PWM), [`diagram.json`](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json) (Ambient Light Sensor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Controls and Sensors"]
  node_ldr["Ambient Light Sensor<br/>[diagram.json]"]
  node_pot["Brightness Potentiometer<br/>[diagram.json]"]
  node_mode_button["MODE Button<br/>[diagram.json]"]
end

subgraph group_firmware["Firmware Behavior"]
  node_mode["Mode Selection<br/>[sketch.ino]"]
  node_input_reading["Input Reading<br/>[sketch.ino]"]
  node_percentage["Percentage Mapping<br/>[sketch.ino]"]
  node_led_selection["LED Selection<br/>[sketch.ino]"]
end

subgraph group_outputs["LED Output"]
  node_pwm["LEDC PWM<br/>[sketch.ino]"]
  node_white_led["White LED<br/>[diagram.json]"]
  node_cyan_led["Cyan LED<br/>[diagram.json]"]
  node_blue_led["Blue LED<br/>[diagram.json]"]
end

node_wokwi(("Wokwi Simulation"))

node_mode_button -->|"switches mode"| node_mode
node_mode -->|"selects input"| node_input_reading
node_ldr -->|"provides reading"| node_input_reading
node_pot -->|"provides reading"| node_input_reading
node_input_reading -->|"maps to percent"| node_percentage
node_percentage -->|"selects by level"| node_led_selection
node_led_selection -->|"sets LED output"| node_pwm
node_pwm -->|"drives at 0–33%"| node_white_led
node_pwm -->|"drives at 34–66%"| node_cyan_led
node_pwm -->|"drives at 67–100%"| node_blue_led
node_wokwi -->|"simulates circuit"| node_ldr

click node_ldr "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"
click node_pot "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"
click node_mode_button "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"
click node_mode "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino"
click node_input_reading "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino"
click node_percentage "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino"
click node_led_selection "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino"
click node_pwm "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino"
click node_white_led "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"
click node_cyan_led "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"
click node_blue_led "https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json"

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_ldr,node_pot,node_mode_button toneBlue
class node_mode,node_input_reading,node_percentage,node_led_selection toneAmber
class node_pwm,node_white_led,node_cyan_led,node_blue_led toneMint
class node_wokwi toneIndigo
```

## Components

### Controls and Sensors

- [Ambient Light Sensor](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`
- [Brightness Potentiometer](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`
- [MODE Button](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`

### Firmware Behavior

- [Mode Selection](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino): `sketch.ino`
- [Input Reading](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino): `sketch.ino`
- [Percentage Mapping](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino): `sketch.ino`
- [LED Selection](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino): `sketch.ino`

### LED Output

- [LEDC PWM](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/sketch.ino): `sketch.ino`
- [White LED](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`
- [Cyan LED](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`
- [Blue LED](https://github.com/pranav-kuppachi/esp-32-smart-torch/blob/main/diagram.json): `diagram.json`

### Other components

- **Wokwi Simulation**

## Connections

- MODE Button → Mode Selection: switches mode (evidence: `README.md`)
- Mode Selection → Input Reading: selects input (evidence: `README.md`)
- Ambient Light Sensor → Input Reading: provides reading (evidence: `README.md`)
- Brightness Potentiometer → Input Reading: provides reading (evidence: `README.md`)
- Input Reading → Percentage Mapping: maps to percent (evidence: `README.md`)
- Percentage Mapping → LED Selection: selects by level (evidence: `README.md`)
- LED Selection → LEDC PWM: sets LED output (evidence: `README.md`)
- LEDC PWM → White LED: drives at 0–33% (evidence: `README.md`)
- LEDC PWM → Cyan LED: drives at 34–66% (evidence: `README.md`)
- LEDC PWM → Blue LED: drives at 67–100% (evidence: `README.md`)
- Wokwi Simulation → Ambient Light Sensor: simulates circuit (evidence: `README.md`)
