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

Made by Sci Ranch

About the project

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

Project info



Estimated time:

1 hour


19th July 2018

Items used in this project

Hardware components

Arduino Uno Rev 3 x 1
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 x 1
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 app and online services


Hand tools and fabrication machines

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!


The Schematic


The Code


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...