Skip to content
SimaKoganPublic

About

Scan a barcode, the right bin lid opens. Zero-dependency web app with optional Arduino hardware.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

SortBin

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.

SortBin

What it does

  • 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 BarcodeDetector API).
  • 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.

Run it

git clone https://github.com/SimaKogan/SortBin.git
cd SortBin
python3 -m http.server 8000

Open 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.

Arduino build

  1. 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.
  2. Open arduino/SortBin/SortBin.ino in the Arduino IDE and upload it.
  3. 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

Project layout

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

Notes

Recycling rules differ between cities and countries. Edit RULES and BINS in catalog.js to match your local bins.

License

MIT. See LICENSE. Made by Serafima Kogan.

About

Scan a barcode, the right bin lid opens. Zero-dependency web app with optional Arduino hardware.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages