dikshadwivedi1819
Published © GPL3+

Reverse Vending Machine (RVM)

Designed a machine in which the user can dispose plastic and metal waste and redeem points to collect rewards by scanning the QR code.

ExpertFull instructions provided20,668
Reverse Vending Machine (RVM)

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
×1
NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Inductive Proximity Sensor, 15 mm
Inductive Proximity Sensor, 15 mm
×2
Capacitive Proximity Sensor, 12 mm
Capacitive Proximity Sensor, 12 mm
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×2
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×2
GPS Module (Generic)
×1
Buzzer, Piezo
Buzzer, Piezo
×1
Single Turn Potentiometer- 100k ohms
Single Turn Potentiometer- 100k ohms
×1
Switch Actuator, Head for spring return push-button
Switch Actuator, Head for spring return push-button
×1
5 mm LED: Red
5 mm LED: Red
×2
Jumper wires (generic)
Jumper wires (generic)
×1
Battery, 12 V
Battery, 12 V
×1
9V battery (generic)
9V battery (generic)
×1
Breadboard (generic)
Breadboard (generic)
×2

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk
ThingSpeak API
ThingSpeak API

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Mastech MS8217 Autorange Digital Multimeter
Digilent Mastech MS8217 Autorange Digital Multimeter
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires

Story

Read more

Schematics

Circuit Diagram

Code

Waste Segregation

C/C++
#include <LiquidCrystal.h>

//#include "Arduino.h"
//#include "Button.h"
#include <Servo.h>
LiquidCrystal lcd(1,2,4,5,6,7);
const int knapp = 3;
int ButtonState = 0;         // current state of the button
int oldButtonState = 0;
const int ledPin1 = 10; 
const int ledPin2 = 11; 
const int buzz1 = 12; 
const int buzz2 = 13; 
const int plasticsensor=A0;
int metalsensor= A1;
int metalsensor_M= A2;
Servo myservo;
Servo myservo_M;
int pos = 90;
int pos_M = 360;



void setup() {
  pinMode(knapp, INPUT);
  digitalWrite(knapp, LOW); 
lcd.begin(16,2);
lcd.clear();

 myservo.attach(9);
 myservo_M.attach(8);
   pinMode(plasticsensor,INPUT_PULLUP);
   pinMode(metalsensor,INPUT_PULLUP);
   pinMode(metalsensor_M,INPUT_PULLUP);
   pinMode(ledPin1, OUTPUT);
   pinMode(ledPin2, OUTPUT);
   pinMode(buzz1, OUTPUT);
   pinMode(buzz2, OUTPUT);
  
   Serial.begin(9600);
}

   void loop() {
    lcd.setCursor(0,0);
  lcd.print("INSERT METAL ON");
  lcd.setCursor(0,1);
  lcd.print("   RIGHT SIDE ");
  delay(6000);
  lcd.clear();
  int sensor_read=digitalRead(plasticsensor);
  Serial.println("plastic sensor");
  Serial.println(sensor_read);
  //delay (10);
  int sensor_read_m=digitalRead(metalsensor);
   //Plastic bin
   Serial.println("metal sensor1");
  Serial.println(sensor_read_m);
  //delay (10);
   int sensor_read_mm=digitalRead(metalsensor_M);
   Serial.println(sensor_read_mm);
   //delay (10);

   

  if((sensor_read==1)&&(sensor_read_m!=1)){
   for (pos = 90; pos <=240; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos); 
     // tell servo to go to position in variable 'pos'
    //delay(5);
    digitalWrite(ledPin1, HIGH);
    digitalWrite(buzz1, HIGH);
    
   // waits 15ms for the servo to reach the position
     }
     //delay(5000);
     for (pos = 240; pos >=90; pos -= 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos);
    //delay(5);
      
  }
  }
  else {
      // goes from 180 degrees to 0 degr
   
    myservo.write(pos);
    digitalWrite(ledPin1, LOW);
    digitalWrite(buzz1, LOW);
  }
  
  if((sensor_read_mm==1)&&(sensor_read==0)){
    for (pos_M =360; pos_M >= 50; pos_M -= 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo_M.write(pos_M);   
    
    //delay(5);
    digitalWrite(ledPin2, HIGH);
    digitalWrite(buzz2, HIGH);
    }
    // tell servo to go to position in variable 'pos'
   // delay(5000); 
     for (pos_M = 50; pos_M <=360; pos_M += 1) { // goes from 180 degrees to 0 degrees
    myservo_M.write(pos_M);              // tell servo to go to position in variable 'pos'
    //delay(5);// waits 15ms for the servo to reach the position
     }
  }   
  else{ myservo_M.write(pos_M);
    digitalWrite(ledPin2, LOW);
     digitalWrite(buzz2, LOW);
  }
  
   } 
   

