Automatic trash can

Here we have a project which is really very easy to do, we need an Arduino Nano, a servomotor, a DC connector, two IR diodes and two resistors, the programming contains only a few lines, this project is for a beginner level .

It’s an automatic trash can, as soon as you approach it, it opens automatically. Her appearance is rather funny, so she does very well in a child’s room.


Arduino Nano
MG996R Servo Motor
DC socket

You will also need resistors

1x 10Ω

1 x 10K


Download the program to operate the trash can.

*** It is best to program the Arduino Nano before soldering the wires. ***

To be printed

Download the file to print directly.

You can also go directly to Thingiverse for download.



Electronic diagram

Click on the image to enlarge.

Here is the electronic diagram for this project.


It is best to install the resistor and wires before installing the infrared diodes.

Use the clear diode (emitter) and solder the 10 ohm resistor to the positive side of the diode (anode, the longer rod). Solder a wire of about 70mm on the negative side (cathode) and put a heat shrink tube, then another wire of about 24cm at the end of the resistance.

Take the black IR diode (receiver) and solder a wire (ideally red to connect to the 5 volts) on the NEGATIVE side (cathode (even if it’s blizzard to connect on the negative side, you have to do it anyway)). Solder a 10kΩ resistor and a wire of about 24cm on the positive side (anode) of the IR diode, then you will take the other clear IR diode (the one you put the 10Ω resistor) and solder the negative wire at the end of the 10kΩ resistor.

Refer to the electronic diagram and especially do not mix with the resistance of 10Ω and 10kΩ.

Insert the IR diodes in the holes of the cover, then put a little glue.

Install the DC connector. This will be a 5 volt input with at least 2 amps .

Enter the servo wire into the side of the bracket, then install four M3 screws approximately 10mm long.

I used wood screws to fix the servo motor.

Pass the wires through the hole in the cover.

Cut a threaded rod with a length of 80mm with a diameter of 4.5mm.

Install the stem with two lock nuts.

Put glue everywhere to fix the wires.

Fix the wires of the servo motor and the power supply with glue to prevent the wires from being cut.

Click to enlarge

Solder the other wires to the Arduino Nano.

Glue the Arduino Nano inside the cover. Make sure the USB socket is accessible.

When we buy the servo motor, we have some adapter to install on the servo motor, if you don’t have the small part like last picture, then you need to cut the one pointed by arrow.

Install the adapter on the servomotor, then insert the 3D printed calanche, then you have to put an M3 screw of about 8mm, because usually the screw that comes with the servomotor is too short.

If you need to reprogram the Arduino Nano, it is possible that you have errors in the Arduino IDE, so you must desolder the 3.3 volt wire, then reprogram the Arduino Nano, then resolder the wire.

Enjoyed the Article? Share it!