Inspiration
Every year, millions of tons of recyclable material end up in landfills. Not because people don't want to recycle, but because sorting is confusing and easy to get wrong. We wanted to answer a simple question: what if the trash can could sort itself? We set out to build something that takes human error out of waste sorting and makes the environmental impact visible in real time.
What it does
Trash Detective is an AI-powered smart trash sorting system with a real-time analytics dashboard. You drop an item into the sorter, a camera captures it, a computer vision model classifies it into one of four categories (paper/cardboard, metal/glass, plastic, or trash), and a servos routes it to the correct bin. Every sorted item shows up on a live dashboard within two seconds with the captured image, classification, confidence score, and environmental impact metrics like waste diverted and CO2 saved.
How we built it
On the hardware side, we used a Raspberry Pi with a camera module and servos motors inside a custom-built sorting enclosure. Items are staged one at a time in front of the camera so the model can classify them reliably. For classification, we run OpenAI's CLIP model on a PC server using zero-shot inference with tuned text prompts for each waste category, so we didn't need any custom training data.
The backend is built with FastAPI and uses Supabase for the database and image storage. The frontend is a Next.js app with React, TypeScript, Tailwind CSS, and shadcn/ui. It polls the backend every two seconds using SWR to keep the dashboard feeling live without needing WebSockets. The Pi streams frames to the PC over a socket connection, the PC classifies each item and sends servos commands back, then posts the result to the backend API.
Challenges we ran into
Getting reliable classification was harder than we expected. Early attempts at classifying items mid-air or while moving were all over the place. We redesigned the physical system to stage items one at a time, which made a huge difference. Tuning the CLIP text prompts took a lot of trial and error because small wording changes had a big effect on accuracy. We also had to build a consensus system that waits for 10 consecutive matching frames before locking in a classification, which stopped the dashboard from getting flooded with jittery results. On top of that, getting the Pi, PC, and backend all talking to each other on the same network meant dealing with CORS and host binding issues.
Accomplishments that we're proud of
The full demo loop works end to end. You drop trash in, the servos sorts it, and the dashboard updates live. Seeing the first real item show up on the dashboard was a great moment. We're also proud of how the dashboard turned out. It looks like a real product, not a hackathon prototype. Using CLIP's zero-shot approach meant we didn't have to spend time collecting and labeling training images, which saved us a ton of time and let us focus on the full system.
What we learned
We learned that hardware projects are mostly about debugging physical problems, not writing code. We got hands-on experience with deploying computer vision on constrained devices, building real-time data pipelines from edge hardware to a web dashboard, and designing software around hardware limitations instead of fighting them. We also learned that CLIP is surprisingly good at practical classification tasks when you put effort into prompt engineering.
What's next for Trash Detective
We want to support multiple sorting stations reporting to one dashboard so it can be deployed across a campus or facility. We're planning to fine-tune a lightweight YOLO model on real waste images so inference can run directly on the Pi without needing a separate PC. Down the road, we'd like to add trend analytics, contamination tracking, and facility comparisons to turn Trash Detective into a full waste intelligence platform.
Built With
- claude
- code
- fastapi
- hugging-face-transformers
- javascript
- languages:-python
- pytorch
- react
- recharts
- render-cloud-services:-supabase-(postgres-database-+-object-storage)-databases:-postgresql-(via-supabase)-apis:-openai-clip-(clip-vit-base-patch32)
- shadcn/ui
- sql-frameworks:-next.js
- supabase-rest-api-other-technologies:-opencv
- swr
- tailwind-css-platforms:-raspberry-pi
- typescript
- uvicorn
- vercel
Log in or sign up for Devpost to join the conversation.