Skip to content
Free Delivery on Orders Above Rs 999/- Pan-India
Cash on Delivery Available for Orders above Rs.500/- and Upto Rs 3000/-
SAVE more when you BUY more. Upto 30% Off on BULK PURCHASE
GST Invoices for Your Business
Dedicated Technical Support Team
Safely Delivering Genuine Products PAN INDIA
Delivering to
Select Location ▾
Delivering to Select Location
▾

Smart Dustbin Working Model with Arduino (Under ₹800)

Smart Dustbin Working Model with Arduino (Under ₹800)
-
Written By - Robocraze -
📅 Updated on 30 Nov 2026
✨ Summarize with AI
✅ Prompt copied

Summary

A smart dustbin working model opens its lid by itself when a hand comes within 20 cm. You can build one in about two hours, with no soldering, using an Arduino Uno, an HC-SR04 ultrasonic sensor, and an SG90 servo. Parts cost about ₹700 to ₹800. Below are the parts, circuit, copy-paste code, and exhibition tips.

 

A smart dustbin working model opens its lid automatically when a hand comes near. It uses an ultrasonic sensor to measure distance, an Arduino to decide, and a small servo motor to lift the lid. The full build costs under ₹800, takes about two hours, and needs no soldering. Parts, circuit, and code are below.

At a glance


Parts cost

About ₹700 to ₹800

Build time

About 2 hours

Skill level

Beginner, no soldering

Good for

School science exhibitions, Class 6 to 10


How a smart dustbin works

Every smart dustbin working model does three jobs: it senses, decides, and acts. The HC-SR04 ultrasonic sensor sends out a short burst of sound at 40 kHz, too high for us to hear, and listens for the echo. The Arduino times that echo and turns it into a distance. For the full picture of how the sensor does this, read our guide on what an ultrasonic sensor is.

Block diagram of a smart dustbin: HC-SR04 senses, Arduino decides, SG90 servo opens the lid

Sound travels about 343 metres per second, which is 0.0343 cm per microsecond. The pulse goes to the hand and back, so we halve the trip: distance (cm) = echo time (µs) × 0.0343 ÷ 2, which is the same as echo time ÷ 58. When that number drops to 20 cm or less for two readings in a row, the Arduino tells the SG90 servo to lift the lid.

Components and Supplies

