Skip to content

COD nationwide · Isb & Rwp delivery Rs 400

akCircuit
BeginnerHome & safety 1 to 2 hours Arduino Uno

Touch-free smart dustbin

Build a touch-free smart dustbin

Wave your hand in front of the bin and the lid opens by itself, then closes a few seconds later. An ultrasonic sensor and a servo on an Arduino: the easiest science-fair winner, and genuinely useful in a kitchen.

Every required part

Rs 2,017

Parts list

11 items

  • Every required part in stock
  • Wiring and code included
  • Cash on delivery
Touch-free smart dustbin: Build a touch-free smart dustbin
From our reel · 21 Dec 2026

Parts list

Everything you need for the touch-free smart dustbin

Every part below is in our catalogue at today's price, so the total is what you pay. Required parts are ticked; optional upgrades are not.

Required parts are ticked. Untick anything you already have; the total updates as you go.

Main parts

Power

Wiring & mounting

Optional upgrades

You also need (most homes have these)

  • A dustbin with a hinged lidA flip-top kitchen bin works best.
  • Ice-cream stick or stiff wireLinks the servo arm to the lid.
  • Phone charger or power bank (USB)Powers it every day.

7 items

Rs 2,017

From our reel

Watch it come together in 12 steps

The reel of this build goes live on 21 Dec 2026, 7 pm. Follow us to watch it:

YouTube Instagram Facebook
  1. Step 1: The parts

    1The parts

  2. Step 2: Science fair coming up?

    2Science fair coming up?

  3. Step 3: Sensor on the front

    3Sensor on the front

  4. Step 4: Servo on the lid

    4Servo on the lid

  5. Step 5: Link servo to lid

    5Link servo to lid

  6. Step 6: Wire it to Arduino

    6Wire it to Arduino

  7. Step 7: Upload the code

    7Upload the code

  8. Step 8: Hand detected…

    8Hand detected…

  9. Step 9: Lid opens by itself!

    9Lid opens by itself!

  10. Step 10: No touching needed

    10No touching needed

  11. Step 11: And closes again

    11And closes again

  12. Step 12: Science fair winner

    12Science fair winner

How it works

What each part does

The HC-SR04 on the front of the bin measures distance about ten times a second. When something comes closer than 20 cm, the Arduino tells the servo to swing its arm up, which pushes the lid open.

The lid stays open for 3 seconds, and longer while your hand is still there. Then the servo swings back and the lid closes.

Wiring

Connect it pin by pin

Switch the power off while you wire, and connect every GND together unless the table says otherwise.
FromToNote
HC-SR04 VCC→ Arduino 5V
HC-SR04 TRIG→ Arduino D7
HC-SR04 ECHO→ Arduino D8
HC-SR04 GND→ Arduino GND
Servo orange (signal)→ Arduino D9
Servo red→ Arduino 5V
Servo brown→ Arduino GND

The code

Ready-to-upload Arduino code

Copy it into the Arduino IDE, change the settings at the top if your build needs it, and upload.
Smart dustbinBoard: Arduino UnoServo (built in)
smart_dustbin.ino
#include <Servo.h>

const int TRIG = 7, ECHO = 8, SERVO_PIN = 9;
const int CLOSED_ANGLE = 0;  // adjust both angles to your lid
const int OPEN_ANGLE = 100;
const int HAND_CM = 20;      // open when a hand is closer than this

Servo lid;

long distanceCm() {
  digitalWrite(TRIG, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG, LOW);
  long us = pulseIn(ECHO, HIGH, 30000);
  if (us == 0) return 400;  // no echo: nothing near
  return us / 58;
}

void setup() {
  pinMode(TRIG, OUTPUT);
  pinMode(ECHO, INPUT);
  lid.attach(SERVO_PIN);
  lid.write(CLOSED_ANGLE);
}

void loop() {
  if (distanceCm() < HAND_CM) {
    lid.write(OPEN_ANGLE);
    delay(3000);                                  // stay open for 3 seconds
    while (distanceCm() < HAND_CM) delay(200);    // hand still there? keep it open
    lid.write(CLOSED_ANGLE);
    delay(1000);
  }
  delay(100);
}

Step by step

Build it

  1. 1

    Test on the table

    Wire the sensor and servo to the Arduino as in the table, upload the code and wave your hand in front of the sensor: the servo arm should swing and come back.

  2. 2

    Fix the sensor

    Stick the HC-SR04 on the front of the bin, just under the lid, facing outwards so it sees your hand and not the bin's contents.

  3. 3

    Fix the servo

    Stick the servo on the back of the bin, near the lid's hinge, with its arm under the lid's edge.

  4. 4

    Link the servo to the lid

    Tape or glue an ice-cream stick to the servo arm so it lifts the lid when it swings. Adjust OPEN_ANGLE and CLOSED_ANGLE until the lid opens fully and rests closed.

  5. 5

    Power it

    Fix the Arduino to the side or back and power it from a phone charger or power bank through the USB cable.

Tips & troubleshooting

  • If the servo buzzes when the lid is closed, lower CLOSED_ANGLE a little: it is pushing against the lid.
  • If the lid is heavy and the servo struggles, choose the MG90S or MG996R option.
  • An MG996R can draw over 2 A, more than the Arduino's 5V pin can give. Power it from a 5 V 2 A adapter: red wire to the adapter's +, and the adapter's − to both the servo's brown wire and the Arduino's GND.
  • Keep the sensor away from the lid's swing, or it will see the lid and keep it open.

Stuck on wiring or code?

Send us a photo of your build on WhatsApp. We are makers too, and we will help you get it working.

Ask on WhatsApp

FAQ

Questions people ask

Can it run on batteries?+

For a demo, yes: the optional 9 V battery and plug run it for a few hours. For daily use, a phone charger or power bank is better.

Does it count as a science-fair project?+

Yes, and it is a favourite: simple to explain (sense, decide, act), useful, and easy to demonstrate to judges.

Can I add a “bin full” warning?+

Add a second HC-SR04 inside the lid looking down at the rubbish, and a buzzer or LED when the distance gets short.

Read next

More projects to build

All projects