How gpt-lab-summer-2026/trash-sorter works
Trash Sorter is a camera-driven hardware system: the main loop calibrates a reference image, waits for an item, classifies it, moves the actuator to a bin, records the sort, and updates the LCD. Separate branches handle button input and optional monitor visualization; the ESP32 firmware provides the actuator endpoint. The graph follows calls visible in the excerpts and capabilities documented in the README; hardware links documented but not shown in sampled implementation are cited to the README.
Main entry points: main.py Main loop · config.py Runtime settings · detector.py Trash classifier · sorter.py Bin selection
Components 17
Sort workflow
- Main loop
main.py - Runtime settings
config.py
Vision
- Camera processing
camera.py - Trash classifier
detector.py - Bin mapping
labels.py - YOLO model
models/best.onnx
Actuation
- Bin selection
sorter.py - ESP serial control
connect_esp.py - ESP32 controller
esp32c6/esp32c6.ino
User interface
- Button input
buttons.py - LCD status
screen.py - Monitor overlay
visualizer.py
Sort records
- Sort history
sorted.csv
Other components
- Operator
- Servo joint
- Monitor window
- Camera
Connections 25
- Operator → Camera: places item
README.md - Camera → Main loop: provides frames
- Main loop → Camera processing: captures and calibrates
main.py - Main loop → Trash classifier: classifies frame
main.py - Trash classifier → Bin mapping: maps category
detector.py - Trash classifier → YOLO model: runs inference
detector.py - Trash classifier → Runtime settings: reads settings
detector.py - Main loop → Runtime settings: reads settings
main.py - Main loop → Bin selection: sorts detection
main.py - Bin selection → ESP serial control: sets position
sorter.py - Main loop → ESP serial control: connects and resets
main.py - ESP serial control → ESP32 controller: sends commands
README.md - ESP32 controller → Servo joint: controls servos
README.md - Bin selection → Sort history: appends sort
sorter.py - Main loop → Sort history: clears history
main.py - Main loop → LCD status: updates status
main.py - LCD status → Sort history: reads count
screen.py - Operator → Button input: presses controls
README.md - Main loop → Button input: checks input
main.py - Main loop → Monitor overlay: renders overlay
main.py - Monitor overlay → Monitor window: draws window
- LCD status → Runtime settings: reads pin settings
screen.py - Button input → Runtime settings: reads pin settings
buttons.py - ESP serial control → Runtime settings: reads serial settings
connect_esp.py - Bin selection → Runtime settings: reads servo settings
sorter.py