How To Make A "smart" Trash Can | Arduino Tutorial

About the project

In this project, I will teach you how to make a somewhat smart trash can using the Arduino!

Project info

Difficulty: Easy

Platforms: Arduino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Arduino Uno Rev 3 Arduino Uno Rev 3 x 1
Ultrasonic Sensor Ultrasonic Sensor This project is designed for a 3-pin Ultrasonic sensor, but you can always modify it to work with a 4-pin. x 1
Servo Motor Servo Motor x 1
A "Trash Can" A "Trash Can" You can either use a real trash can, or make your own. For example, you could make one out of cardboard or you could 3d print one. x 1

Software apps and online services

Tinkercad Tinkercad
Arduino Arduino

Hand tools and fabrication machines

3d printer 3d printer This is *optional, but if you want to 3d print your trash can, you can do that. x 1


The Video!

How it works:

In this project, there is a two-step system to open the trash can.

  1. When you put your hand or another object above the ultrasonic sensor, the Arduino interprets this information.
  1. The Arduino has the servo motor move 90 degrees and then come back down.

The Ultrasonic Sensor

The ultrasonic sensor has a fairly simple role. It senses the proximity above it and if the proximity is less than 10 cm, the Arduino takes actions and controls the servo motor.

The Servo Motor

Once the Arduino has decided that an object is in range to open the trash can, the Arduino turns the servo motor 90 degrees. This opens the lid of the trash can. Then it closes the lid by turning the servo back to 5 degrees (this works the same as a smaller angle).


This is a simple beginner's project that turns out to be useful! Good luck!

Schematics, diagrams and documents

The Schematic


The Code


Photo of Sci Ranch

Sci Ranch

I make robotics projects and other Arduino-themed videos to try to improve small aspects of the world, one project at a time. My goal is that these projects and this knowledge can help people to solve small problems that need to be solved.


Leave your feedback...