0% found this document useful (0 votes)
5 views8 pages

Smart Trash Bin Using Ultrasonic Sensor and Servo Motor

The document describes the development of a Smart Trash Bin that uses an ultrasonic sensor and servo motor controlled by an Arduino Uno to automatically open its lid, promoting hygiene and convenience in waste disposal. It details the components involved, including the HC-SR04 Ultrasonic Sensor, SG90 Servo Motor, and a 9-volt battery, along with a source code for controlling the system. This innovative solution aims to improve waste management practices in various settings by minimizing physical contact with trash bins.

Uploaded by

dleosala617
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views8 pages

Smart Trash Bin Using Ultrasonic Sensor and Servo Motor

The document describes the development of a Smart Trash Bin that uses an ultrasonic sensor and servo motor controlled by an Arduino Uno to automatically open its lid, promoting hygiene and convenience in waste disposal. It details the components involved, including the HC-SR04 Ultrasonic Sensor, SG90 Servo Motor, and a 9-volt battery, along with a source code for controlling the system. This innovative solution aims to improve waste management practices in various settings by minimizing physical contact with trash bins.

Uploaded by

dleosala617
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Smart trash Bin using ultrasonic sensor and servo motor

INTRODUCTION

Waste management remains one of the most persistent challenges in both urban and rural
communities. As population increases and human activities expand, the volume of waste
generated daily also grows, placing greater pressure on households, public spaces, and waste
collection systems. Traditional trash bins require users to manually open the lid, which can lead
to unhygienic contact, the spread of germs, and inconvenience especially in places with heavy
foot traffic. With the advancement of sensor-based automation, smarter and more sanitary
solutions for everyday household tasks have become more accessible.

In response to this need, this study focuses on the development of a Smart Trash Bin that
automatically opens its lid using an ultrasonic sensor and servo motor, controlled by an Arduino
Uno microcontroller. The ultrasonic sensor detects the presence of an object or a person’s hand
within a certain distance, triggering the servo motor to lift the lid without requiring physical
contact. A 9-volt battery serves as its portable power source, enabling the device to operate even
without direct electrical connection. This system not only promotes cleanliness but also enhances
user convenience and reduces the risk of bacterial transmission.

The integration of HC-SR04 Ultrasonic Sensor, SG90 Servo Motor, and Arduino Uno offers an
efficient, low-cost, and adaptable solution that can be implemented in households, schools,
offices, and public facilities. By automating the opening of the trash bin, the project contributes
to improved waste disposal practices and supports modern efforts toward smart home
technologies. Ultimately, the Smart Trash Bin aims to encourage proper waste handling, promote
hygiene, and demonstrate how simple electronic components can be used to innovate practical,
everyday systems.
Arduino Uno

Description:
A microcontroller board used to control the
entire system.
Function:
Processes input from the ultrasonic sensor
and sends output to the servo motor.
Use in the Project:
Serves as the brain of the Smart Trash Bin.

HC-SR04 Ultrasonic Sensor

Description:
A distance-measuring sensor that uses ultrasonic waves.
Function:
Detects the presence of a hand or object.
Use in the Project:
Triggers the automatic opening of the lid.

SG90 Servo Motor

Description:
A micro servo motor capable of 0–180° rotation.
Function:
Moves the lid of the trash bin.
Use in the Project:
Opens and closes the lid based on sensor input.
9V Battery

Description:
Portable power supply.
Function:
Provides electrical power to the circuit.
Use in the Project:
Powers the Arduino and components.

Jumper Wires
Description:
Electrical connector wires.
Function:
Connects all components.
Use in the Project:

Enables communication between Arduino, sensor, and


motor.

Trash Bin

Description:
A plastic waste container used as the main body of the Smart Trash Bin system.

Function:
Serves as the physical structure where the lid, ultrasonic sensor, and servo motor are mounted.

Use in the Project:


Holds the waste and acts as the base enclosure for all electronic components, allowing the
automatic lid system to operate properly.
GS 9V DC Battery Snap Power Cable to Male DC Plug Adapter

Description:
A battery snap connector with a male DC plug.

Function:
Supplies 9V DC power from a battery to electronic
devices.

Use in the Project:


Provides power to the Arduino board to operate the
smart trash bin system.
Source Code for Controlling Smart Trash Bin Using Ultrasonic Sensor and Servo Motor

#include <Servo.h> // Include Servo library to control the servo motor

Servo servo; // Servo object to control trash bin lid

// Pin definitions
const int trigPin = 9; // Ultrasonic sensor trigger pin
const int echoPin = 8; // Ultrasonic sensor echo pin
const int servoPin = 7; // Servo control pin

long duration; // Time for ultrasonic pulse to return


int distance; // Distance in centimeters

void setup() {
[Link](servoPin); // Attach servo to pin
[Link](0); // Initialize lid as closed (0 degrees)

pinMode(trigPin, OUTPUT); // Set trigPin as OUTPUT


pinMode(echoPin, INPUT); // Set echoPin as INPUT
}

void loop() {
// ---- Send ultrasonic trigger pulse ----
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// ---- Read echo pulse ----


duration = pulseIn(echoPin, HIGH); // Measure time for pulse to return
distance = duration * 0.034 / 2; // Convert time to distance (cm)
// ---- Control servo based on distance ----
if (distance > 0 && distance <= 20) { // Object detected within 20 cm
[Link](100); // Open lid (100 degrees)
delay(1500); // Keep lid open for 1.5 seconds
} else {
[Link](0); // Close lid
}

delay(100); // Short delay before next reading


}
Screenshot of Code

You might also like