Skip to main content

garbage monitoring using arduino code with gsm

#include <SoftwareSerial.h>

#include <LiquidCrystal.h>

//LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

LiquidCrystal lcd(13, 12, 11, 10, 9, 8);

SoftwareSerial mySerial(0,1);

#define trigPin 2
#define echoPin 3

#define PIR_sensor 4
#define m11 5
#define m12 6

void setup()
{
   lcd.begin(16, 2);
   lcd.print("    Garbage    ");
   Serial.println("garbage ");
  lcd.setCursor(0,1);
  lcd.print("   Open Close    ");
  Serial.println(" open close");
  delay(3000);
  lcd.clear();
  //lcd.print(" ");
  delay(2000);
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
 pinMode(m11, OUTPUT);
  pinMode(m12, OUTPUT);
 

}
void loop()
{
 readPIR();
 pingDist();
 SendMessage();
}


void pingDist ()
  {
   
long duration, distance;
int max = 80; // Let consider as Height of the Garbage Bin is = 80 cm.
float diff, perc;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
diff = max - distance; // 'diff' variable tells u that, how much the Garbage Bin is Left to fill.
perc = (diff/max)*100; // 'perc' variable tells u that, how much percentage the Garbage Bin is filled.

if (perc>=10)
{
 
Serial.println("Garbage Bin is FULL."); // When the Garbage Bin is filled more than 90%, then this Error Message will Displayed.
lcd.print("Garb Bin full.");
lcd.setCursor(2,1);
// Call the Function of Send SMS.
SendMessage(); // Send Message Function Call.
}

else
{
Serial.print("Garbage Bin is Filled ");
lcd.setCursor(0,1);
//lcd.print("Garb Bin filled");
Serial.print(perc);
Serial.print("     %."); // These 3 Lines are print, that how much the Garbage
lcd.setCursor(0,0);
lcd.print("perc:");
lcd.print("    %.");
lcd.setCursor(5, 0);
//Bin is Filled...Ex. "Garbage Bin is Filled 70%.".
}


if (distance >= 200 || distance <= 2)
{
Serial.println("Out of range");
lcd.print("Out of range");
lcd.setCursor(0,1);
}
else
{
Serial.print(distance);
Serial.println(" cm");
//lcd.print("  ");
//lcd.print(" cm");
lcd.setCursor(9,1);
}

delay(500);
}
void SendMessage()
{
mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
//lcd.print("AT+CMGF=1");
//lcd.setCursor(0,1);

delay(1000); // Delay of 1000 milli seconds or 1 second

mySerial.println("AT+CMGS=\"+919003413525\"\r"); // Replace x with mobile number

//lcd.print("AT+CMGS=\"+919003413525\"\r");

lcd.setCursor(0,1);

//delay(1000);

mySerial.println("Garbage Bin is Full."); // The SMS text you want to send
//lcd.print("Garb.BinisFull");

//delay(1000);

mySerial.println((char)26); // ASCII code of CTRL+Z

//delay(1000);

}

void readPIR()
{

 if(digitalRead(PIR_sensor))
  {
    lcd.setCursor(0,0);
    lcd.print("Movement Detected");
    Serial.println("Movement Detected");
    lcd.setCursor(0, 1);
    lcd.print("    Gate Opened    ");
    Serial.println("Gate Opened ");
    digitalWrite(m11, HIGH);         // gate opening
    digitalWrite(m12, LOW);
    delay(1000);
    digitalWrite(m11, LOW);          // gate stop for a while
    digitalWrite(m12, LOW);
    delay(1000);
    lcd.clear();
    lcd.print("   Gate Closed    ");
    digitalWrite(m11, LOW);           // gate closing
    digitalWrite(m12, HIGH);
    delay(1000);
    digitalWrite(m11, LOW);            // gate closed
    digitalWrite(m12, LOW);
    delay(1000);
  }
}

Comments

Popular posts from this blog

A SHOULDER SURFING RESISTANT GRAPHICAL AUTHENTICATION SYSTEM

A SHOULDER SURFING RESISTANT GRAPHICAL AUTHENTICATION SYSTEM ABSTRACT Authentication based on passwords is used largely in applications for computer security and privacy. However, human actions such as choosing bad passwords and inputting passwords in an insecure way are regarded as”the weakest link” in the authentication chain. Rather than arbitrary alphanumeric strings, users tend to choose passwords either short or meaningful for easy memorization. With web applications and mobile apps piling up, people can access these applications anytime and anywhere with various devices. This evolution brings great convenience but also increases the probability of exposing passwords to shoulder surfing attacks. Attackers can observe directly or use external recording devices to collect users’ credentials. To overcome this problem, we proposed a novel authentication system PassMatrix, based on graphical passwords to resist shoulder surfing attacks. With a one-time valid login indicator and ...