
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
From our reel · 21 Dec 2026Parts list
Everything you need for the touch-free smart dustbin
Required parts are ticked. Untick anything you already have; the total updates as you go.
Main parts
Power
- Rs 130OptionalPower Plus 9V Battery High Quality Alkaline Battery
For a cable-free science-fair demo (lasts a few hours).
1Rs 130 each
Wiring & mounting
- Rs 130RequiredUSB Cable For Arduino Uno Arduino Mega
Uploads the code, then powers the bin from a phone charger or power bank.
1Rs 130 each - Rs 170Required20cm Pin To Hole Jumper Wire Dupont Line 40 Pin Male To Female Arduino Jumper Wires
Sensor to the Arduino.
1Rs 170 each - Rs 170Required20cm Pin To Pin Jumper Wire Dupont Line 40 Pin Arduino Male To Male Jumper Wire
Servo plug to the Arduino.
1Rs 170 each
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
1The parts

2Science fair coming up?

3Sensor on the front

4Servo on the lid

5Link servo to lid

6Wire it to Arduino

7Upload the code

8Hand detected…

9Lid opens by itself!

10No touching needed

11And closes again

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
| From | To | Note |
|---|---|---|
| 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
#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
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
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
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
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
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.
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
- Arduino Kya Hai? Arduino Meaning in Urdu, Kaunsa Board Lein aur Pehla ProjectArduino kya hai, is se kya ban sakta hai, Uno, Nano ya Mega mein se kaunsa lein, shuru ke parts aur pehla LED blink project: aasaan Roman Urdu mein, Pakistan ki live qeematon ke sath.
- Servo Motor Price in Pakistan: SG90 vs MG90S vs MG996RServo motor prices in Pakistan, the real difference between SG90, MG90S and MG996R, 180° and 360° servos, how to wire and power them with an Arduino, and the mistakes that strip gears.
More projects to build
All projects


















