Harsh Jee
Published

Dust Utilization Segregation & Transmission BIN

A dustbin, which is smart enough to segregate waste based on if material is metallic, non-metallic, dry or wet.

IntermediateFull instructions provided156
Dust Utilization Segregation & Transmission BIN

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×4
Ceramic Capacitive Rain Sensor
Telecontrolli Ceramic Capacitive Rain Sensor
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematics

Code

Arduino code for smart bin

Arduino
#include <Servo.h>
#define ledPin 6
#define sensorPin A1
Servo servo_motor_1;
Servo servo_motor_2;
Servo servo_motor_3;
Servo myServo;
const int trigPin = 11;
const int echoPin = 10;
long duration;
int distance;
int metalpin= A0;
int metval;
int pp;
void setup() {
 // put your setup code here, to run once:
pinMode(trigPin, OUTPUT); 
pinMode(echoPin, INPUT); 
pinMode(metalpin,INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.begin(9600);
servo_motor_1.attach(3);
servo_motor_2.attach(9);
servo_motor_3.attach(8);
myServo.attach(12);
}
void loop() {
 // put your main code here, to run repeatedly:
myServo.write(0);
distance = calculateDistance(); 
 Serial.println(distance);
 delay(500);
 if(distance<=14){ 
 myServo.write(180);
 delay(2000);
 }
 else{
 myServo.write(0);
 delay(200);
 }
 while(distance<=14){
 servo_motor_1.write(90);
 delay(5000);
 metval=analogRead(metalpin);
 Serial.print("metalpin= ");
 Serial.println(metval);
 if (metval>=800){
 servo_motor_1.write(0);
 delay(2000);
 }
 else{
 servo_motor_1.write(180);
 delay(2000);
 }
 pp=readSensor();
 Serial.print("Analog output: ");
 Serial.println(pp);
 delay(500);
 servo_motor_2.write(180);
 delay(5000);
 if (pp>=50){
 servo_motor_3.write(30);
 delay(2000);
 }
 else{
 servo_motor_3.write(150);
delay(2000);
 }
 servo_motor_2.write(0);
 delay(2000);
 servo_motor_2.write(180);
 delay(2000);
 servo_motor_3.write(90);
 delay(2000);
 servo_motor_1.write(90);
 delay(2000);
 myServo.write(0);
 delay(200);
 distance = calculateDistance();
}
}
int readSensor() {
 int sensorValue = analogRead(sensorPin); 
 int outputValue = map(sensorValue, 0, 1023, 255, 0);
 analogWrite(ledPin, outputValue); 
 return outputValue;
}
int calculateDistance(){
  digitalWrite(trigPin, LOW); 
 delayMicroseconds(2);
 digitalWrite(trigPin, HIGH); 
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);
 duration = pulseIn(echoPin, HIGH);
 distance= duration*0.034/2;
 return distance;
}

Credits

Harsh Jee

Harsh Jee

3 projects • 1 follower
Electronics Engineer | super interested in VLSI and semiconductor industry.

Comments