Creatjet3D-Labsmunazirali4793
Published © GPL3+

Smart Dustbin full tutorial video

In this video you will see how to make smart dustbin at home using arduino.

IntermediateFull instructions provided1,562
Smart Dustbin full tutorial video

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Servo Module (Generic)
×1

Schematics

Smart Dustbin

Smart Dustbin using Arduino full tutorial

Code

Smart Dustbin

C/C++
In this video you will see how to make smart dustbin at home using arduino.Dustbin have been important part of our life. But, the issue we have to deal is its open cap.
#include <Servo.h>
Servo myservo;  
int pos =20;  
const int trigPin = 5;
const int echoPin = 6;
const int led = 13;

long duration;
float distance;

void setup() 
{
  myservo.attach(11);
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT); 
  pinMode(led, OUTPUT);
  myservo.write(pos);
}

void loop() 
{
  //Serial.begin(9600);
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  duration = pulseIn(echoPin, HIGH);
  distance = 0.034*(duration/2);
  //Serial.println(distance);
  if (distance < 40)
  {
    digitalWrite(led,HIGH);
    myservo.write(pos+120);
    delay(1000);
  }
  else 
  {
    digitalWrite(led,LOW);
      myservo.write(pos);
  }
  delay(300);
}

Credits

Creatjet3D-Labs
7 projects • 23 followers
munazirali4793
8 projects • 20 followers

Comments