Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
sharveshrams
Created December 2, 2022 © GPL3+

waste separator

separate waste

IntermediateProtip17
waste separator

Things used in this project

Hardware components

Inductive Proximity Sensor, Stainless Steel
Inductive Proximity Sensor, Stainless Steel
×1
Arduino UNO
Arduino UNO
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
SparkFun Soil Moisture Sensor (with Screw Terminals)
SparkFun Soil Moisture Sensor (with Screw Terminals)
×1
rain drop sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

fun

Code

code

Arduino
#include <Servo.h>
#include <SoftwareSerial.h>

int sensorPin = A0; 
int sensorValue;  
int touchsensor_value;
int metalsensor;
Servo servo1; //open close servo
Servo servo2; //roatating servo


void setup() {
  //sterting serial
 Serial.begin(9600);
 //connecting serv1 to pin 5
 servo1.attach(5);
 //connecting serv1 to pin 6
 servo2.attach(6);
//setting to home
pinMode(2, INPUT);
//touch sensor 
pinMode(3, INPUT);
 servo1.write(90);
 servo2.write(90);

}

void loop() {
  
 metalsensor = digitalRead(3);
 touchsensor_value =digitalRead(2);
 sensorValue = analogRead(sensorPin); 
 Serial.println("sensor value : ");
 Serial.println(sensorValue);
  Serial.println("touchsensor value : ");
 Serial.println(touchsensor_value);
 
 if (sensorValue<=85 && touchsensor_value==HIGH) {
   //dry waste 
 servo1.write(90); //open
 servo2.write(90);//rotact to 90
 }
 else if(sensorValue>85 && touchsensor_value==HIGH){
 servo1.write(90); //open
 servo2.write(90);//ratact to 180
 }
 else if(metalsensor==HIGH){
    servo1.write(90); //open
    servo2.write(90);//ratact to 180
 }
  else{
    servo1.write(90); //open
    servo2.write(90);//ratact to 180
 }

 
 delay(1000); 
}

Credits

sharveshrams
4 projects • 3 followers
Contact

Comments

Please log in or sign up to comment.