Automatic Metal and Plastic Waste Segregation System Using Arduino UNO and ESP8266 NodeMCU
The documentation will cover the project from introduction to implementation, including the hardware, working principle, circuit connections, flowcharts, software algorithms, complete Arduino and ESP8266 programs, testing, and future enhancements.
I’ll also include the distinction between metal and plastic sorting, bin-level monitoring, and wireless data communication.
PROJECT DOCUMENTATION
AUTOMATIC METAL AND PLASTIC WASTE SEGREGATION SYSTEM USING ARDUINO UNO AND ESP8266 NODEMCU
Project Category: Embedded Systems, Automation and Internet of Things (IoT)
Main Controller: Arduino UNO
Wireless Communication: ESP8266 NodeMCU
Project Application: Smart Waste Management and Automatic Waste Segregation
TABLE OF CONTENTS
- Abstract
- Introduction
- Problem Statement
- Objectives
- Existing System
- Proposed System
- Project Overview
- Hardware Requirements
- Software Requirements
- Block Diagram
- Circuit and Schematic Connections
- Working Principle
- Detailed Working Explanation
- System Flowcharts
- Hardware Implementation
- Software Implementation
- Arduino UNO Complete Program
- ESP8266 NodeMCU Program
- Data Communication
- Bin Fill-Level Calculation
- Testing and Results
- Advantages
- Applications
- Limitations
- Future Enhancements
- Conclusion
1. ABSTRACT
The Automatic Metal and Plastic Waste Segregation System using Arduino UNO and ESP8266 NodeMCU is an embedded-system-based project designed to automatically separate metal and plastic waste into two different collection bins.
The primary objective of this project is to reduce manual waste segregation and improve waste management through automation.
The system uses an LM393 metal detection sensor to identify metallic waste and an infrared (IR) sensor to detect the presence of non-metallic objects. A servo motor is used as the mechanical sorting mechanism to direct the detected waste into the appropriate collection bin.
Two HC-SR04 ultrasonic sensors are installed in the metal and plastic collection bins to continuously measure the distance between the sensors and the waste surface. Based on the measured distances, the system estimates the fill percentage of each bin.
A buzzer provides an audible warning when the waste level reaches a predefined threshold.
An ESP8266 NodeMCU is connected to the Arduino UNO through serial communication. The Arduino sends the detected waste type and both bin fill percentages to the ESP8266, enabling future integration with an IoT dashboard or cloud monitoring platform.
The proposed system provides an affordable, automated and expandable approach to smart waste management.
2. INTRODUCTION
Waste management is one of the important challenges in modern society. Increasing population, industrial development and consumption of plastic products have resulted in the generation of large quantities of waste.
Metal and plastic are two commonly generated waste materials. These materials require different recycling and processing methods.
In conventional waste collection systems, metal and plastic waste are often mixed together. Separating these materials manually requires additional time, labour and effort.
Automatic waste segregation systems can help address this problem by identifying different waste materials and directing them into separate collection containers.
This project implements an automatic waste segregation mechanism using Arduino UNO, an IR sensor, an LM393 metal detection sensor, a servo motor and ultrasonic sensors.
The ESP8266 NodeMCU provides an interface for future wireless monitoring and IoT-based waste management.
3. PROBLEM STATEMENT
In conventional waste management systems, metal and plastic waste are frequently collected together.
Manual separation of these materials has several disadvantages:
- Requires human effort.
- Consumes additional time.
- May result in incorrect waste classification.
- Makes recycling operations less efficient.
- Does not provide automatic information about dustbin fill levels.
Therefore, an automated system is required to identify metal and plastic waste, separate them into different bins and monitor the available bin capacity.
4. OBJECTIVES
The main objectives of the project are:
- To detect metallic waste using an LM393 metal detection sensor.
- To detect the presence of non-metallic objects using an IR sensor.
- To automatically separate metal and plastic waste using a servo motor.
- To collect metal and plastic waste in separate containers.
- To measure the distance between the waste surface and each ultrasonic sensor.
- To calculate the estimated fill percentage of both collection bins.
- To generate an audible warning using a buzzer when a bin reaches the configured threshold.
- To transmit waste information and bin fill percentages from Arduino UNO to ESP8266 NodeMCU.
- To provide a foundation for future IoT-based waste monitoring.
5. EXISTING SYSTEM
In the existing conventional waste collection system, different waste materials are generally collected together.
The separation of metal and plastic waste is commonly performed manually or through separate industrial processes.
Disadvantages include:
- Manual labour requirements.
- Time-consuming segregation.
- Possibility of incorrect separation.
- Limited real-time monitoring.
- Lack of automatic bin-level alerts.
6. PROPOSED SYSTEM
The proposed system uses sensors, a microcontroller and a servo motor to perform automatic waste segregation.
The system has two main operations.
A. Automatic waste segregation
- The LM393 metal detection sensor checks for metallic material.
- If metal is detected, the servo motor rotates towards the metal collection bin.
- If metal is not detected, the IR sensor identifies the presence of a non-metallic object.
- If the IR sensor detects the object, the servo motor rotates towards the plastic collection bin.
- When the sorting operation is completed, the servo returns to its initial position.
B. Automatic bin monitoring
- One ultrasonic sensor measures the metal bin's fill level.
- Another ultrasonic sensor measures the plastic bin's fill level.
- The Arduino calculates the estimated fill percentage.
- If either bin reaches the configured distance threshold, the buzzer is activated.
- Both readings and the latest waste classification are transmitted to the ESP8266.
7. PROJECT OVERVIEW
The project consists of the following functional modules.
| Module | Function |
|---|---|
| Arduino UNO | Main system controller |
| LM393 metal sensor | Metal detection |
| IR sensor | Object detection |
| Servo motor | Waste sorting |
| Ultrasonic sensor 1 | Metal bin monitoring |
| Ultrasonic sensor 2 | Plastic bin monitoring |
| Buzzer | Bin-level warning |
| ESP8266 NodeMCU | Wireless communication interface |
8. HARDWARE REQUIREMENTS
8.1 Arduino UNO
Arduino UNO is the main controller of the project.
It reads the sensor signals, processes the detection conditions, controls the servo motor, measures the ultrasonic distances and transmits the results to the ESP8266.
8.2 LM393 Metal Detection Sensor
The LM393-based metal detection module is used to identify metallic objects.
The module produces a digital output depending on the detected metal and its sensor configuration.
In this project:
- HIGH = Metal detected.
- LOW = No metal detected.
The sensor output is connected to Arduino digital pin D9.
8.3 IR Sensor
The infrared sensor is used to detect the presence of an object.
It operates using infrared light transmission and reflection.
In this project:
- LOW = Object detected.
- HIGH = No object detected.
The sensor output is connected to Arduino digital pin D7.
The IR sensor is used for identifying the presence of non-metallic waste after the metal sensor check.
8.4 Servo Motor
The servo motor acts as the mechanical sorting mechanism.
It rotates to different angular positions according to the sensor output.
| Condition | Servo position |
|---|---|
| Metal detected | 10° |
| Plastic/non-metal detected | 170° |
| No object | 90° |
The servo signal is connected to Arduino pin D8.
8.5 HC-SR04 Ultrasonic Sensors
Two HC-SR04 ultrasonic sensors are used to monitor the waste levels in the collection bins.
The first ultrasonic sensor measures the metal bin distance.
The second ultrasonic sensor measures the plastic bin distance.
The sensors transmit ultrasonic pulses and measure the time taken for the reflected signal to return.
The Arduino uses this time to calculate the distance.
8.6 Buzzer
The buzzer provides an audible warning when either bin reaches the configured distance threshold.
The buzzer is connected to Arduino pin D6.
In this project, the warning threshold is 15 cm.
8.7 ESP8266 NodeMCU
The ESP8266 NodeMCU is used as the communication module.
It receives data from the Arduino UNO using serial communication.
The transmitted information includes:
- Detected waste type.
- Metal bin fill percentage.
- Plastic bin fill percentage.
The ESP8266 can subsequently transmit this information over Wi-Fi to an IoT dashboard or cloud service.
9. SOFTWARE REQUIREMENTS
| Software | Purpose |
|---|---|
| Arduino IDE | Programming Arduino UNO and ESP8266 |
| Arduino C/C++ | Embedded programming |
| Servo library | Servo motor control |
| SoftwareSerial library | Arduino serial communication |
| ESP8266 board package | Programming NodeMCU |
10. BLOCK DIAGRAM
The following diagram represents the overall project architecture.
WASTE MATERIAL
|
v
+-----------------------+
| METAL SENSOR |
| LM393 |
+-----------------------+
|
v
+-----------------------+
| ARDUINO UNO |
| |
| Waste Classification |
| Sensor Processing |
| Servo Control |
| Distance Calculation |
+-----------------------+
| |
| |
v v
+-----------+ +----------------+
| SERVO | | ULTRASONIC |
| MOTOR | | SENSORS |
+-----------+ +----------------+
| |
+----+----+ |
| | |
v v v
METAL PLASTIC BIN DISTANCES
BIN BIN |
v
+---------+
| BUZZER |
+---------+
ARDUINO UNO
|
| Serial Communication
v
+-------------------+
| ESP8266 NODEMCU |
+-------------------+
|
| Wi-Fi
v
FUTURE IoT DASHBOARD
11. CIRCUIT AND SCHEMATIC CONNECTIONS
11.1 Arduino UNO pin connections
The following connections are used in the final implementation.
| Component | Component pin | Arduino UNO |
|---|---|---|
| IR sensor | OUT | D7 |
| IR sensor | VCC | 5V |
| IR sensor | GND | GND |
| Metal sensor | OUT | D9 |
| Metal sensor | VCC | 5V |
| Metal sensor | GND | GND |
| Servo motor | Signal | D8 |
| Metal ultrasonic | TRIG | D2 |
| Metal ultrasonic | ECHO | D3 |
| Plastic ultrasonic | TRIG | D4 |
| Plastic ultrasonic | ECHO | D5 |
| Buzzer | Positive | D6 |
| Buzzer | Negative | GND |
11.2 ESP8266 NodeMCU connections
| Arduino UNO | ESP8266 NodeMCU |
|---|---|
| D11 (TX) | D5 (RX), through voltage divider |
| GND | GND |
Arduino D10 is configured as the SoftwareSerial receive pin but is unused.
NodeMCU D6 (TX) is unused.
Important voltage protection:
Arduino UNO operates with 5V logic, while ESP8266 GPIO operates with 3.3V logic.
Therefore, a voltage divider must be used between Arduino D11 and NodeMCU D5.
Use:
- 1 kΩ resistor between Arduino D11 and NodeMCU D5.
- 2 kΩ resistor between NodeMCU D5 and GND.
- Connect Arduino GND and NodeMCU GND together.
Do not connect Arduino D11 directly to ESP8266 RX.
11.3 Power supply connections
- Power the Arduino UNO through USB or a suitable regulated supply.
- Power the NodeMCU using USB or a suitable regulated 5V supply through VIN.
- Power the servo using a suitable external regulated 5V supply.
- Connect the external servo supply GND to Arduino GND.
- Ensure all components share a common ground.
Do not power the servo from the Arduino 3.3V output.
11.4 Simplified electrical schematic
ARDUINO UNO
+----------------+
| |
IR OUT -------| D7 |
METAL OUT ----| D9 |
SERVO SIGNAL -| D8 |
METAL TRIG ---| D2 |
METAL ECHO ---| D3 |
PLASTIC TRIG -| D4 |
PLASTIC ECHO -| D5 |
BUZZER + -----| D6 |
| |
| D11 TX |---- 1K ----+---- NODEMCU D5 RX
| | |
+----------------+ 2K
| |
GND---------------------+---- GND
|
ESP8266 NODEMCU
Servo:
External +5V -------- Servo Red
Arduino D8 ---------- Servo Signal
Common GND ---------- Servo GND
The diagram is a simplified connection reference. Follow the pin tables and voltage-divider instructions when assembling the circuit.
12. WORKING PRINCIPLE
The project operates using sensor-based classification and automatic mechanical sorting.
The metal sensor is assigned priority in the sorting program.
When metallic waste is detected, the Arduino commands the servo motor to rotate to 10 degrees.
When metal is not detected, the Arduino checks the IR sensor.
If the IR sensor detects an object, the Arduino classifies it as non-metal/plastic and rotates the servo to 170 degrees.
When the object is removed, the servo returns to 90 degrees.
The two ultrasonic sensors operate continuously to monitor the collection bins.
The Arduino calculates the estimated fill percentages using the measured distances.
When either measured distance becomes equal to or less than 15 cm, the buzzer produces an audible warning.
The Arduino sends the waste type and bin fill percentages to the ESP8266 every second.
13. DETAILED WORKING EXPLANATION
Step 1: System initialization
When the system is powered ON:
- Arduino initializes the input and output pins.
- Servo motor moves to 90 degrees.
- Ultrasonic sensors are initialized.
- Buzzer is turned OFF.
- Serial communication is started at 9600 baud.
- ESP8266 communication is initialized.
The system becomes ready for waste detection.
Step 2: Metal detection
When waste approaches the sorting mechanism, the LM393 sensor checks whether metallic material is present.
If the sensor output becomes HIGH:
- Arduino identifies the waste as metal.
- Waste type is updated to METAL.
- Servo rotates to 10 degrees.
- The waste is directed into the metal bin.
- After the sorting interval, the servo returns to 90 degrees.
Step 3: Plastic detection
If the metal sensor does not detect metal, the Arduino checks the IR sensor.
If the IR sensor output becomes LOW:
- Arduino identifies the object as non-metal/plastic.
- Waste type is updated to NON-METAL.
- Servo rotates to 170 degrees.
- Waste is directed into the plastic bin.
- After the sorting interval, the servo returns to 90 degrees.
This project uses metal versus non-metal classification. The IR sensor detects object presence; it does not independently identify the chemical material as plastic. Other non-metal materials may also be directed to the plastic bin.
Step 4: Object removal
After the sorting operation, the Arduino waits until:
- Metal sensor output becomes LOW.
- IR sensor output becomes HIGH.
The object-processed condition is reset.
The system becomes ready for the next object.
Step 5: Metal bin monitoring
The first ultrasonic sensor is installed above the metal collection bin.
It measures the distance between the sensor and the upper surface of the waste.
The Arduino calculates the estimated fill percentage.
The reading is used to determine whether the bin has reached the warning threshold.
Step 6: Plastic bin monitoring
The second ultrasonic sensor is installed above the plastic collection bin.
It measures the distance between the sensor and the plastic waste surface.
The Arduino calculates the estimated fill percentage independently.
Step 7: Buzzer warning
The buzzer is activated if:
- Metal bin distance is 15 cm or less.
- Plastic bin distance is 15 cm or less.
- Both bin distances are 15 cm or less.
If both distances are greater than 15 cm, the buzzer remains OFF.
Step 8: ESP8266 data transmission
Arduino sends the following information to the ESP8266:
- Waste classification.
- Metal bin fill percentage.
- Plastic bin fill percentage.
The transmission occurs every one second.
14. SYSTEM FLOWCHARTS
14.1 Main waste segregation flowchart
flowchart TD
A([START]) --> B[Initialize Arduino]
B --> C[Initialize Sensors and Servo]
C --> D[Set Servo to 90 Degrees]
D --> E[Read Metal Sensor]
E --> F{Metal Detected?}
F -->|YES| G[Set Waste Type METAL]
G --> H[Servo to 10 Degrees]
F -->|NO| I[Read IR Sensor]
I --> J{Object Detected?}
J -->|YES| K[Set Waste Type NON-METAL]
K --> L[Servo to 170 Degrees]
J -->|NO| M[Wait for Object]
H --> N[Wait for Sorting]
L --> N
N --> O[Servo Returns to 90 Degrees]
O --> P[Wait Until Object Removed]
P --> E
M --> E
14.2 Ultrasonic monitoring flowchart
flowchart TD
A([START]) --> B[Read Metal Bin Ultrasonic Sensor]
B --> C[Read Plastic Bin Ultrasonic Sensor]
C --> D[Calculate Both Bin Fill Percentages]
D --> E{Metal Bin Distance <= 15 cm?}
E -->|YES| H[Activate Buzzer]
E -->|NO| F{Plastic Bin Distance <= 15 cm?}
F -->|YES| H
F -->|NO| G[Turn Buzzer OFF]
H --> I[Display Distances and Fill Percentages]
G --> I
I --> J[Send Data to ESP8266]
J --> B
14.3 ESP8266 communication flowchart
flowchart TD
A([START]) --> B[Arduino Reads Sensor Data]
B --> C[Calculate Bin Fill Percentages]
C --> D[Prepare CSV Data]
D --> E[Transmit Serial Data]
E --> F[ESP8266 Receives Data]
F --> G[Read Complete Data Line]
G --> H[Display Received Data]
H --> I{Wi-Fi Connected?}
I -->|YES| J[Future Cloud or Dashboard Upload]
I -->|NO| K[Continue Local Reception]
J --> B
K --> B
15. HARDWARE IMPLEMENTATION
The physical project can be assembled in the following sequence.
- Mount the Arduino UNO on the project base.
- Install the IR sensor near the waste entry point.
- Position the metal detection sensor near the waste classification area.
- Install the servo motor with the sorting flap or diverter.
- Place the metal bin below the metal sorting direction.
- Place the plastic bin below the plastic sorting direction.
- Mount the first ultrasonic sensor at the top of the metal bin.
- Mount the second ultrasonic sensor at the top of the plastic bin.
- Connect the buzzer.
- Install the ESP8266 NodeMCU.
- Complete the serial communication wiring and voltage divider.
- Check the power supply and common ground connections.
- Upload the programs.
- Test the complete system.
16. SOFTWARE IMPLEMENTATION
The software is divided into two programs.
Program 1: Arduino UNO
Responsible for:
- Reading metal and IR sensors.
- Classifying waste.
- Controlling the servo.
- Measuring bin distances.
- Calculating fill percentages.
- Activating the buzzer.
- Sending information to ESP8266.
Program 2: ESP8266 NodeMCU
Responsible for:
- Receiving serial data from Arduino.
- Extracting the received information.
- Displaying the received information.
- Providing the communication foundation for future Wi-Fi monitoring.
17. ARDUINO UNO COMPLETE PROGRAM
The following is the integrated Arduino program.
#include <Servo.h>
#include <SoftwareSerial.h>
// PIN CONFIGURATION
#define IR_PIN 7
#define METAL_PIN 9
#define SERVO_PIN 8
#define METAL_TRIG 2
#define METAL_ECHO 3
#define PLASTIC_TRIG 4
#define PLASTIC_ECHO 5
#define BUZZER 6
// ESP8266 COMMUNICATION
SoftwareSerial espLink(10, 11);
// SENSOR SETTINGS
#define METAL_DETECTED HIGH
const int detectionDistance = 15;
// SERVO POSITIONS
const int MAIN_POSITION = 90;
const int METAL_POSITION = 10;
const int PLASTIC_POSITION = 170;
// BIN CALIBRATION
const float METAL_BIN_EMPTY_CM = 30.0;
const float METAL_BIN_FULL_CM = 5.0;
const float PLASTIC_BIN_EMPTY_CM = 30.0;
const float PLASTIC_BIN_FULL_CM = 5.0;
// VARIABLES
Servo sortingServo;
bool objectProcessed = false;
bool servoActive = false;
unsigned long servoReturnTime = 0;
unsigned long lastSend = 0;
unsigned long lastPrint = 0;
String wasteType = "NONE";
int metalPercent = 0;
int nonMetalPercent = 0;
float metalDistance = 999;
float plasticDistance = 999;
// ULTRASONIC FUNCTION
float getDistance(int trigPin, int echoPin)
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH, 25000);
if (duration == 0)
{
return 999;
}
return duration * 0.0343 / 2;
}
// FILL PERCENTAGE FUNCTION
int calculateFillPercent(
float distance,
float emptyDistance,
float fullDistance)
{
if (distance >= 999)
{
return 0;
}
float percentage =
((emptyDistance - distance) /
(emptyDistance - fullDistance)) * 100.0;
percentage = constrain(percentage, 0, 100);
return (int)percentage;
}
// WASTE SORTING FUNCTION
void sortWaste(String type, int position)
{
wasteType = type;
objectProcessed = true;
sortingServo.write(position);
servoActive = true;
servoReturnTime = millis() + 2000;
Serial.println("-----------------------------");
Serial.print("WASTE DETECTED: ");
Serial.println(wasteType);
Serial.print("SERVO POSITION: ");
Serial.println(position);
Serial.println("WASTE SORTING IN PROGRESS");
}
// SETUP
void setup()
{
Serial.begin(9600);
espLink.begin(9600);
pinMode(IR_PIN, INPUT_PULLUP);
pinMode(METAL_PIN, INPUT);
pinMode(METAL_TRIG, OUTPUT);
pinMode(METAL_ECHO, INPUT);
pinMode(PLASTIC_TRIG, OUTPUT);
pinMode(PLASTIC_ECHO, INPUT);
pinMode(BUZZER, OUTPUT);
sortingServo.attach(SERVO_PIN);
sortingServo.write(MAIN_POSITION);
noTone(BUZZER);
Serial.println("=============================");
Serial.println("AUTOMATIC WASTE SEGREGATION");
Serial.println("SYSTEM STARTED");
Serial.println("=============================");
Serial.println("ESP8266 COMMUNICATION READY");
}
// MAIN LOOP
void loop()
{
// READ SENSORS
int metalValue = digitalRead(METAL_PIN);
int irValue = digitalRead(IR_PIN);
// METAL AND PLASTIC SORTING
if (!objectProcessed)
{
// FIRST PRIORITY: METAL
if (metalValue == METAL_DETECTED)
{
sortWaste("METAL", METAL_POSITION);
}
// SECOND PRIORITY: NON-METAL
else if (irValue == LOW)
{
delay(100);
metalValue = digitalRead(METAL_PIN);
irValue = digitalRead(IR_PIN);
if (metalValue == METAL_DETECTED)
{
sortWaste("METAL", METAL_POSITION);
}
else if (irValue == LOW)
{
sortWaste("NON-METAL", PLASTIC_POSITION);
}
}
}
// SERVO RETURN
if (servoActive && millis() >= servoReturnTime)
{
sortingServo.write(MAIN_POSITION);
servoActive = false;
Serial.println("SERVO RETURNED TO 90 DEGREES");
Serial.println("REMOVE OBJECT");
}
// OBJECT REMOVAL RESET
if (!servoActive &&
digitalRead(METAL_PIN) != METAL_DETECTED &&
digitalRead(IR_PIN) == HIGH)
{
if (objectProcessed)
{
objectProcessed = false;
wasteType = "NONE";
Serial.println("OBJECT REMOVED");
Serial.println("SYSTEM READY FOR NEXT OBJECT");
}
}
// METAL BIN DISTANCE
metalDistance = getDistance(
METAL_TRIG,
METAL_ECHO
);
delay(50);
// PLASTIC BIN DISTANCE
plasticDistance = getDistance(
PLASTIC_TRIG,
PLASTIC_ECHO
);
// FILL PERCENTAGE
metalPercent = calculateFillPercent(
metalDistance,
METAL_BIN_EMPTY_CM,
METAL_BIN_FULL_CM
);
nonMetalPercent = calculateFillPercent(
plasticDistance,
PLASTIC_BIN_EMPTY_CM,
PLASTIC_BIN_FULL_CM
);
// BIN WARNING
bool metalBinFull =
(metalDistance <= detectionDistance);
bool plasticBinFull =
(plasticDistance <= detectionDistance);
if (metalBinFull || plasticBinFull)
{
tone(BUZZER, 2000);
}
else
{
noTone(BUZZER);
}
// SEND DATA TO ESP8266
if (millis() - lastSend >= 1000)
{
lastSend = millis();
espLink.print(wasteType);
espLink.print(",");
espLink.print(metalPercent);
espLink.print(",");
espLink.println(nonMetalPercent);
Serial.println("DATA SENT TO ESP8266");
}
// SERIAL MONITOR
if (millis() - lastPrint >= 1000)
{
lastPrint = millis();
Serial.println("=============================");
Serial.print("WASTE TYPE: ");
Serial.println(wasteType);
Serial.print("METAL BIN DISTANCE: ");
Serial.print(metalDistance);
Serial.println(" cm");
Serial.print("METAL BIN FILL: ");
Serial.print(metalPercent);
Serial.println("%");
Serial.print("PLASTIC BIN DISTANCE: ");
Serial.print(plasticDistance);
Serial.println(" cm");
Serial.print("PLASTIC BIN FILL: ");
Serial.print(nonMetalPercent);
Serial.println("%");
if (metalBinFull && plasticBinFull)
{
Serial.println("WARNING: BOTH BINS FULL");
}
else if (metalBinFull)
{
Serial.println("WARNING: METAL BIN FULL");
}
else if (plasticBinFull)
{
Serial.println("WARNING: PLASTIC BIN FULL");
}
else
{
Serial.println("BINS HAVE SPACE");
}
}
}
18. ESP8266 NODEMCU RECEIVER PROGRAM
The following program is uploaded separately to the ESP8266 NodeMCU.
#include <SoftwareSerial.h>
// NodeMCU D5 = RX
// NodeMCU D6 = TX
SoftwareSerial arduinoLink(D5, D6);
String receivedData = "";
void setup()
{
Serial.begin(9600);
arduinoLink.begin(9600);
Serial.println("ESP8266 RECEIVER READY");
}
void loop()
{
while (arduinoLink.available())
{
char c = arduinoLink.read();
if (c == '\n')
{
receivedData.trim();
Serial.print("ARDUINO DATA: ");
Serial.println(receivedData);
receivedData = "";
}
else
{
receivedData += c;
}
}
}
19. DATA COMMUNICATION
The Arduino UNO communicates with the ESP8266 NodeMCU through serial communication using the SoftwareSerial library.
Communication speed: 9600 baud.
Data transmission interval: 1 second.
The data is transmitted in CSV (Comma-Separated Values) format.
Example:
METAL,25,40
NON-METAL,35,50
NONE,20,45
The data format contains three fields:
| Field | Description |
|---|---|
| Field 1 | Waste classification |
| Field 2 | Metal bin fill percentage |
| Field 3 | Plastic bin fill percentage |
The ESP8266 receives these values and can subsequently transmit them through Wi-Fi.
Important: The receiver program currently displays received information on the ESP8266 Serial Monitor. Wi-Fi dashboard or cloud uploading is a separate future integration.
20. BIN FILL-LEVEL CALCULATION
The ultrasonic sensor measures the distance between the sensor and the surface of the waste.
As the waste accumulates, the distance between the sensor and the waste surface decreases.
The estimated fill percentage is calculated using:
Fill Percentage =
((Empty Bin Distance - Current Distance) / (Empty Bin Distance - Full Bin Distance)) × 100
Example calibration:
- Empty bin distance = 30 cm.
- Full bin reference distance = 5 cm.
- Current measured distance = 15 cm.
Calculation:
((30 - 15) / (30 - 5)) × 100
= 60%
Therefore, the estimated bin fill percentage is 60%.
The calibration values in the Arduino program must be adjusted according to the actual bin dimensions and sensor mounting positions.
Buzzer warning threshold: 15 cm.
This threshold is independent of the percentage calculation. With the example calibration, a distance of 15 cm corresponds to approximately 60% fill.
21. TESTING AND RESULTS
The project components are tested individually before final integration.
| Test | Component | Expected result |
|---|---|---|
| 1 | IR sensor | Detects object |
| 2 | Metal sensor | Detects metal |
| 3 | Servo motor | Rotates to 10°, 170° and 90° |
| 4 | Ultrasonic sensor 1 | Measures metal bin distance |
| 5 | Ultrasonic sensor 2 | Measures plastic bin distance |
| 6 | Buzzer | Activates at 15 cm threshold |
| 7 | ESP8266 | Receives serial information |
| 8 | Complete system | Performs automatic segregation and bin monitoring |
Expected sorting results
| Input condition | Expected output |
|---|---|
| Metal detected | Metal bin |
| No metal and IR detects object | Plastic bin |
| No object | Servo at main position |
| Metal bin reaches threshold | Buzzer ON |
| Plastic bin reaches threshold | Buzzer ON |
| Both bins reach threshold | Buzzer ON |
Expected ESP8266 output
ESP8266 RECEIVER READY
ARDUINO DATA: METAL,25,40
ARDUINO DATA: METAL,25,40
ARDUINO DATA: NON-METAL,30,45
ARDUINO DATA: NONE,30,45
22. ADVANTAGES
- Automatic separation of metal and non-metal objects.
- Reduces manual waste segregation.
- Provides separate collection bins.
- Monitors bin fill levels automatically.
- Provides audible bin-level warnings.
- Uses affordable and commonly available components.
- Can be expanded with IoT technology.
- Supports improved waste collection and recycling processes.
23. APPLICATIONS
The proposed system can be applied in:
- Smart waste collection systems.
- Educational institutions.
- Offices and commercial buildings.
- Shopping centres.
- Public waste collection points.
- Small-scale recycling facilities.
- Smart city waste management demonstrations.
24. LIMITATIONS
- The metal sensor detection range depends on its design and calibration.
- The IR sensor identifies object presence, not plastic composition.
- Some non-metallic materials may also be directed into the plastic bin.
- Ultrasonic readings may vary depending on waste shape and surface.
- The sorting mechanism requires correct mechanical positioning.
- ESP8266 communication requires suitable power and logic-level protection.
- The present ESP8266 program receives serial data but does not yet upload it to a cloud platform.
25. FUTURE ENHANCEMENTS
The project can be improved by adding the following features:
1. IoT dashboard
Integrate Blynk IoT or ThingSpeak to monitor waste information remotely.
2. Mobile application
Develop a mobile dashboard displaying:
- Current waste type.
- Metal bin fill percentage.
- Plastic bin fill percentage.
- Bin warning status.
3. Cloud data storage
Store waste classification and bin-level information in an online database.
4. Additional waste classification
Add appropriate sensors or machine-learning-based image classification to identify paper, glass and other materials.
5. Automatic notification
Send notifications when a collection bin reaches its capacity threshold.
6. Data analytics
Maintain daily and monthly waste segregation statistics.
7. Solar power
Integrate solar energy to support low-power operation in outdoor installations.
26. CONCLUSION
The Automatic Metal and Plastic Waste Segregation System using Arduino UNO and ESP8266 NodeMCU demonstrates the application of embedded systems and automation in smart waste management.
The system identifies metallic objects using an LM393 metal detection sensor and identifies the presence of non-metallic objects using an IR sensor.
A servo motor automatically directs the waste into separate metal and plastic collection bins.
Two ultrasonic sensors continuously measure the distance between the waste surface and the top of each collection bin. The measured distances are converted into estimated fill percentages.
A buzzer provides an audible warning when either bin reaches the configured distance threshold.
The ESP8266 NodeMCU receives the waste classification and bin fill percentages from the Arduino UNO through serial communication.
The project provides a practical foundation for developing an IoT-based automatic waste segregation and monitoring system.
FINAL PROJECT OUTCOME
The developed prototype integrates:
- Automatic metal detection.
- Automatic non-metal object detection.
- Servo-based waste segregation.
- Separate metal and plastic collection bins.
- Dual ultrasonic bin monitoring.
- Bin-level buzzer warning.
- Arduino-to-ESP8266 serial communication.
The system demonstrates how low-cost electronic components can be integrated to develop an automated and expandable smart waste management solution.
END OF PROJECT DOCUMENTATION
Additional diagrams and project presentation
The documentation includes three flowcharts and a simplified electrical schematic. For a college submission, I recommend adding these visuals as separate figures:
-
Complete hardware block diagram.
-
Detailed Arduino UNO and NodeMCU circuit schematic.
-
Physical prototype photograph showing the two bins and sorting mechanism.
One important note: The image-generation feature requires you to log in. The connection tables and text schematic above are available now, and the schematic image can be created once you're logged in.
Suggested project report chapters
For a formal college submission, arrange your report in this order:
|
Chapter |
Content |
|---|---|
|
1 |
Introduction and abstract |
|
2 |
Literature review and existing system |
|
3 |
Proposed system and block diagram |
|
4 |
Hardware requirements and circuit design |
|
5 |
Software design and flowcharts |
|
6 |
Program implementation |
|
7 |
Testing and results |
|
8 |
Advantages, limitations and applications |
|
9 |
Conclusion and future scope |
You can use this documentation as the main draft for your project report.

No comments:
Post a Comment