Arduino Uno R3 Board compatibleArduino Uno R3 Board compatible

    Arduino Uno R3 Board compatible

    Arduino Uno R3 Compatible Board  The Arduino Uno R3 ATMEGA328P Development Board is more than just a microcontroller board; it's a gateway to endless possibilities in the world of electronics and programming. For hobbyists, students, and makers, it stands out as the best Arduino Uno...
    Rs 378/-
    Rs 378/-
    Rs 699/-
    Save Rs 321/-
    HC-SR04 Ultrasonic Distance Sensor Module – Sensor for Arduino & distance detection -HC SR04 Ultrasonic SensorHC-SR04 Ultrasonic Distance Sensor Module – Sensor for Arduino & distance detection -HC SR04 Ultrasonic Sensor

      HC-SR04 Ultrasonic Distance Sensor Module

      HC-SR04 Ultrasonic Sensor The HC-SR04 Ultrasonic Sensor Module is a popular tool for measuring distance and detecting objects. It’s small, easy to use, and combines everything you need: a transmitter, receiver, and control circuit in one module. It works like a sonar, sending out...
      Rs 75/-
      Rs 75/-
      Rs 124/-
      Save Rs 49/-
      HC-SR04 Ultrasonic Sensor Holder – Durable holder for stable sensor mounting. -Ultrasonic Sensor Arduino -RobocrazeHC-SR04 Ultrasonic Sensor Holder – Durable holder for stable sensor mounting. -Ultrasonic Sensor Arduino -Robocraze

        HC-SR04 Ultrasonic Sensor Holder

        HC-SR04 Ultrasonic Sensor Holder This mounting bracket is made from good-quality Acrylic. It has mounting holes of a diameter of 3.8mm. It is simple, compact, lightweight, and provides more rigidity than most. With this Ultrasonic Sensor Mounting Case Holder, you can attach the HC-SR04 module to...
        Rs 24/-
        Rs 24/-
        Rs 38/-
        Save Rs 14/-
        SG90 Micro Servo Motor (Pack of 25)SG90 Micro Servo Motor (Pack of 25)

        SG90 Micro Servo Motor (Pack of 25)

        SG90 Micro Servo Motor The TowerPro SG90 1.2kg 180 Degree Rotation Servo Motor rotates 90° in each direction making it a 180° servo motor. It is a Digital Servo Motor that receives and processes PWM signals faster and better. It equips sophisticated internal circuitry that...
        Rs 2,224/-
        Rs 2,224/-
        Rs 3,500/-
        Save Rs 1,276/-
        9V Battery Snap (Pack of 5) – For 9V battery connections. -Battery Accessories -Robocraze9V Battery Snap (Pack of 5) – For 9V battery connections. -Battery Accessories -Robocraze

        9V Battery Snap Connector (Pack of 5)

        9V Battery Snap Connector  A 9V Battery connector is used to hold 9V batteries on one side and on the other side, connector wires are plugged into the power supply unit to supply power to the whole circuit. Generally, we operate our robot in...
        Rs 38/-
        Rs 38/-
        Rs 49/-
        Save Rs 11/-
        Male to Male Jumper Wires (20cm) 40pcs – Durable M2M jumper wires for breadboards. Electronic Components - RobocrazeMale to Male Jumper Wires (20cm) 40pcs – Durable M2M jumper wires for breadboards. Electronic Components - Robocraze

          Male to Male Jumper Wires (20cm) 40pcs

          Male to Male Jumper Wires (20cm) 40pcs Build reliable electronic circuits and prototypes with our Male to Male Jumper Wires (20cm, 40pcs). These flexible Dupont jumper wires are designed for quick, solderless connections between breadboards, development boards and electronic components. Each jumper wire features...
          Rs 54/-
          Rs 54/-
          Rs 64/-
          Save Rs 10/-
          400 Tie Points Solderless Breadboard – Medium-sized breadboard for Arduino & projects. Electronic Components - Robocraze400 Tie Points Solderless Breadboard – Medium-sized breadboard for Arduino & projects. Electronic Components - Robocraze

            400 Point Solderless Breadboard (Half Breadboard)

            400 Point Solderless Breadboard (Half Breadboard) Looking for the best breadboard price without compromising on quality? This 400 point breadboard (commonly known as a half breadboard) is perfect for building and testing electronics, especially with Arduino and ESP32 projects. It’s made of strong plastic...
            Rs 39/-
            Rs 39/-
            Rs 69/-
            Save Rs 30/-

            Parts list 

            Everything except the bin and the power bank comes from our store, and the parts come to about ₹700 to ₹800.

            Part

            What it does

            Arduino Uno R3 compatible board

            Reads the sensor and runs the code

            HC-SR04 ultrasonic sensor

            Measures how far the hand is

            HC-SR04 sensor holder

            Keeps the sensor upright and facing forward

            SG90 micro servo

            Lifts and lowers the lid

            9V battery

            Backup power only (main power is a USB power bank)

            9V snap connector (pack of 5)

            Connects the backup battery to VIN

            Male to male jumper wires, 40 pcs

            Makes every connection

            400-point half breadboard

            Shares 5V and GND between parts


            From home: a small bin about 20 to 25 cm tall with a light lid (a shoebox works), an ice-cream stick, a glue gun or double-sided tape, the USB cable for uploading code, and a USB power bank to run the model.


            BUILD IT: SMART DUSTBIN KIT

            Smart dustbin kit parts: Uno R3 board, HC-SR04 sensor and holder, SG90 servo, 9V battery, breadboard, jumper wires

            Every part from the list above, picked to work together out of the box:

             

            Circuit diagram

            The sensor and servo both need 5V, but the Uno has only one 5V pin, so we run 5V and GND to the breadboard rails and share them from there.

            From

            To

            HC-SR04 VCC

            Breadboard +5V rail

            HC-SR04 GND

            Breadboard GND rail

            HC-SR04 Trig

            Uno D11

            HC-SR04 Echo

            Uno D10

            SG90 red wire

            Breadboard +5V rail

            SG90 brown wire

            Breadboard GND rail

            SG90 orange wire

            Uno D9

            Uno 5V and GND

            +5V rail and GND rail

            USB power bank (9V on VIN only as backup)

            Uno USB socket


            Power it from a USB power bank plugged into the Uno's USB socket. A 9V battery on VIN cannot feed the servo for long and will brown out within an hour on exhibition day, so keep it only as a backup. A 4xAA pack also works if it powers the servo alone: move the servo's red wire to the breadboard's second + rail, connect the pack's + there and its – to the GND rail, and keep the Uno on the power bank. Every ground must meet on the GND rail; a missing common ground is the most common reason a servo twitches or refuses to move.

            Arduino code 

            The sketch uses the Servo library that ships with the Arduino IDE, so there is nothing extra to install. Select Arduino Uno under Tools > Board, pick the right port and click Upload. Open the Serial Monitor at 9600 baud to watch the live distance.

             

            
              // Smart Dustbin Working Model - Robocraze
            // HC-SR04 + SG90 servo + Uno R3 compatible board
            
            
            #include 
            
            
            const int TRIG_PIN  = 11;
            const int ECHO_PIN  = 10;
            const int SERVO_PIN = 9;
            
            
            const int OPEN_DISTANCE_CM = 20;      // hand closer than this opens the lid
            const int LID_CLOSED_ANGLE = 0;
            const int LID_OPEN_ANGLE   = 100;     // raise if your lid needs a wider swing
            const unsigned long HOLD_OPEN_MS = 3000;  // lid closes 3 s after the hand leaves
            
            
            Servo lid;
            int nearCount = 0;
            
            
            long readDistanceCm(int trigPin, int echoPin) {
              digitalWrite(trigPin, LOW);
              delayMicroseconds(2);
              digitalWrite(trigPin, HIGH);          // 10 µs pulse starts a measurement
              delayMicroseconds(10);
              digitalWrite(trigPin, LOW);
            
            
              long duration = pulseIn(echoPin, HIGH, 30000UL);  // wait up to 30 ms
              if (duration == 0) return -1;         // no echo, nothing in range
              return duration / 58;                 // round-trip time in µs to cm
            }
            
            
            bool handIsNear() {
              long d = readDistanceCm(TRIG_PIN, ECHO_PIN);
              Serial.print("Distance: ");
              Serial.print(d);
              Serial.println(" cm");
              return (d > 0 && d <= OPEN_DISTANCE_CM);
            }
            
            
            void setup() {
              Serial.begin(9600);
              pinMode(TRIG_PIN, OUTPUT);
              pinMode(ECHO_PIN, INPUT);
              lid.attach(SERVO_PIN);
              lid.write(LID_CLOSED_ANGLE);
              delay(500);
            }
            
            
            void loop() {
              if (handIsNear()) {
                nearCount++;
              } else {
                nearCount = 0;
              }
            
            
              if (nearCount >= 2) {                 // two close readings in a row
                lid.write(LID_OPEN_ANGLE);
                unsigned long lastSeen = millis();
            
            
                while (millis() - lastSeen < HOLD_OPEN_MS) {
                  if (handIsNear()) lastSeen = millis();   // hand still there: keep open
                  delay(60);
                }
            
            
                lid.write(LID_CLOSED_ANGLE);
                delay(500);                         // let the lid settle before re-sensing
                nearCount = 0;
              }
            
            
              delay(60);
            }
            
            Smart dustbin Arduino code flowchart: measure distance, open lid within 20 cm, close after 3 seconds

            We added two small features most versions skip. The lid only opens after two close readings in a row, which stops random echoes from flapping it, and it stays open while your hand is still there. Three settings at the top let you tune it:

            Setting

            Default

            Change it when

            OPEN_DISTANCE_CM

            20

            The lid opens too early or too late

            LID_OPEN_ANGLE

            100

            The lid does not open fully, or swings too far

            HOLD_OPEN_MS

            3000

            You want the lid to stay open longer or shorter


            Step-by-step assembly

            1. Upload the code and test everything on the table first. Wave a hand at the sensor and check that the servo turns.

            2. Fix the servo to the back wall of the bin, just below the hinge, with a glue gun or double-sided tape.

            3. Glue an ice-cream stick to the servo horn and the other end to the underside of the lid, close to the hinge. This stick is what pushes the lid up.

            4. Glue a small cardboard shelf to the front wall, just below the rim, and stick the half breadboard on it.

            5. Clip the sensor into its holder and plug its pins into the breadboard so the two round transducers face forward, not up.

            6. Tape the Uno and power bank to the side wall near the front so the 20 cm jumpers reach both the breadboard and the servo.

            7. Wire everything as per the table above, plug in the power bank and test with your hand at different distances.


            If the lid jams, the stick is usually too far from the hinge. Move it closer and the servo needs less force to lift it.

            Making it better: full-bin alert, solar power

            Full-bin alert. Fix a second HC-SR04 inside the bin just under the rim, facing down, and connect an active buzzer module to D7. When the waste comes within 8 cm of the rim, the buzzer sounds. Add this to the main sketch:

            
            
            
              // Full-bin alert: add above setup() in the main sketch
            const int FILL_TRIG  = 6;   // second HC-SR04, inside the rim, facing down
            const int FILL_ECHO  = 5;
            const int BUZZER_PIN = 7;   // add pinMode(BUZZER_PIN, OUTPUT); in setup()
            const int FULL_CM    = 8;   // waste within 8 cm of the rim = bin is full
            // also add pinMode(FILL_TRIG, OUTPUT); and pinMode(FILL_ECHO, INPUT); in setup()
            
            
            void checkFull() {          // call checkFull(); at the start of loop()
              long fill = readDistanceCm(FILL_TRIG, FILL_ECHO);
              digitalWrite(BUZZER_PIN, (fill > 0 && fill <= FULL_CM) ? HIGH : LOW);
            }
            

            If the buzzer beeps all the time, your module is active-low: swap HIGH and LOW.

            Solar power. A mini epoxy solar panel on the lid is a strong talking point for the green-energy angle. Its output is too small to drive the servo directly, so present it as charging a rechargeable battery through a charging module, not as the main power supply.

            Heavier lid. If you are using a real plastic bin, swap the SG90 for an MG90S metal gear servo. It uses the same wires and the same code.

            MG90S metal gear servo

            MG90S Metal Gear Servo

            For heavier lids. Drop-in swap for the SG90.

            View product →

            Active buzzer module

            Active Buzzer Module

            Sounds the full-bin alert.

            View product →

            Mini epoxy solar panel 70x70 mm

            Mini Epoxy Solar Panel 70x70 mm

            Adds a solar-charging demo.

            View product →


            Explaining it at the exhibition

            Judges often have only a minute or two at each table, so open with one line. Then walk through sense, decide and act using the block diagram.

            • Show the numbers. Keep a laptop running the Serial Monitor so judges can see the distance change as they move their hand.

            • Answer "why ultrasonic?" It measures actual distance and is not affected by colour or room light the way a simple IR sensor can be.

            • Give real uses. Hospitals, kitchens, and public toilets, where touch-free bins cut the spread of germs. It also fits neatly with Swachh Bharat themes.

            • Carry spares. Bring a fully charged power bank, a 9V battery as a last resort, and a printed copy of the circuit diagram.

            Want something different for next year? Browse our sensor-based project ideas for students.

            Ready to build your smart dustbin? 

             Get the smart dustbin parts → 


            More school project kits →

            
            

            Excerpt

            Build a smart dustbin working model with Arduino for under ₹800. Parts list, circuit diagram, copy-paste code, and exhibition tips.

            Frequently Asked Questions

            Which sensor is used in a smart dustbin?

            Most smart dustbins, including this one, use the HC-SR04 ultrasonic sensor. It measures the actual distance to a hand from 2 cm up to a few metres. IR obstacle sensors also work, but they can be fooled by sunlight and dark surfaces.

            How much does a smart dustbin project cost?

            About ₹700 to ₹800 in parts, plus a bin or box and a USB power bank from home. The upgrades in this post add a little more, depending on which ones you pick.

            Can I make it without Arduino?

            Yes, with a fixed circuit such as an IR sensor and a timer IC switching a motor. You cannot easily change the opening distance or hold time, though, and closing the lid needs extra parts. For a first build, the Arduino version is simpler to get right.

            Why is my servo not opening the lid?

            Check four things in order: the orange wire is on D9, every GND meets on the breadboard rail, the power bank is charged (a tired 9V battery is the usual culprit), and the lid is light enough. If the Serial Monitor shows distances above 20 cm when your hand is close, the sensor is facing the wrong way.

            Can I use an Arduino Nano instead of the Uno?

            Yes. The Nano has the same D9, D10, D11, 5V, GND and VIN pins, so the wiring and code stay the same. Select Arduino Nano under Tools > Board before uploading.

            How do I change how close my hand needs to be?

            Change OPEN_DISTANCE_CM at the top of the code and upload again. Values between 10 and 30 cm work well; much more and people walking past will open the lid.

            Prev Post
            Next Post

            Leave a comment

            Please note, comments need to be approved before they are published.

            Thanks for subscribing!

            This email has been registered!

            Shop the look

            Choose Options

            Edit Option
            Back In Stock Notification

            Choose Options

            this is just a warning
            Login
            Shopping Cart
            0 items
            FREE SHIPPING!
            ₹100 OFF
            ₹200 OFF
            ₹999
            ₹2500
            ₹4900
            WhatsApp Chat Chat