Translate

Arduino Nano Smart Dustbin Using Ultrasonic Sensor & Servo Motor

🧠 Introduction

In this project, we will build an Automatic Smart Dustbin using an ultrasonic sensor and servo motor controlled by an Arduino Nano.

This dustbin opens its lid automatically when a hand is detected near it, making it a hygienic and touch-free solution. It is widely used in smart homes, public places, and is a very popular student project for exhibitions.


🔧 Components Required

  • Arduino Nano
  • Ultrasonic Sensor (HC-SR04)
  • Servo Motor (SG90 or similar)
  • Jumper Wires
  • Breadboard (optional)
  • Dustbin with lid
  • Power Supply (5V / Power Bank)

⚙️ Working Principle

The ultrasonic sensor detects the distance of any object (like a hand) placed near the dustbin.

  • When hand comes close → Distance decreases
  • Arduino detects this change
  • Servo motor rotates → Lid opens
  • After a delay → Servo returns → Lid closes

👉 This creates a fully automatic touch-free dustbin system


🔌 Circuit Diagram

Arduino Nano Pinout Diagram

Pin Diagram Ultrasonic Sensor
Pinout Diagram of SG90 Servo Motor


📌 Connections

Ultrasonic Sensor (HC-SR04)

  • VCC → 5V
  • GND → GND
  • TRIG → D9
  • ECHO → D10

Servo Motor

  • VCC → 5V
  • GND → GND
  • Signal → D6

💻 Arduino Code

#include <Servo.h>

#define trigPin 9
#define echoPin 10

Servo myServo;

long duration;
int distance;

void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

myServo.attach(6); // Servo connected to pin D6
myServo.write(0); // Lid closed position

Serial.begin(9600);
}

void loop() {

// Trigger ultrasonic sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Read echo
duration = pulseIn(echoPin, HIGH);

// Calculate distance
distance = duration * 0.034 / 2;

Serial.print("Distance: ");
Serial.println(distance);

// If hand detected within 20 cm
if (distance < 20) {
myServo.write(90); // Open lid
delay(3000); // Keep open for 3 seconds
myServo.write(0); // Close lid
}

delay(200);
}

🛠️ Step-by-Step Construction

  1. Connect ultrasonic sensor to Arduino Nano
  2. Connect servo motor to pin D6
  3. Upload the code using Arduino IDE
  4. Fix servo motor on dustbin lid
  5. Connect lid to servo horn properly
  6. Power the circuit
  7. Test by placing your hand near the sensor

🎯 Applications

  • Smart homes
  • Hospitals (hygienic waste disposal)
  • Public places
  • School and college projects

✅ Advantages

  • Touch-free operation
  • Improves hygiene
  • Easy to build
  • Low cost
  • Expandable system

🚀 Future Improvements

  • Add IR sensor for better detection
  • Add LCD display
  • Add IoT monitoring (ESP8266)
  • Add voice alert system

📌 Conclusion

The Arduino Smart Dustbin is a practical and innovative project that demonstrates real-world automation using sensors and actuators. It is an excellent project for beginners to learn about ultrasonic sensing and servo motor control

à´¤ുà´Ÿà´•്à´•à´•്à´•ാർക്à´•ാà´¯ി ഇലക്à´Ÿ്à´°ോà´£ിà´•്à´¸് ലളിതമാà´¯ി പഠിà´•്à´•ാം.

Empowering students in Kerala with hands-on technical skills.