Introduction: Smart Garbage Can With a Car

This is a smart garbage can with an ultrasonic sensor, a car, and a button, so moves forward when you press it. This project is inspired by https://www.instructables.com/id/DIY-Smart-Dustbin-With-Arduino/

Here are a few parts I made changes:

  • 4 wheels and motor are added
    • When the garbage can is far from you and you want to throw trash, you can activate its wheel without walking over.
  • Mobile charger instead of a battery
    • A mobile charger is more environmentally friendly, and it's easier to control on/off
  • Button added on the car
    • The button allows the car to move forward when you press it, otherwise, the car won't move.

Supplies

For Garbage Can:

  • Arduino Leonardo/ Uno
  • A garbage can
  • Servo motor
  • Ultrasonic sensor

For the Car:

  • 4 Motor 3-12VDC (2 Flats Shaft)
  • LM298 H bridge Module
  • Mobile charger
  • Button
  • 8 Crocodile clips
  • Resistor (for buttons)
  • 4 wheels

Step 1: Cut Holes in the Garbage Can & Place the Ultra Sensor and Servo Motor

  1. Poke two holes of the size of the ultrasonic sensor, and one hole at the bottom for wires to go through.
  2. Place the ultrasonic sensor in the holes.
  3. Stick the servo motor on the opposite side as shown in the picture.
  4. Attack a stick or straw on the servo motor so it pushes open the garbage can as shown above.

Step 2: Place the Motor on the Board

I used crocodile clips instead of welding, both work fine.

Step 3: Wire

The first image is for the car, and the second image is for the garbage can.

(Both Arduino Leonardo and Uno board can be used)

Step 4: Code

Link to the code for Garbage Can: https://create.arduino.cc/editor/hsingyi_chen/60cc8031-2083-4ced-8d83-09b9ab1bed5a/preview

Link to the code for the Car: https://create.arduino.cc/editor/hsingyi_chen/66987130-0590-4fe4-a7ad-cdc051651821/preview

(Make any changes you'd like, such as distance or angle)

Step 5: Wrap Up & Let It Work!

Cover the wires with plastic board or paper board!

How does this work?

  1. Plug the USB cable to your computer
  2. Turn on the mobile charger
  3. Press the button to move the car forward, and stop by letting go the button
  4. Put your hand near the ultrasonic sensor
  5. The garbage can will open automatically!