Dustbin level monitoring

C/C++
#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define BLYNK_PRINT Serial 
#define TRIGGER2 5
#define ECHO2    4
WiFiClient  client;


static const int RXPin = 4, TXPin = 5;   // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS
static const uint32_t GPSBaud = 9600;

//if Baud rate 9600 didn't work in your case then use 4800
unsigned long myChannelField = 1067056; // Channel ID
const int ChannelField = 1; // Which channel to write data
const char * myWriteAPIKey = "FMV95MD2A1J7Y8SP"; // Your write A


TinyGPSPlus gps; // The TinyGPS++ object
WidgetMap myMap(V0);  // V0 for virtual pin of Map Widget

SoftwareSerial ss(RXPin, TXPin);  // The serial connection to the GPS device

BlynkTimer timer;
// You should get Auth Token in the Blynk App.

char auth[] = "YVvgHBx9fIM1-yR_2XrGXXkKdIuEmrYL";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "diksha";
char pass[] = "diksha19";

unsigned int move_index = 1;

void setup() {
  
  Serial.begin (115200);
  ss.begin(GPSBaud);
  Blynk.begin(auth, ssid, pass);
// timer.setInterval(5000L, checkGPS);
  
  pinMode(TRIGGER2, OUTPUT);
  pinMode(ECHO2, INPUT);
  pinMode(BUILTIN_LED, OUTPUT);
  WiFi.mode(WIFI_STA);
  
    
  ThingSpeak.begin(client);
}

/*void checkGPS(){
  if (gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
       
  }
}*/
void loop() {

  
    if (WiFi.status() != WL_CONNECTED)
  {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    while (WiFi.status() != WL_CONNECTED)
    {
      WiFi.begin(ssid, pass);
      Serial.print(".");
      delay(100);
    }
    Serial.println("\nConnected.");
  }
   
   
  while (ss.available() > 0) 
    {
      // sketch displays information every time a new sentence is correctly encoded.
      if (gps.encode(ss.read()))
        Serial.println("GPS Connected");//displayInfo();
        { 

  if (gps.location.isValid() ) 
  {
    
    float latitude = (gps.location.lat());     //Storing the Lat. and Lon. 
    float longitude = (gps.location.lng()); 
    
    Serial.print("LAT:  ");
    Serial.println(latitude, 6);  // float to x decimal places
    Serial.print("LONG: ");
    Serial.println(longitude, 6);
    ThingSpeak.setField(3, latitude);
        ThingSpeak.setField(4, longitude);
        ThingSpeak.writeFields(myChannelField, myWriteAPIKey); 
    Blynk.virtualWrite(V1, String(latitude, 6));   
    Blynk.virtualWrite(V2, String(longitude, 6));  
    myMap.location(move_index, latitude, longitude, "GPS_Location");
  }
  }
  }
  
  //long duration1, distance1;
  long duration2, distance2;
  
  digitalWrite(TRIGGER2, LOW); 
   
  delayMicroseconds(2); 
  
 
  digitalWrite(TRIGGER2, HIGH);
  delayMicroseconds(10); 
  
 
  digitalWrite(TRIGGER2, LOW);
  duration2 = pulseIn(ECHO2, HIGH);
  distance2 = (duration2/2) / 29.1;

   

   if (distance2 <= 5) {
   
    Blynk.notify("Please!! empty the dustbin");
}
 Serial.println("2 ultrasonic Centimeter:");
  Serial.println(distance2);
  Blynk.virtualWrite(V6, distance2);
  ThingSpeak.writeField(myChannelField, ChannelField, distance2, myWriteAPIKey);
  delay(100);
  Blynk.run();
  timer.run();
}

  

Credits

dikshadwivedi1819

dikshadwivedi1819

5 projects • 16 followers

Comments