Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
soumya Pillai
Published

Smart Garbage Segregation and Monitoring System through SMS

Automate the daily process of garbage segregation and timely disposal by receiving SMS Alert when dustbin is full!

BeginnerFull instructions provided5,380
Smart Garbage Segregation and Monitoring System through SMS

Things used in this project

Story

Read more

Schematics

Connecting 3 IR sensors, micro servo motor and buzzer to Arduino UNO

Soil moisture sensor interface with Arduino UNO

Interface Arduino UNO with Bolt wifi module and connect Tx Rx pins for serial connection

Schemantic diagram - Connecting 3 IR sensors, micro servo motor and buzzer to Arduino UNO

Code

SMS Alert python program

Python
python program reads serial data received by bolt wifi module sends SMS to user using Twilio SMS API service and boltiot python library. Create a conf.py file to save important credentials.
from boltiot import Bolt,Sms
import conf,json,time

mybolt = Bolt(conf.API_KEY,conf.DEVICE_ID)
sms = Sms(conf.SID,conf.AUTH_TOKEN,conf.TO_NUMBER,conf.FROM_NUMBER)

while True:
    response = mybolt.serialRead('10')
    data = json.loads(response)
    garbage_value = data['value'].rstrip()
    if(garbage_value == 'Dry Bin is Full!'):
        print(garbage_value)
        resp = sms.send_sms('Smart Garbage Alert: '+str(garbage_value))
        print('Response received from Twilio is: '+str(resp))
        print('Status of SMS at Twilio is: '+str(resp.status))
    
    if(garbage_value == 'Wet Bin is Full!'):
        print(garbage_value)
        resp = sms.send_sms('Smart Garbage Alert: '+str(garbage_value))
        print('Response received from Twilio is: '+str(resp))
        print('Status of SMS at Twilio is: '+str(resp.status))

    time.sleep(30)

Smart Garbage Monitoring System

Arduino
Arduino code programs all sensors and motor and the buzzer it sends serial data to bolt wifi module
#include <Servo.h>

#define IRsensorDryBin 11
#define IRsensorWetBin 4
#define TableIRsensor 10 
#define servopin 9
#define moisture A0
#define buzzer 13  
   
// defines variables

int TableIRvalue = 0;
int DryBinIRvalue = 0;
int WetBinIRvalue = 0;
int MoistureValue = 0; 
int pos = 0;    // variable to store the servo position  


Servo myservo;  // create servo object to control a servo

void setup() {
  // put your setup code here, to run once:

 pinMode(IRsensorWetBin, INPUT); 
 pinMode(IRsensorDryBin, INPUT);
 pinMode(TableIRsensor, INPUT);
 pinMode(moisture, INPUT);
 pinMode(buzzer, OUTPUT);
 
 myservo.attach(servopin);  // attaches the servo on pin 9 to the servo object
 Serial.begin(9600); // // Serial Communication is starting with 9600 of baudrate speed
}

void loop() {
  // put your main code here, to run repeatedly:

  myservo.write(90);
  TableIRvalue = digitalRead(TableIRsensor);
  delay(2000);
  
   if(TableIRvalue == 0)
  {
    //Serial.println("Object Detected!");
    MoistureValue = analogRead(moisture);
  // Serial.println(MoistureValue);
    if(MoistureValue > 900)
    {
      //Serial.println("DRY WASTE");
      myservo.write(55);
      delay(3000); 
      myservo.write(90);

     
    }
    else{  
      //Serial.println("WET WASTE");
      myservo.write(110);
      delay(3000);
      myservo.write(90);

     
      }
   }
   
   else{
    //Serial.println("No Object Detected!"); 
      }

       DryBinIRvalue = digitalRead(IRsensorDryBin);
          if(DryBinIRvalue == 1) 
       {
          Serial.println("Dry Bin is Full!");
          digitalWrite(buzzer,HIGH);
          delay(4000);
          digitalWrite(buzzer,LOW);
       }

 WetBinIRvalue = digitalRead(IRsensorWetBin);
        if(WetBinIRvalue == 1)
       {
          Serial.println("Wet Bin is Full!"); 
          digitalWrite(buzzer,HIGH);
          delay(4000);
          digitalWrite(buzzer,LOW);
       }

}

 

Credits

soumya Pillai
1 project • 2 followers
Contact

Comments

Please log in or sign up to comment.