Scan an item, and the right recycling bin lid opens. SortBin is a small web app with an optional Arduino build: the same decision that lifts a lid on the screen can lift a real servo-driven lid on your desk.
- Looks up a product barcode in Open Food Facts and reads its packaging data.
- Maps the packaging to one of four bins: packaging, paper, glass, general waste.
- Works without a barcode too: pick a material from the quick buttons.
- Scans barcodes with the phone or laptop camera (Chrome and Edge, via the
BarcodeDetectorAPI). - Sends the bin letter to an Arduino over USB (Web Serial) so the matching lid opens for 8 seconds.
- Keeps a short "sorted today" list in the browser.
No build step, no dependencies. It is plain HTML, CSS and JavaScript.
git clone https://github.com/SimaKogan/SortBin.git
cd SortBin
python3 -m http.server 8000Open http://localhost:8000. Camera access needs localhost or HTTPS, so open it through the server instead of double-clicking index.html.
Run the sorting-rule tests with node test.js.
- Wire four hobby servos (lids) to pins 3, 5, 6, 9 and four LEDs to pins 10 to 13. Power the servos from an external 5 V supply with a shared ground.
- Open
arduino/SortBin/SortBin.inoin the Arduino IDE and upload it. - Close the IDE's serial monitor, open the web app in Chrome or Edge, press Connect Arduino and choose the board.
Serial protocol at 9600 baud, one character per command:
| Letter | Action |
|---|---|
A |
open the packaging lid |
B |
open the paper lid |
C |
open the glass lid |
D |
open the general waste lid |
X |
close all lids |
index.html, style.css, app.js the web app
catalog.js bins, quick picks and the packaging -> bin rules
test.js tests for the rules (node test.js)
arduino/SortBin/SortBin.ino firmware
Recycling rules differ between cities and countries. Edit RULES and BINS in catalog.js to match your local bins.
MIT. See LICENSE. Made by Serafima Kogan.
