Real-Time Waste Level Monitoring
Using IoT-Enabled Smart Bins
Lera Mae C. Amaquin
Department of Electronics Engineering
College of Engineering – Cebu
Technological University (Main Campus)
Cebu City, Philippines
leramaec.amaquin@ctu.edu.ph
I.
INTRODUCTION
Joyce Christel Jane M. Gimpayan
Department of Electronics Engineering
College of Engineering – Cebu
Technological University (Main Campus)
Cebu City, Philippines
joycechristeljanem.gimpayan@ctu.edu.ph
1. Automated Lid Control
Effective waste management is a growing concern in
modern urban environments. Traditional methods of handling
garbage often lead to overflowing bins, unpleasant odor, and
inefficient collection routines. With the increasing emphasis
on sustainability and smart city initiatives, there is a need for
intelligent solutions that can streamline the process of waste
disposal and management.
The system features a fully automated lid mechanism that
responds to the presence of objects or users. When an object
or a person is detected near the bin, the lid opens
automatically, allowing for touchless trash disposal. After a
short delay, the lid closes on its own, ensuring convenience
and hygiene.
This project focuses on designing and implementing a
Smart Trash Bin using an Iot-embedded system. The system is
built around microcontroller-based hardware and integrates a
PIR (Passive Infrared) sensor, an Ultrasonic sensor, and a
WiFi module for connectivity. The PIR sensor detects human
presence or motion near the bin, while the ultrasonic sensor
measures the trash level to determine whether the bin is full.
When a user approaches, the lid opens automatically, offering
a touchless and hygienic way to dispose of trash. Once the bin
reaches its maximum capacity, an LED indicator is activated
to signal that it is full.
An ultrasonic sensor continuously measures the distance
from the sensor to the trash surface inside the bin. This allows
the system to determine the bin’s fill level and assess whether
it is nearing capacity.
The entire system is programmed using the Arduino IDE
and utilises the Blynk Iot platform to facilitate remote
monitoring and control. Through the Blynk mobile
application, users or waste management personnel can receive
real-time updates on the bin’s status, enabling timely and
efficient waste collection.
When the trash reaches the maximum capacity based
on ultrasonic sensor readings, an LED indicator is
automatically turned on. This visual alert notifies users or
maintenance personnel that the bin needs to be emptied.
By automating key functions such as lid control, waste
level detection, and alert generation, this Smart Trash Bin
provides a modern, user-friendly approach to waste disposal. It
not only reduces human contact with waste, enhancing
hygiene, but also supports smarter environmental management
through the use of Internet of Things (IoT) technology.
I.
PROJECT FEATURES
The Smart Trash Bin incorporates several key features
designed to improve user experience, hygiene, and waste
management efficiency:
2. Trash Level Measurement
3. Motion Detection
The system includes a PIR sensor to detect motion or
objects near the lid. This detection acts as a trigger for the lid
mechanism, providing a hands-free experience for the user.
4. LED Full Bin Indicator
5. Iot-Based Real-Time Monitoring
The Smart Bin is integrated with the Blynk Iot platform,
enabling real-time data monitoring and visualisation. Users
can view the current bin status, including trash levels and
sensor activity, through the Blynk mobile app interface.
6. Wireless Connectivity
Powered by the ESP8266 WiFi module, the system
connects seamlessly to the internet, enabling remote
communication with IoT Blynk Cloud. This wireless
communication ensures that data is transmitted efficiently for
centralised waste tracking and management.
II.
FLOWCHART
A. Flow Chart
Following the lid operation, the system measures the trash
level inside the bin using another ultrasonic sensor
(distanceTRASH). If the detected trash level is at or beyond
the full threshold, the system activates an LED as a visual
indicator that the bin is full. If not, the LED remains off.
Simultaneously, the system transmits this data to the Blynk Iot
platform for remote monitoring. Through the platform, the
system continuously evaluates whether the bin is full. If
fullness is confirmed, it sends a notification to the user stating,
"Bin is Full." After this, the system loops back to continue
monitoring and controlling the bin until it is manually stopped.
III.
COMPONENTS DETAILS
1. ESP 8266 Wifi Module
NodeMCU is an Iot module based on the ESP8266
Wi-Fi module. NodeMCU Microcontroller is
open-source and is supported by the Internet of
Things (Iot) platform. This module has CH340g USB
to TTL IC.
Figure 2: ESP 8266 Wifi Module
Figure 1: Smart Trash Bin Model
2. Ultrasonic Sensor
It works by emitting high-frequency sound waves and
then detecting the reflection of those sound waves off
an object in its path. It is used to measure the distance
between the sensor and an object by measuring the
sound waves to bounce back to the sensor. This
information is used to determine the distance of the
object.
The flowchart illustrates the operational logic of a Smart
Trash Bin system designed to automate lid control, detect trash
levels, and provide real-time monitoring through an Iot
platform. The process begins with the initialization of all
components, including sensors, an LED indicator, and the
ESP8266 WiFi module that connects to the Blynk Iot
platform. Once initialized, the system checks whether it is
active. If the system is running, it proceeds to measure the
distance near the lid using a PIR sensor (referred to as
distanceLID). If the detected distance is below a predefined
threshold, indicating the presence of an object or a user’s
hand, the lid automatically opens; otherwise, it remains closed.
Figure 3: Ultrasonic Sensor
3. PIR Motion Sensor
A PIR is a passive infrared sensor used to detect
motion, so a PIR is a passive motion detector that
waits for infrared temperature from body heat to
trigger an activity. In other words, it can sense motion
through temperature changes.
Figure 4: PIR Motion Sensor
6. Blynk Iot Platform
Blynk is a Platform with IOS and Android apps to control
Arduino, Raspberry Pi and the like over the Internet. It’s
a digital dashboard where you can build a graphic
interface for your project by simply dragging and
dropping widgets.
Figure 6: Blynk Iot Platform
4. Light Emitting Diode
The LED functions as a full-bin indicator. When the
ultrasonic sensor detects that the trash level has
reached a critical height (below a set distance
threshold), the system activates the LED to visually
alert users that the bin is full. This simple but
effective alert helps users and maintenance personnel
manage waste more efficiently by signalling when
it’s time to empty the bin.
Figure 5: Light Emitting Diode
5. Servo Motor
The servo motor is responsible for controlling the lid
mechanism of the trash bin. When the system detects
a nearby object using PIR or proximity sensors, the
microcontroller commands the servo to rotate and
open the lid. Once the object is removed or no longer
detected, the servo returns the lid to its closed
position.
Figure 5: MG90 servo motor
IV.
CIRCUIT
Figure 7: Circuit design of the System using Proteus
In this ESP8266-based smart trash can system, several
components are connected to specific GPIO pins of the
NodeMCU (ESP8266) to control the lid and monitor the trash
level. A PIR motion sensor is used to detect motion near the
lid, which triggers it to open. The OUT pin of the PIR sensor
is connected to GPIO5 (D1), allowing the ESP8266 to read the
motion detection status. For trash level monitoring, an
ultrasonic sensor (HC-SR04) is used, where the TRIG pin is
connected to GPIO14 (D5) and the ECHO pin to GPIO12
(D6). This sensor measures the distance from the sensor to the
trash surface, helping determine whether the bin is full. A
servo motor, responsible for opening and closing the lid, is
connected to GPIO4 (D2) and is controlled using PWM
signals. Additionally, an LED indicator is connected to
GPIO13 (D7); it lights up when the trash level is below a
certain threshold (indicating the bin is full). All components
share a common GND, and appropriate power connections
must be made—typically 5V for the ultrasonic sensor and
servo (using external power for the servo is recommended),
and 5V for the PIR sensor, depending on its specification.
V.
3D MODEL SYSTEM
The figure shows a 3D model of a Smart Trash Bin
designed using Tinkercad
components (e.g., a servo and wiring) are also
mounted inside the trash bin.
A. External Structure
The trash bin reassembles a rectangular shape, and the body
appears to be made from a solid material, specifically plastic.
1. Lid
The lid is flat and slightly raised with rounded edges. It has
a dark-colored rim (possibly brown or black), which adds
contrast and might indicate a different material or a removable
cover for maintenance. Also, a red LED is attached to the lid
and serves as a visual status indicator and functions to alert
when the bin is full.
2. Sensor Placement
A PIR Sensor component is mounted on the front of the bin,
which is used to detect proximity for automatic lid opening or
to monitor trash levels.
Figure 9: Internal Structure of the Trash Bin
C. Back Structure of the Trash Bin
3. Labelling:
The front surface of the bin is labelled "SMARTBIN",
identifying
the
function
of
the
system.
Figure 10: Back Structure of the Trash Bin
The ESP8266 module, mounted at the back of the smart
trash bin, enables Wi-Fi connectivity, allowing the system to
send real-time alerts such as a full bin notification to a
connected device or platform for efficient remote monitoring.
VI.
IOT BASED SYSTEM USING BLYNK
A. Installation and Setup
Figure 8: External Structure of the Trash Bin
B. Internal Mechanism
1. Inside the Bin
Inside the lid is an ultrasonic sensor that is securely
mounted facing downward. This sensor is responsible
for measuring the trash level. Other nearby
The smart trash can features remote lid control via the
Blynk IoT platform. A virtual switch is configured in the
Blynk mobile application and mapped to Virtual Pin V4 under
the label Remote IoT Controller. This enables the user to
remotely toggle the lid's position from anywhere with internet
access.
Figure 11: Iot Platform for Smart Trash Can
To set up the Blynk Iot system, we begin by
navigating the Blynk Iot Platform. After installation, we create
a Blynk account using an email address. Once logged in, tap
the “+ New Template” button (if using the Blynk Web
Dashboard) or create a new project (on mobile) by selecting a
template name, hardware type such as ESP8266, and
connection type (Wi-Fi). The system will then generate a
Template ID, Template Name, and an Authentication Token
(Auth Token), which must be copied and inserted into the
Arduino code for the microcontroller.
Next, we add necessary widgets to the dashboard,
such as Gauge level, Labels, LED and assign virtual pins that
match those used in the code. After uploading the code with
the Blynk credentials (SSID, password, and Auth Token) to
the ESP8266 board via the Arduino IDE, power the circuit and
ensure it connects to Wi-Fi. Once connected, the device will
begin sending and receiving data to/from the Blynk cloud
server. It can now monitor sensor data such as trash level and
receive alerts (like a full bin notification) from your
smartphone or the Blynk web dashboard.
When the ON State button is selected, this causes the servo
to rotate the lid to the open position (180°) and logs the event
in the Blynk system. Because of this, the system enters manual
override mode. Conversely, selecting the OFF state button
(Red) triggers the servo to return to its 0o angle, closing the lid
and updates the status display in the app.
While in manual override mode, the system suspends its
automatic, sensor-based lid operations to prioritize remote user
control. This ensures the lid responds exclusively to the user’s
command from the Blynk interface, offering reliable remote
functionality.
VII.
ARDUINO IDE CODE
Here is the form for the system:
#define BLYNK_TEMPLATE_ID "TMPL2nndIqDLj"
#define BLYNK_TEMPLATE_NAME "SMART TRASH CAN"
#define BLYNK_AUTH_TOKEN
"44R3Kelq8iBtIkLMfucyEJIB5Z0K3bgB"
#include <Servo.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// WiFi Credentials
B. IoT (Blynk) Remote Control
char ssid[] = "2nd Floor Wifi";
char pass[] = "PLDTWIFI05232000";
// Pin Definitions
const int trigPin = D5;
const int echoPin = D6;
const int pirPin = D1;
const int servoPin = D2;
const int ledPin = D7;
// Trash thresholds
const int fullThreshold = 6; // Distance in cm for
trash bin considered full
const int emptyThreshold = 13; // Distance in cm
for trash bin considered empty
Servo lidServo;
// Variables
long duration;
Figure 12: a. On state (Left) - Open Lid
b. Off state (right) - Close Lid
int distance;
int trashLevel; // Trash level as a percentage
checkPIR();
String lastStatus = "";
}
bool manualOverride = false; // Track manual
checkDistance();
control state
delay(500);
}
// Servo angle definitions
const int SERVO_CLOSED_ANGLE = 0;
// 0 degrees
void checkPIR() {
for closed position
const int SERVO_OPEN_ANGLE = 180;
int motion = digitalRead(pirPin);
// 180 degrees
if (motion) {
for fully open position
Serial.println("Motion Detected - Opening
Lid");
void setup() {
lidServo.write(SERVO_OPEN_ANGLE); // Open the
Serial.begin(115200);
lid to 180 degrees
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
Blynk.virtualWrite(V3, "Motion Detected");
Blynk.logEvent("lid_opened", "Lid opened due
pinMode(trigPin, OUTPUT);
to motion");
pinMode(echoPin, INPUT);
delay(5000); // Keep the lid open for 5
pinMode(pirPin, INPUT);
seconds
pinMode(ledPin, OUTPUT);
lidServo.write(SERVO_CLOSED_ANGLE); // Close
the lid to 0 degrees
// Initialize servo with explicit pulse width
Blynk.virtualWrite(V3, "No Motion");
for MG90S
}
lidServo.attach(servoPin, 500, 2500); // Custom
}
pulse width for MG90S
lidServo.write(SERVO_CLOSED_ANGLE);
// Lid
closed initially
Blynk.virtualWrite(V4, 0); // Initialize switch
to OFF
void checkDistance() {
// Trigger ultrasonic sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
Serial.println("Smart Trash Bin Initialized with
Blynk");
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
Serial.println("MG90S Servo configured for
180-degree rotation");
// Calculate distance
}
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
BLYNK_WRITE(V4) { // Remote control switch
manualOverride = (param.asInt() == 1);
// Calculate trash level as a percentage
if (manualOverride) {
if (distance <= fullThreshold) {
lidServo.write(SERVO_OPEN_ANGLE); // Open lid
to 180 degrees
trashLevel = 100;
} else if (distance >= emptyThreshold) {
Blynk.virtualWrite(V3, "Opened Remotely");
Blynk.logEvent("lid_remote", "Lid opened via
trashLevel = 0;
} else {
Blynk");
} else {
trashLevel = map(distance, fullThreshold,
emptyThreshold, 100, 0);
lidServo.write(SERVO_CLOSED_ANGLE); // Close
lid to 0 degrees
trashLevel = constrain(trashLevel, 0, 100);
}
Blynk.virtualWrite(V3, "Closed Remotely");
}
}
// Update trash status and LED
String statusText;
if (distance <= fullThreshold && distance > 0) {
void loop() {
Blynk.run();
if (!manualOverride) { // Only check sensors
when not in manual mode
digitalWrite(ledPin, HIGH);
statusText = "FULL";
Blynk.virtualWrite(V1, 100); // Turn LED ON
(Red indicator)
if (lastStatus != "FULL") {
VIII.
RESULTS
Blynk.logEvent("trash_full", "Trash is
FULL");
lastStatus = "FULL";
}
} else if (distance > emptyThreshold) {
digitalWrite(ledPin, LOW);
statusText = "EMPTY";
Blynk.virtualWrite(V1, 0); // Turn LED OFF
if (lastStatus != "EMPTY") {
Blynk.logEvent("trash_emptied", "Trash is
now EMPTY");
lastStatus = "EMPTY";
}
} else {
digitalWrite(ledPin, LOW);
statusText = "PARTIAL";
Blynk.virtualWrite(V1, 0); // Keep LED OFF for
Figure 13: Initial State of the Trash Bin
partial state
if (lastStatus != "PARTIAL") {
lastStatus = "PARTIAL";
}
}
// Debug output
Serial.print("[");
Serial.print(statusText);
Serial.print("] Distance: ");
Serial.print(distance);
Serial.print(" cm | Level: ");
Serial.print(trashLevel);
Serial.println(" %");
// Update Blynk virtual pins
Blynk.virtualWrite(V0, trashLevel); // Trash
level percentage
Blynk.virtualWrite(V2, statusText); // Trash
status
}
Figure 14: Status of the Bin when the Trash Level is Full
The Blynk dashboard for the Smart Trash Can project
provides a real-time monitoring interface that displays
essential data for effective waste management. A gauge
widget at the upper left corner of the interface shows the
current trash level in percentage, which in this case reads
100%, indicating the bin is full. This data is likely sourced
from an ultrasonic sensor that measures the distance from the
sensor to the top of the trash. Accompanying the gauge is an
LED indicator set to turn on red, signalling a warning or alert
status that the bin requires immediate attention. Below this is a
status label clearly stating “FULL,” offering a straightforward
textual confirmation of the bin’s condition. Additionally, a
value display for the PIR (Passive Infrared) sensor shows a
reading of 0, indicating no motion is currently detected near
the trash can. This sensor can be used to trigger features such
as automatic lid opening or usage logging. Overall, the Blynk
interface enhances the Smart Trash Can by providing remote
accessibility, real-time alerts, and user-friendly data
visualization.
IX. DOCUMENTATION
below this threshold—the sensor may not accurately detect the
presence of trash, potentially leading to malfunction or
incorrect readings. Therefore, to ensure reliable operation and
accurate monitoring of trash levels, the height of the trash can
should be optimized to be well above the sensor’s minimum
range, ideally allowing enough vertical space for the sensor to
differentiate between empty and filled states effectively.
REFERENCES
[1] Instructables, “Smart Garbage Monitoring System Using Internet of
Things
(IOT),”
Instructables,
Jun.
25,
2017.
https://www.instructables.com/Smart-Garbage-Monitoring-System-Usi
ng-Internet-of-/
Figure 15: Smart Trash Bin with the IoT (Blynk) Interface
[2] m
rvnsyh, “GitHub - mrvnsyh/smart-trash-iot: Developed a smart trash
bin IoT system using Arduino IDE, ESP8266, sensors, and ThingsBoard
for automated waste management and monitoring.,” GitHub, 2024.
https://github.com/mrvnsyh/smart-trash-iot (accessed Apr. 19, 2025).
[3] “ Servo motor control with ESP8266 Nodemcu #esp8266 #nodemcu
#sritu_hobby
@sritu_hobby,”
www.youtube.com.
https://www.youtube.com/shorts/MJcpsiN-rr8 (accessed Apr. 19, 2025).
[4] T ech Trends Shameer, “Smart Waste Management with ESP8266 and
Blynk IoT | Blynk IoT Projects,” YouTube, Feb. 23, 2024.
https://www.youtube.com/watch?v=SLYmjRiYVcs (accessed Apr. 19,
2025).
CONCLUSION
The development of the Iot-based smart Trash Bin presents a
successful and significant step forward in waste management
through smart technology. By integrating sensors such as PIR
and ultrasonic modules, a servo-controlled lid, and real-time
monitoring via the Blynk IoT platform, the system provides an
innovative and efficient solution to common waste disposal
challenges. The bin’s automated features not only enhance
user convenience and promote sanitary practices by enabling
touchless interaction but also facilitate smarter waste
collection through timely notifications and monitoring. This
project showcases how Internet of Things (Iot) technologies
can be harnessed to build responsive, scalable, and
environmentally conscious systems aligned with smart city
initiatives.
RECOMMENDATION
The researchers have recommended designing the trash
can with a height significantly greater than 2 cm, as the
ultrasonic sensor used in the system has a minimum detection
range of 2 cm. If the trash can is too shallow—close to or
0
You can add this document to your study collection(s)
Sign in Available only to authorized usersYou can add this document to your saved list
Sign in Available only to authorized users(For complaints, use another form )