Arduino-Based Smart Waste Segregation System Using Metal, Plastic and Moisture Sensors with Stepper and Servo Control

Arduino Smart Waste Segregation System | MakeMindz Tutorial
🌿 MakeMindz Tutorial

Arduino Smart Waste Segregation System

Automatically classify and sort Metal, Plastic & Wet waste using sensors, a stepper motor, and a servo-controlled gate.

⚙️ Arduino UNO 🔩 Stepper Motor 🤖 Servo Motor 💧 Moisture Sensor 🧲 Proximity Sensor ♻️ Eco Project
🕐
2–3 hrs
Build Time
Intermediate
Difficulty
🗂️
3 Types
Waste Sorted

📋 Project Overview

This project builds an automated waste sorting bin that detects the material type of an object and physically rotates a compartment to the correct bin before dropping the item in. No manual sorting needed — the Arduino does it all.


🔩
Metal

Detected via inductive proximity sensor → Compartment 1

🧴
Plastic

Default fallback (no metal/wet) → Compartment 2

💧
Wet Waste

Rain/moisture sensor >500 → Compartment 0

How It Works — Step by Step

1
Object Placement

An item is placed into the input chamber of the device.

2
Sensor Reading

The Arduino reads the moisture sensor (A0) and proximity sensor (Pin 2) simultaneously.

3
Material Classification

If moisture >500 → wet. If proximity HIGH → metal. Otherwise → plastic.

4
Stepper Motor Rotation

The stepper motor rotates (2048 steps / 3 compartments) to align the correct bin slot.

5
Gate Opens

The servo motor moves from 0° to 90°, opening the drop gate.

6
Reset & Repeat

Servo returns to 0° (gate closes), system waits 2 seconds for the next detection cycle.

🛒 Components Required

🟦
Arduino UNO / NanoMain microcontroller
🧲
Inductive Proximity SensorMetal detection (Digital)
💧
Rain / Moisture SensorWet waste detection (A0)
🌀
28BYJ-48 Stepper Motor+ ULN2003 driver board
⚙️
SG90 Servo MotorGate open/close control
🔋
5V Power SupplyUSB or external adapter
🔌
Jumper Wires + BreadboardFor connections
🗑️
3-Compartment BinPhysical housing (DIY)

📌 Pin Connections

ComponentArduino PinTypeNotes
Rain / Moisture SensorA0Analog InputThreshold: >500 = wet
Inductive Proximity SensorD2Digital InputHIGH = metal detected
Servo Motor SignalD3 (PWM)Digital Output0°=closed, 90°=open
Stepper IN1D8Digital OutputULN2003 driver
Stepper IN2D9Digital OutputULN2003 driver
Stepper IN3D10Digital OutputULN2003 driver
Stepper IN4D11Digital OutputULN2003 driver
All GNDGNDGroundCommon ground
All VCC5VPowerFrom Arduino 5V

🔌 Circuit Diagram

ARDUINO UNO A0 ● D2 ● D3 ● D8 ● D9 ● D10● D11● GND● 5V ● RAIN / MOISTURE SENSOR Analog Output → A0 INDUCTIVE PROX. SENSOR (METAL) Digital Output → D2 SERVO MOTOR SG90 (Gate) PWM Signal → D3 ULN2003 DRIVER IN1 IN2 IN3 IN4 D8 D9 D10 D11 28BYJ-48 STEPPER MOTOR 3 Compartments 2048 steps/rev SORTING COMPARTMENTS 💧 WET Slot 0 🔩 METAL Slot 1 🧴 PLASTIC Slot 2 Serial Monitor (9600 baud) "Metal / Plastic / Wet detected" Arduino Smart Waste Segregation — Circuit Diagram MakeMindz.com
💡
Tip: Connect the stepper motor through the ULN2003 driver board, not directly to Arduino. Direct connection will damage the board.

🧪 Try the Simulation

🔵
Simulate on Tinkercad Free browser-based Arduino + circuit simulator by Autodesk
🟠
Simulate on CirkitDesigner Advanced simulation used in many MakeMindz projects — import the diagram.json below
📁
diagram.json — Download the CirkitDesigner project file below to import the full circuit layout directly.

💻 Arduino Code

