Automatic wet and dry waste sorter with an Arduino Nano

A dry plastic bottle tips into the DRY bin, a damp banana peel into the WET bin. An IR sensor sees that something landed on the tray, a soil-moisture fork decides wet or dry, and one SG90 servo tips the tray 35 degrees to the right (wet) or to the left (dry), then levels it again.

  • 6 parts
  • 6 wiring steps
  • Arduino code
  • 5 V supply

Quick answer

The short version. Every pin is in the full wiring below.

What you need

  • Arduino Nano
  • FC-51 IR obstacle sensor module
  • Soil-moisture fork with its LM393 comparator board
  • SG90 servo
  • 5 V 2 A supply
  • A tray

How to wire it

  1. IR sensor OUT to Nano D2.
  2. Sensor board DO to Nano D3.
  3. Servo signal (orange) to Nano D9.
  4. The fork's two pins to the board's two input pins, either way round.
  5. Supply plus to the Nano 5V pin, the IR sensor's VCC, the board's VCC and the servo's red wire.
  6. Follow the pin print on your own sensor boards; the pin order of the board in the Short is not confirmed from a primary source.

Before you power it: Everything here runs on 5 V DC. Keep fingers clear of the tipping tray.

A yellow Automatic Waste Separator title above a banana peel falling toward a moisture probe fork, with an IR sensor at the left, a blue DRY bin and a green WET bin printed Wirecora, an SG90 servo between them, a small sensor board, an Arduino Nano and a 5V DC supply, wired with coloured wires
The circuit as wired in the Short. Every wire end is a real pin; the netlist was checked before the video went out.

Parts list

  • Arduino Nano
  • FC-51 IR obstacle sensor module (OUT goes LOW when something is in front of it)
  • Soil-moisture fork with its LM393 comparator board (the board's DO output goes LOW when the fork is wet)
  • SG90 servo (brown = ground, red = 5 V, orange = signal)
  • 5 V 2 A supply
  • A tray, two bins, and a bottle and a peel to test with

Wiring, step by step

  1. IR sensor OUT to Nano D2.
  2. Sensor board DO to Nano D3. Its AO pin is not used.
  3. Servo signal (orange) to Nano D9.
  4. The fork's two pins to the board's two input pins, either way round.
  5. Supply plus to the Nano 5V pin, the IR sensor's VCC, the board's VCC and the servo's red wire. Supply minus to every GND.
  6. Follow the pin print on your own sensor boards; the pin order of the board in the Short is not confirmed from a primary source.

How it works

  1. When something lands on the tray the IR sensor's OUT goes LOW, and the Nano sees D2 go LOW.
  2. The tray is the probe. A damp peel across the fork's two prongs conducts, the board's comparator trips and pulls DO LOW. A dry bottle does not conduct and DO stays HIGH.
  3. The sketch waits 0.3 s, reads D3, then turns the servo to 125 degrees for wet or 55 degrees for dry. After 0.7 s it returns the tray to level (90 degrees) and waits 0.4 s before the next item.
  4. In the circuit the damp peel is taken as about 5 kohm, which puts the probe pin near 1.67 V against the board's 2.5 V trip point. A dry bottle leaves it at 5 V. Both input levels and the board's 3.3 mA output sink are inside the parts' limits.
  5. The whole thing draws about 0.73 A at worst, with the servo stalled, of the 2 A supply.

The code: waste_separator.ino

The Arduino code for this circuit is in the Wirecora Discord, in the channel #arduino-code (owner’s choice, 14 October 2026: the code lives where you can ask about it). It is a plain .ino file you can download there.

The sketch from the Short's description, which the animation was checked against step by step; it has not been run on a real board yet. It uses the Servo library that comes with the Arduino IDE.

Get the code in #arduino-code

What the video simplifies

  • The electronics are drawn larger than the bins, and the tray is seen from above while the bins are seen from the front.
  • Four items fall every 6 seconds in the Short; a real bin would be fed by hand.
  • The servo is drawn slower than a real SG90.
  • A real fork is about 6 cm long: glue it into a small tray, or run two metal strips along a tray to the board's two input pins, with the fork's head and cable away from what slides off.
  • Set the board's trimmer so that a damp peel reads wet (about 10 kohm or less across the prongs), and set the IR trimmer short, so it sees a bottle on the tray and not the tray's far end.
  • It sorts by surface moisture: a wet bottle or anything metal goes to WET, a dried-out peel goes to DRY.
  • Checked by simulation and datasheets only, not built.

You found this by searching. Here's the whole path.

  1. Read how it works
  2. See it work
  3. Build it
  4. Show it
Next: see it work

Thirty seconds of video shows the circuit doing its job.

Then build it

Everything here runs on 5 V DC. Keep fingers clear of the tipping tray.

Then show it

Built it, or stuck halfway? Post a photo in the Wirecora Discord. Questions get an answer every day.