Arduino-Powered Touch-Free Trash Can

by kendapharell in Circuits > Arduino

563 Views, 1 Favorites, 0 Comments

Arduino-Powered Touch-Free Trash Can

Screenshot (982).png

I created an Arduino-powered smart trash can for a hygienic solution. The lid opens automatically using a sensor, eliminating the need for physical contact. This not only adds convenience but also promotes cleanliness by reducing the spread of germs and ensuring a touch-free disposal experience. Follow the straightforward steps to assemble your own hands-free and hygienic trash can. I aim to simplify this instructable, ensuring that it's accessible to everyone. My goal is to make it easy for anyone to understand and build their own project.

Supplies

Screenshot (990).png
Screenshot (991).png
Screenshot (985).png
Screenshot (992).png
Screenshot (993).png
Screenshot (994).png

Supplies :

  1. Arduino board (e.g., Arduino Uno)
  2. Ultrasonic distance sensor (HC-SR04)
  3. Servo motor
  4. Trash can with a lid
  5. Jumper wires
  6. Power source for Arduino (USB cable or battery pack)

Upload the Arduino Code

Screenshot (987).png

First, install the Arduino servo library and then Connect your Arduino board to your computer and Upload the code below


#include <Servo.h>   //servo library
Servo servo;
int trigPin = 5;
int echoPin = 6;
int servoPin = 7;
int led= 10;
long duration, dist, average;
long aver[3]; //array for average


void setup() {
Serial.begin(9600);
servo.attach(servoPin);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
servo.write(0); //close cap on power on
delay(100);
servo.detach();
}

void measure() {
digitalWrite(10,HIGH);
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
digitalWrite(trigPin, HIGH);
delayMicroseconds(15);
digitalWrite(trigPin, LOW);
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);
dist = (duration/2) / 29.1; //obtain distance
}
void loop() {
for (int i=0;i<=2;i++) { //average distance
measure();
aver[i]=dist;
delay(10); //delay between measurements
}
dist=(aver[0]+aver[1]+aver[2])/3;

if ( dist<50 ) {
//Change distance as per your need
servo.attach(servoPin);
delay(1);
servo.write(0);
delay(3000);
servo.write(150);
delay(1000);
servo.detach();
}
Serial.print(dist);
}

Assemble the Circuit Using Tinkercad

Screenshot (978).png


Ultrasonic Sensor:

  1. Connect VCC to Arduino's 5V.
  2. Connect GND to Arduino's GND.
  3. Connect Trig to Digital Pin 5.
  4. Connect Echo to Digital Pin 6.

Servo Motor:

  1. Connect the Yellow Pin to the Digital Pin 7.
  2. Connect Black to Arduino's GND.
  3. Connect Red to Arduino's 5V.

Power Supply:

  • Connect Battery: Positive terminal to Arduino's 5V.
  • Negative terminal to Arduino's GND.

Use the Circuit above I made in Tinkercad as a Guide

Build the Smart Trash Can

How to make Smart Dustbin with Arduino | Arduino Project

Utilize the tutorial video on my channel for step-by-step guidance in assembling the trash can. It will make the process even more straightforward.

Run the Trash Can

Auto trash can

Congratulations on completing your auto trash can! You've just taken a step towards minimizing the spread of germs in your household.