thekhurapaatimind
Published © GPL3+

Waste Segregator!

A small working project based on ARDUINO which separates Magnetic, Wet and Dry Wastes using few sensors and motors.

BeginnerShowcase (no instructions)10,807
Waste Segregator!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
DC Motor, 12 V
DC Motor, 12 V
×2
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Magnet, Button
Magnet, Button
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Similar Circuit

Code

Code

Arduino
#include <Servo.h>
#include <LiquidCrystal.h>
Servo myservo;  
int pos = 0;  
const int trigPin1 = 9;
const int echoPin1 = 8;
const int trigPin2 = 7;
const int echoPin2 = 6;
const int led = 13;
int sensorPin = A0; 
int sensorValue;  
int limit = 950; 
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
float moisture;
bool wet = false, obs2 = false;

void setup() 
{
  lcd.begin(16, 2);
  lcd.print("Waste Segregator");
  myservo.attach(10);
  pinMode(trigPin1, OUTPUT);
  pinMode(echoPin1, INPUT); 
  pinMode(trigPin2, OUTPUT);
  pinMode(echoPin2, INPUT);
  pinMode(led, OUTPUT);
  myservo.write(pos);
}

// UV Obstacle Sensing Function
bool obstacle(int trigPin, int echoPin, String s1){
  
  //for(int i=0;i<5;i++){
    //UV code
    long duration, distance;
    digitalWrite(trigPin, HIGH);
    delayMicroseconds(1000);
    digitalWrite(trigPin, LOW);
    duration = pulseIn(echoPin, HIGH);
    distance = (duration/2) / 29.1;
    Serial.print(distance);
    Serial.println("CM"+s1);
    delay(10);
    
    if(distance<=12) return true;
    else return false;
  //}
  
}

// Soil Moisture Sensor Code
bool wetSense(){
  
  for(int i = 0; i < 8 ; i++) {
       sensorValue = analogRead(sensorPin); 
       moisture = (100 - (sensorValue/1023.0)*100);
       Serial.println("Analog Value : ");
       Serial.println(sensorValue);
       Serial.println("Moisture : ");
       Serial.print(moisture);
       Serial.println("%");
       if(sensorValue < limit){
          return true;
       }
       delay(500);
  }
  return false;
}

//LCD Display

void printer(String s){

  lcd.setCursor(0, 1);
  lcd.print(s);
  delay(2000);
  
}

void loop() 
{
  Serial.begin(9600);
  printer(" Monitoring... ");
  if(obstacle(trigPin1, echoPin1,"one") == true){

      delay(11500);
      for(int i = 0 ; i < 5 ; i++ ) { 
        obs2 = obstacle(trigPin2, echoPin2,"two");
        delay(200);
        if(obs2 == true) {
          delay(5300);
          wet = (wetSense());
          break;
        }
      }

      if(obs2==true && wet==true){
        
        myservo.write(pos+190);
        printer("   Wet  Waste   ");        
      }
      else if(obs2==true && wet==false){
        myservo.write(pos);       
        printer("   Dry  Waste   ");
        myservo.write(pos);
      }
      else if(obs2==false)
        printer(" Magnetic Waste ");
        
      delay(2000);
  }
  delay(1000);

Credits

thekhurapaatimind

thekhurapaatimind

0 projects • 1 follower

Comments