Inspiration

Since 1 April 2026, India's Solid Waste Management Rules, 2026 ask every home, hostel, office and campus to separate waste into four streams: wet, dry, sanitary and special care. Big generators (hostels, campuses, large societies) carry extended responsibility for what they throw away, and the rules call for online tracking of the waste chain.

But nobody measures what actually goes into each bin. Registers are filled in by hand, and one chips packet in the wet bin or one battery in the dry bin can spoil a whole batch of compost or recyclables. Electricity has a meter. Trash doesn't. So I built one.

What it does

ReBin hangs over a bin and is told which stream that bin is for. With no button to press:

  • It notices every drop. The camera sees motion, then a still scene with something new in it, tells drops from items being taken out, and takes a 1024×768 photo of the new item.
  • Gemini decides the stream, on-device by default.
  • It catches the wrong bin. The bin's own screen turns red and the station says where the item goes. Batteries, medicines and cables get handling advice as special care waste.
  • It only accuses when it's sure. If Nano is unsure, ReBin asks the cloud; if the answer is still low-confidence, the station shows "not sure" instead of warning anyone.
  • It logs the item: what it was, its stream, estimated grams, whether it was in the wrong bin, and where the AI ran. Photos are never stored.
  • The manager's dashboard on any phone shows kg per stream, the wrong-bin rate, the most common mistakes, a live feed, and a weekly report written in the cloud.

How I built it: hybrid inference with Firebase AI Logic

Every model call goes through the Firebase AI Logic Web SDK:

  1. On-device first (PREFER_ON_DEVICE). Gemini Nano in Chrome on the hub classifies every drop. A busy bin sees hundreds of items a day: on-device costs nothing per item, keeps photos of people's trash inside the building, and keeps working with no network.
  2. Automatic cloud fallback. On a device without Nano, like the manager's phone, the same call runs in the cloud. One code path everywhere.
  3. Cloud escalation (ONLY_IN_CLOUD). When Nano says "unknown", is below the confidence threshold, or says an item is in the wrong bin, ReBin asks a cloud Gemini model for a second opinion before anyone is warned. Every cloud call has a 9-second limit; if a model is slow, overloaded or out of quota, it falls back to a lighter one, and Nano's answer is kept if all else fails.
  4. Reports (PREFER_IN_CLOUD) reason over a week of events, falling back to Nano offline.

Both paths use structured output with the same schema. Every result carries its inferenceSource, and the station shows a routing trace explaining why each path was taken.

I also used App Check with reCAPTCHA Enterprise (debug tokens only in local dev, never in the hosted build), Firestore with an offline cache and validated writes, Remote Config for routing knobs (threshold, models) and bin rules, Anonymous Auth, and Hosting.

Hardware: an ESP32-S3 camera board (OV3660) streams frames over USB to Chrome through Web Serial, so there's no Wi-Fi setup and no server. It has its own 1.8" screen, and I wired it with plug-in jumpers only.

Accuracy

  • On 25 labelled everyday items (photos from Wikimedia Commons), the cloud model (gemini-3.5-flash-lite) got 25/25, twice, in about 3 s per item.
  • Gemini Nano on my hub (an RTX 5050 laptop) takes about 5 s per item, warmed up when the station opens. In the recorded demo, packaging paper and a snack packet were decided on-device. An onion peel in the dry bin left Nano unsure, so it asked the cloud: wet waste, but with low confidence, so ReBin showed "not sure" instead of warning anyone.

On a free-tier project, the stronger cloud model allows about 20 requests a day, and my testing used them up in minutes. A bin that sent every drop to the cloud would run out before lunch. On-device first is what makes a metered bin affordable.

Challenges I ran into

  • My first camera board locked me out. It was the payment button from my previous hackathon, and my own firmware had locked it against reflashing; its boot strapping meant the BOOT button couldn't unlock it either. I switched to a dual-USB board with a hardware recovery port.
  • Noticing a drop without a button. Hands, shadows and auto-exposure all look like change. The detector cancels brightness shifts, waits for the scene to settle, and only counts a change that follows motion. It's unit-tested on synthetic frames.
  • My first afternoon on a real bin found seven problems the photo set didn't: an 80-second first scan, camera grain that read as constant movement, "cardboard!" answers because my bin was a cardboard box, blurry crops (Nano called packing paper "organic" and a ribbon cable a "paper strip"), false wrong-bin warnings, the liner logged as "tissue" whenever I lifted an item out, and one floppy bag counted seven times. I fixed each one: Nano warm-up and cloud time limits, denoising, cropping to what's new, a 1024×768 photo per drop, cloud confirmation before any wrong-bin warning, removal detection, and counting a settling item once.
  • Cloud models get overloaded and run out of quota. During testing, one stronger model answered "high demand" and another "quota exceeded", so every cloud call now has a fallback.
  • Nano still misreads some things. Thin, see-through items like onion skin and some crumpled paper are hard from a camera above a bin. That's why ReBin asks the cloud when unsure and never warns on a low-confidence answer.

Accomplishments that I'm proud of

  • Three-tier routing that explains itself on screen
  • Real wrong-bin detection tied to India's new four-stream rules, that only accuses when it's sure
  • A product that works with the bins a site already has, built from about ₹3,000 of parts

What I learned

On-device AI isn't only about privacy. For a sensor that fires hundreds of times a day, it's what makes the economics work, and the cloud becomes the expert you call, not the default.

What's next for ReBin

A load cell under the bin for measured kg, a speaker on the board, pilots at a hostel mess and a housing society, and per-bin monthly reports for bulk generators.

Built With

  • arduino
  • chrome
  • esp32-s3
  • firebase-ai-logic
  • firebase-app-check
  • firebase-auth
  • firebase-hosting
  • firebase-remote-config
  • firestore
  • gemini
  • gemini-nano
  • recaptcha-enterprise
  • typescript
  • vite
  • web-serial
Share this project:

Updates

Submission history