waste_segregation.ino
/*
 * Arduino Smart Waste Segregation System
 * MakeMindz.com
 *
 * Sensors  : Rain/Moisture (A0), Inductive Proximity (D2)
 * Actuators: SG90 Servo (D3), 28BYJ-48 Stepper via ULN2003 (D8-D11)
 * Logic    : Wet→slot0 | Metal→slot1 | Plastic→slot2
 */

#include <Servo.h>
#include <Stepper.h>

// ── Pin Definitions ──
const int rainSensorPin      = A0;
const int proximitySensorPin  = 2;
const int servoPin            = 3;
const int stepperIn1          = 8;
const int stepperIn2          = 9;
const int stepperIn3          = 10;
const int stepperIn4          = 11;

// ── Stepper Setup ──
const int stepsPerRevolution = 2048;
Stepper myStepper(stepsPerRevolution, stepperIn1, stepperIn3, stepperIn2, stepperIn4);

// ── Servo Setup ──
Servo myServo;

void setup() {
  Serial.begin(9600);
  pinMode(rainSensorPin,     INPUT);
  pinMode(proximitySensorPin, INPUT);
  myServo.attach(servoPin);
  myServo.write(0);         // Gate closed at start
  myStepper.setSpeed(10);  // 10 RPM
}

void loop() {
  int rainValue      = analogRead(rainSensorPin);
  int proximityValue = digitalRead(proximitySensorPin);

  if (rainValue > 500) {
    Serial.println("Wet material detected");
    rotateCompartment(0);    // Wet waste bin
  } else if (proximityValue == HIGH) {
    Serial.println("Metal detected");
    rotateCompartment(1);    // Metal bin
  } else {
    Serial.println("Plastic detected");
    rotateCompartment(2);    // Plastic bin
  }

  dropMaterial();
  delay(2000);              // Wait 2s before next cycle
}

void rotateCompartment(int compartment) {
  // 3 compartments → 120° apart = stepsPerRevolution / 3
  int steps = compartment * (stepsPerRevolution / 3);
  myStepper.step(steps);
}

void dropMaterial() {
  myServo.write(90);   // Open gate
  delay(1000);         // Wait for item to fall
  myServo.write(0);    // Close gate
}

🛠️ Build Instructions

1
Prepare the Physical Bin

Build or repurpose a cylindrical container divided into 3 equal sections (120° each). Mount the stepper motor at the bottom centre to rotate the tray.

2
Mount the Servo Gate

Attach the SG90 servo to the input opening so it controls a flap/gate. At 0° = closed, at 90° = open so items fall through.

3
Wire the Moisture Sensor

Connect VCC→5V, GND→GND, and the Analog Out pin to Arduino A0. Place the sensor probes at the input chamber.

4
Wire the Proximity Sensor

Connect VCC→5V, GND→GND, signal → D2. Position the sensor so it faces the input zone to detect metal objects.

5
Connect Stepper via ULN2003

Plug stepper's 5-wire connector into the ULN2003 board. Connect IN1→D8, IN2→D9, IN3→D10, IN4→D11. Power ULN2003 from 5V.

6
Install Libraries

In Arduino IDE, both Servo.h and Stepper.h are built-in — no extra installation needed.

7
Upload the Code

Open Arduino IDE, paste the code above, select Arduino UNO as the board, select the correct COM port, and click Upload.

8
Calibrate & Test

Open Serial Monitor at 9600 baud. Place a metal object → should print "Metal detected". Try a wet sponge → "Wet material detected". Adjust the moisture threshold (500) if needed.

Key Features & Applications

Features

  • ✅ Multi-sensor waste classification
  • ✅ Automated rotating compartment
  • ✅ Servo-controlled drop gate
  • ✅ Real-time serial feedback
  • ✅ Modular, expandable design
  • ✅ No external libraries needed

Applications

  • 🗑️ Smart dustbin systems
  • ♻️ Automated recycling units
  • 🏙️ Smart city waste models
  • 🌱 Environmental eng. projects
  • 🤖 Robotics exhibitions
  • 🎓 STEM / college projects

🔗 Related MakeMindz Projects

© 2026 MakeMindz.com — Arduino, IoT & Robotics Tutorials

Built with ❤️ for makers, students & engineers

Comments

try for free