Automated Waste
Segregator Robot
Build a smart dustbin that weighs and measures waste, then automatically sorts it into the right bin — wet, dry, or metal! ♻️🤖
How Does an Automated Waste Segregator Work? 🤔
The Load Cell is a Tiny Weighing Scale!
Just like the scale your mum uses in the kitchen, a load cell measures weight. When you drop trash onto it, tiny strain gauges inside bend ever so slightly — the HX711 amplifier converts that bend into a number Arduino can read. Heavy items (like metal cans) weigh differently than light items (like paper)!
The Ultrasonic Sensor "Sees" Size and Shape
Bats use echolocation to "see" in the dark — they send out sound waves and listen for the echo bouncing back. Our ultrasonic sensor does the same thing! It measures how far away an object is, which helps estimate its size/bulkiness — a crushed can looks different to "echo" than a soft wet peel.
The Servo Motor is a Tiny Robot Arm Gatekeeper
Once Arduino decides which bin the waste belongs to, it tells a servo motor to rotate a sorting flap — like a railway track switch that decides which platform a train goes to! The flap tilts left, right, or stays straight to guide trash into the correct bin.
The Sorting Logic 🧮
Real recyclers use sensors too! Actual recycling plants use a mix of cameras, magnets, infrared, and weight sensors to sort tons of garbage every day. Our project uses the same basic principle — just on a much smaller, kid-friendly scale!
Parts You'll Need 🛒
All available at electronics shops or online stores like Robu.in, Robocraze, or Amazon. Ask a parent or teacher to help you buy them!
What is a Load Cell? It's a metal bar with tiny strain gauges glued onto it. When weight presses down, the bar bends a tiny amount — even less than a hair's width! The HX711 module amplifies this microscopic signal into something Arduino can understand as a clear weight number.
Building the Bin Structure 📦
Prepare a sturdy cardboard box
Use a medium-sized cardboard box (like a shoebox or shipping box) as the outer frame. Cut the top open so waste can be dropped in.
Create 3 internal compartments
Use cardboard dividers to split the inside into 3 sections side by side: Wet (left), Dry (middle), Metal (right). Label each clearly with markers or stickers.
Mount the weighing platform at the top
Attach a small flat tray (like a sturdy plastic lid) onto the load cell, and fix the load cell horizontally just below the drop opening. This is where waste lands first to be weighed.
Build the sorting flap/chute
Cut a piece of stiff cardboard into a flap shape that can swing left-right-center. Attach it to the servo motor's rotating arm just below the weighing platform — gravity does the rest, guiding waste down the correct side!
Mount the ultrasonic sensor above the platform
Fix the HC-SR04 sensor facing straight down, just above the weighing tray, so it can measure how tall/bulky the waste item is as it sits there.
Place Arduino and LCD on the outside
Mount the Arduino Nano, breadboard, and LCD display on the outer wall of the box where they're visible and protected from falling waste.
Keep it dry! This is a model/demo project — use only clean, dry test items (empty plastic bottles, paper balls, empty cans) rather than actual wet food waste, to protect the electronics from moisture.
Circuit Diagram & Wiring
Safety first! Always unplug Arduino from USB before changing any wires. Be gentle with the load cell wires — they're thin and can snap if pulled too hard!
Complete Wiring Table
| # | From | To | Wire | Purpose |
|---|---|---|---|---|
| 1 | Load Cell Red | HX711 E+ | RED | Load cell excitation + |
| 2 | Load Cell Black | HX711 E− | BLACK | Load cell excitation − |
| 3 | Load Cell White | HX711 A− | WHITE | Signal negative |
| 4 | Load Cell Green | HX711 A+ | GREEN | Signal positive |
| 5 | HX711 VCC | Arduino 5V | YELLOW | Power HX711 |
| 6 | HX711 GND | Arduino GND | BLACK | Ground HX711 |
| 7 | HX711 DT | Arduino Pin D2 | PURPLE | Weight data signal |
| 8 | HX711 SCK | Arduino Pin D3 | BLUE | Clock signal |
| 9 | HC-SR04 VCC | Arduino 5V | YELLOW | Power ultrasonic sensor |
| 10 | HC-SR04 Trig | Arduino Pin D4 | ORANGE | Send sound pulse |
| 11 | HC-SR04 Echo | Arduino Pin D5 | YELLOW | Receive echo |
| 12 | HC-SR04 GND | Arduino GND | BLACK | Ground sensor |
| 13 | Servo Signal | Arduino Pin D9 | BLUE | Flap rotation control |
| 14 | Servo VCC | Arduino 5V | ORANGE | Power servo |
| 15 | Servo GND | Arduino GND | BLACK | Ground servo |
| 16 | LCD RS, EN, D4-D7 | Arduino D7,D6,D10-D13 | GREEN | LCD control & data |
| 17 | LCD VSS, RW, K | Arduino GND | BLACK | Ground pins |
| 18 | LCD VDD, A | Arduino 5V | YELLOW | Power pins |
| 19 | Buzzer (+) | Arduino Pin D8 | RED | Sort confirmation beep |
| 20 | Buzzer (−) | Arduino GND | BLACK | Ground buzzer |
Arduino Nano has fewer pins than Uno! If you run out of digital pins, you can reuse A0-A6 as digital pins too (e.g. A0 works just like D14). The code below already accounts for this!
The Arduino Code 💻
Libraries needed: Install "HX711" (by bogde) and "Servo" and "LiquidCrystal" via Arduino IDE → Tools → Manage Libraries. Servo and LiquidCrystal usually come built-in!
// ============================================================= // ♻️ AUTOMATED WASTE SEGREGATOR — Arduino Nano // MakeMindz | Kids Eco-Robotics Project // Load cell weighs waste + ultrasonic measures size → // Servo flap sorts into Wet / Dry / Metal bins! // ============================================================= #include <HX711.h> #include <Servo.h> #include <LiquidCrystal.h> // ── PIN DEFINITIONS ────────────────────────────────────── const int HX711_DT = 2; const int HX711_SCK = 3; const int TRIG_PIN = 4; const int ECHO_PIN = 5; const int SERVO_PIN = 9; const int BUZZER_PIN= 8; // LCD pins: RS, EN, D4, D5, D6, D7 LiquidCrystal lcd(7, 6, 10, 11, 12, 13); HX711 scale; Servo sortServo; // ── SETTINGS — Tune these after calibration! ───────────── const float CALIBRATION_FACTOR = -420.0; // See calibration section! const float WEIGHT_THRESHOLD = 80.0; // grams — wet vs dry/metal const float SIZE_THRESHOLD_CM = 6.0; // cm — large vs small const int FLAP_WET = 30; // Servo angle for WET bin const int FLAP_DRY = 90; // Servo angle for DRY bin (center) const int FLAP_METAL = 150; // Servo angle for METAL bin // ============================================================= // SETUP // ============================================================= void setup() { Serial.begin(9600); Serial.println("♻️ Waste Segregator Starting..."); pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT); pinMode(BUZZER_PIN, OUTPUT); sortServo.attach(SERVO_PIN); sortServo.write(FLAP_DRY); // Start centered scale.begin(HX711_DT, HX711_SCK); scale.set_scale(CALIBRATION_FACTOR); scale.tare(); // Reset to 0 with empty platform lcd.begin(16, 2); lcd.print("Waste Segregator"); lcd.setCursor(0, 1); lcd.print("Ready to sort!"); delay(1500); Serial.println("✅ Ready! Drop an item to sort."); } // ============================================================= // LOOP // ============================================================= void loop() { float weight = scale.get_units(5); // Average of 5 readings if (weight < 0) weight = 0; // ── STEP 1: Wait until something is placed (weight detected) ── if (weight > 5.0) { // 5g minimum to avoid noise delay(800); // Let it settle weight = scale.get_units(10); // Re-read more accurately // ── STEP 2: Measure size with ultrasonic sensor ───────────── float distance = measureDistance(); float height = 15.0 - distance; // Sensor mounted 15cm above tray Serial.print("⚖️ Weight: "); Serial.print(weight); Serial.println(" g"); Serial.print("📏 Height: "); Serial.print(height); Serial.println(" cm"); // ── STEP 3: Decide the category ────────────────────────────── String category = classifyWaste(weight, height); Serial.print("🗑️ Category: "); Serial.println(category); // ── STEP 4: Move flap + show on LCD + beep ─────────────────── sortInto(category); showResult(category, weight, height); tone(BUZZER_PIN, 1500, 200); delay(2500); // Let item fall through & show result sortServo.write(FLAP_DRY); // Reset flap to center scale.tare(); // Re-zero for next item lcd.clear(); lcd.print("Ready to sort!"); } } // ============================================================= // HELPER FUNCTIONS // ============================================================= float measureDistance() { digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2); digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10); digitalWrite(TRIG_PIN, LOW); long duration = pulseIn(ECHO_PIN, HIGH); float cm = duration * 0.0343 / 2; return cm; } String classifyWaste(float weight, float height) { if (weight > WEIGHT_THRESHOLD) { return "WET"; // Heavy = likely wet/organic waste } else if (height > SIZE_THRESHOLD_CM) { return "DRY"; // Light + bulky = paper/plastic } else { return "METAL"; // Light + compact = can/foil } } void sortInto(String category) { if (category == "WET") { sortServo.write(FLAP_WET); } else if (category == "DRY") { sortServo.write(FLAP_DRY); } else { sortServo.write(FLAP_METAL); } } void showResult(String category, float weight, float height) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Sorting: "); lcd.print(category); lcd.setCursor(0, 1); lcd.print("Wt:"); lcd.print((int)weight); lcd.print("g Sz:"); lcd.print((int)height); lcd.print("cm"); }
How the Code Works — Step by Step 🧠
Waiting for Waste
The loop constantly checks the load cell's weight reading. Once something heavier than 5 grams is detected (to avoid false triggers from vibration), it knows an item has been dropped in!
Double-Checking the Weight
We wait 800ms for the item to settle, then take a more accurate reading averaged over 10 samples using scale.get_units(10). This smooths out any wobbling.
Measuring Height with Ultrasonic
The measureDistance() function sends a sound pulse and times the echo. Since the sensor is mounted 15cm above the tray, we subtract: height = 15 − distance, giving us how tall the item is.
The Classification Logic
classifyWaste() checks weight first: heavy items → WET. For light items, it checks height: tall/bulky → DRY, short/compact → METAL. Simple if-else rules, just like a flowchart!
Moving the Sorting Flap
sortInto() rotates the servo to one of three angles (30°, 90°, or 150°) — tilting the flap left, center, or right so gravity guides the item into the correct bin below.
Resetting for the Next Item
After 2.5 seconds (enough time for the item to fall through), the flap returns to center and scale.tare() re-zeros the load cell, making it ready for the next piece of waste!
Serial Monitor Output 📺
✅ Ready! Drop an item to sort.
─────────────────────────────────────
⚖️ Weight: 95.40 g
📏 Height: 4.20 cm
🗑️ Category: WET
─────────────────────────────────────
⚖️ Weight: 12.10 g
📏 Height: 8.50 cm
🗑️ Category: DRY
─────────────────────────────────────
⚖️ Weight: 18.60 g
📏 Height: 3.10 cm
🗑️ Category: METAL
Calibrating the Load Cell ⚖️
Don't skip this! Every load cell behaves slightly differently. The CALIBRATION_FACTOR in our code is just a starting guess — you MUST calibrate it with a known weight for accurate results!
Upload a simple calibration sketch
Use the HX711 library's example sketch (File → Examples → HX711 → CalibrationSketch), or temporarily set CALIBRATION_FACTOR = 1.0 and read raw values via Serial Monitor.
Tare with nothing on the platform
Make sure the tray is empty, then call scale.tare(). This sets the "zero" baseline.
Place a known weight (e.g. a 100g coin packet or kitchen scale-verified object)
Read the raw value shown in Serial Monitor. Divide that raw value by your known weight in grams: Calibration Factor = raw_reading ÷ known_weight.
Update the code with your factor
Plug your calculated number into CALIBRATION_FACTOR in the main code (it's often a negative number depending on wiring orientation — that's normal!).
Verify with a second known weight
Test with a different known weight to confirm accuracy. If readings are off by a lot, repeat the calibration — small errors (±2-3g) are totally fine for this project!
Testing Your Waste Segregator 🧪
✅ Pre-Test Checklist
Test with a wet item (e.g. a piece of fruit peel)
Drop it gently on the platform. Watch Serial Monitor and LCD — should classify as WET, flap tilts left, item falls into the wet bin.
Test with dry waste (e.g. a crumpled paper ball)
Should read low weight + larger height → classified DRY, flap stays centered, falls into the dry bin.
Test with metal (e.g. an empty soda can or bottle cap)
Should read low weight + small height → classified METAL, flap tilts right, falls into the metal bin.
Repeat and check accuracy
Try each item type a few times. Adjust WEIGHT_THRESHOLD and SIZE_THRESHOLD_CM if sorting seems consistently wrong for your specific test items.
Troubleshooting Guide 🔧
❓ Weight always reads 0 or negative
Check the 4 load cell wires (Red/Black/White/Green) are correctly connected to HX711's E+/E−/A−/A+. Make sure scale.tare() runs with an empty platform at startup.
❓ Weight readings are very unstable/jumpy
Make sure the load cell is mounted firmly on a flat, sturdy surface — wobbling causes noise. Increase the averaging sample count in get_units(n) from 10 to 15-20 for smoother readings.
❓ Ultrasonic gives wrong distance / always 0
Check Trig and Echo aren't swapped. Make sure nothing is blocking the sensor's view straight down. HC-SR04 needs at least 2cm of clearance to read properly.
❓ Servo jitters or doesn't move to the right angle
Servos can draw a lot of current — power it from a separate 5V supply if your Arduino Nano resets randomly. Check the signal wire is on a PWM-capable pin (D9 works well).
❓ Same item sorted differently each time
Items placed off-center on the tray can give inconsistent height readings. Mark a "drop zone" circle on the tray directly under the ultrasonic sensor to guide consistent placement.
❓ LCD shows nothing or garbled text
Adjust the potentiometer on LCD V0 pin for contrast. Double-check all 6 LCD pins match the code's LiquidCrystal() pin order: RS, EN, D4, D5, D6, D7.

Comments
Post a Comment