Site icon Circuit Ideas for You

Touchless Dustbin Circuit using Arduino Uno and Ultrasonic Sensor

This is simple and useful mini project for Touchless Dustbin Circuit using Arduino Uno and Ultrasonic Sensor.

It is called smart dustbin or automatic dustbin.

In normal dustbin we have to touch lid by hand which is not hygienic.

In smart dustbin the lid opens automatically when person comes near.

It uses Arduino, ultrasonic sensor and servo motor.

It can be used in home, office, hospital and public places.

Code:

#include <Servo.h>

Servo servoMotor;  
int trigPin = 9;   
int echoPin = 10;  
long duration;     
int distance;      

void setup() {
  servoMotor.attach(6);       // Servo signal pin connected to D6
  pinMode(trigPin, OUTPUT);   // Trig pin of ultrasonic sensor
  pinMode(echoPin, INPUT);    // Echo pin of ultrasonic sensor
  servoMotor.write(0);        // Initial position, lid closed
  delay(1000);
  Serial.begin(9600);         // For debugging
}

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

  // Read echo time
  duration = pulseIn(echoPin, HIGH);

  // Convert time into distance (cm)
  distance = duration * 0.034 / 2;

  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  // Check if object is near (less than 10 cm)
  if (distance < 10) {
    servoMotor.write(90);   // Open lid
    delay(3000);            // Wait for 3 seconds
    servoMotor.write(0);    // Close lid
  }
}

Code Explanation:

Circuit Working:

Parts List:

ComponentQuantity
Arduino UNO1
Servo Motor1
Ultrasonic Sensor 1
9V Battery1

Arduino UNO is the main controller.

This power supply also run servo and sensor.

The ultrasonic sensor sense distance of object.

When hand or any object comes in front of dustbin within set range then Arduino receive signal.

Arduino send command to servo motor.

Servo motor rotates and open the dustbin lid.

After some seconds servo again rotate back and closes the lid.

Power is given by 9V battery.

Pin connections of Ultrasonic sensor, Servo motor and 9V battery:

Ultrasonic sensor has 4 pins.

Servo motor has 3 wires.

9V battery connect to Arduino Vin and GND pin.

Formulas:

Formula for distance = (Echo Time in microsecond × 0.034) / 2

Example: If echo time is 600 microsecond then distance = (600 × 0.034) / 2 = 10.2 cm approx.

If distance < 10 cm then dustbin lid gets open.

Conclusion:

This Touchless Dustbin Circuit using Arduino Uno and Ultrasonic Sensor project is simple and useful.

It is with low cost and automatic and it makes dustbin hygienic.

There is no need to touch lid by hand.

Circuit is good for school, home, office and hospital.

With bigger servo or metal frame we can work for large dustbin also.

References:

Smart Dustbin using Arduino Uno

Exit mobile version