# sangeeth2008/-ai-powered-smart-waste-segregation-bin architecture

> Architecture diagram of the GitHub repository sangeeth2008/-ai-powered-smart-waste-segregation-bin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin
- Repository: https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin

## Overview

The product is a dual-ESP32 smart waste-segregation bin. Its core workflow is a touch or dashboard request, camera capture and cloud classification, classification mapping on the main controller, and servo chute actuation. The README also documents a camera stream, embedded dashboard, 3D digital twin, OLED telemetry, and fall-safety monitoring. Main and camera firmware excerpts were not provided, so their documented responsibilities are shown without speculative internal call chains.

Main entry points: [`smart-waste-bin/main-esp32/main/main.ino`](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/main.ino) (Main controller), [`smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino`](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino) (Camera node), [`smart-waste-bin/main-esp32/main/uart_protocol.cpp`](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/uart_protocol.cpp) (UART protocol), [`smart-waste-bin/main-esp32/main/servo_controller.cpp`](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/servo_controller.cpp) (Servo controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Vision and classification"]
  node_camera["Camera node<br/>[waste_camera.ino]"]
  node_cloud["CircuitDigest AI"]
  node_stream["MJPEG stream<br/>[waste_camera.ino]"]
end

subgraph group_sorting["Control and sorting"]
  node_touch(("Touch sensor"))
  node_main["Main controller<br/>[main.ino]"]
  node_uart["UART protocol<br/>[uart_protocol.cpp]"]
  node_mapping["Waste mapping<br/>[uart_protocol.cpp]"]
  node_servo["Servo controller"]
  node_chute["Sorting chute"]
end

subgraph group_interfaces["User interfaces"]
  node_user(("Operator"))
  node_browser(("Browser"))
  node_dashboard["Embedded dashboard<br/>[web_dashboard.h]"]
  node_digital_twin["3D digital twin<br/>[three-scene.js]"]
  node_web_app["Web application<br/>[app.js]"]
end

subgraph group_safety["Safety and telemetry"]
  node_oled["OLED display<br/>[main.ino]"]
  node_sensor["MPU6050 sensor<br/>[sensors.cpp]"]
  node_fall["Fall detection<br/>[fall_detection.cpp]"]
end

node_touch -->|"triggers"| node_main
node_user -->|"uses"| node_browser
node_browser -->|"requests controls"| node_main
node_main -->|"serves page"| node_dashboard
node_dashboard -->|"polls and commands"| node_main
node_main -->|"sends classify"| node_uart
node_uart -->|"UART dispatch"| node_camera
node_camera -->|"sends image"| node_cloud
node_camera -->|"returns result"| node_uart
node_main -->|"maps result"| node_mapping
node_main -->|"commands angle"| node_servo
node_servo -->|"positions"| node_chute
node_camera -->|"provides video"| node_stream
node_stream -->|"streams MJPEG"| node_browser
node_browser -->|"loads"| node_web_app
node_web_app -->|"renders scene"| node_digital_twin
node_main -->|"updates telemetry"| node_oled
node_main -->|"reads tilt"| node_sensor
node_main -->|"passes tilt"| node_fall

click node_main "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/main.ino"
click node_uart "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/uart_protocol.cpp"
click node_mapping "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/uart_protocol.cpp"
click node_servo "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/servo_controller.cpp"
click node_camera "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino"
click node_stream "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino"
click node_dashboard "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/web_dashboard.h"
click node_digital_twin "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/assets/js/three-scene.js"
click node_web_app "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/assets/js/app.js"
click node_oled "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/main.ino"
click node_sensor "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/sensors.cpp"
click node_fall "https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/fall_detection.cpp"

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_camera,node_cloud,node_stream toneBlue
class node_touch,node_main,node_uart,node_mapping,node_servo,node_chute toneAmber
class node_user,node_browser,node_dashboard,node_digital_twin,node_web_app toneMint
class node_oled,node_sensor,node_fall toneRose
```

## Components

### Vision and classification

- [Camera node](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino): `smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino`
- **CircuitDigest AI**
- [MJPEG stream](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino): `smart-waste-bin/esp32-cam/waste_camera/waste_camera.ino`

### Control and sorting

- **Touch sensor**
- [Main controller](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/main.ino): `smart-waste-bin/main-esp32/main/main.ino`
- [UART protocol](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/uart_protocol.cpp): `smart-waste-bin/main-esp32/main/uart_protocol.cpp`
- [Waste mapping](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/uart_protocol.cpp): `smart-waste-bin/main-esp32/main/uart_protocol.cpp`
- [Servo controller](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/servo_controller.cpp): `smart-waste-bin/main-esp32/main/servo_controller.cpp`
- **Sorting chute**

### User interfaces

- **Operator**
- **Browser**
- [Embedded dashboard](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/web_dashboard.h): `smart-waste-bin/main-esp32/main/web_dashboard.h`
- [3D digital twin](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/assets/js/three-scene.js): `assets/js/three-scene.js`
- [Web application](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/assets/js/app.js): `assets/js/app.js`

### Safety and telemetry

- [OLED display](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/main.ino): `smart-waste-bin/main-esp32/main/main.ino`
- [MPU6050 sensor](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/sensors.cpp): `smart-waste-bin/main-esp32/main/sensors.cpp`
- [Fall detection](https://github.com/sangeeth2008/-ai-powered-smart-waste-segregation-bin/blob/main/smart-waste-bin/main-esp32/main/fall_detection.cpp): `smart-waste-bin/main-esp32/main/fall_detection.cpp`

## Connections

- Touch sensor → Main controller: triggers
- Operator → Browser: uses
- Browser → Main controller: requests controls
- Main controller → Embedded dashboard: serves page
- Embedded dashboard → Main controller: polls and commands
- Main controller → UART protocol: sends classify
- UART protocol → Camera node: UART dispatch
- Camera node → CircuitDigest AI: sends image
- Camera node → UART protocol: returns result
- Main controller → Waste mapping: maps result
- Main controller → Servo controller: commands angle
- Servo controller → Sorting chute: positions
- Camera node → MJPEG stream: provides video
- MJPEG stream → Browser: streams MJPEG
- Browser → Web application: loads
- Web application → 3D digital twin: renders scene
- Main controller → OLED display: updates telemetry
- Main controller → MPU6050 sensor: reads tilt
- Main controller → Fall detection: passes tilt
