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

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search

Inverted Linear Quadtree: Efficient Top K Spatial Keyword Search ABSTRACT: In this paper, With advances in geo-positioning technologies and geo-location services, there are a rapidly growing amount of spatiotextual objects collected in many applications such as location based services and social networks, in which an object is described by its spatial location and a set of keywords (terms). Consequently, the study of spatial keyword search which explores both location and textual description of the objects has attracted great attention from the commercial organizations and research communities. In the paper, we study two fundamental problems in the spatial keyword queries: top k spatial keyword search (TOPK-SK), and batch top k spatial keyword search (BTOPK-SK). Given a set of spatio-textual objects, a query location and a set of query keywords, the TOPK-SK retrieves the closest k objects each of which contains all keywords in the query. BTOPK-SK is the batch processing of sets...

A simple and reliable touch sensitive security system CODING

#include <REGX51.H> #include "lcd.c" #define MAX_DELAY() delay(65000) sbit Vibra_Sense=P3^1; sbit Buz=P1^0; void intro() {  lcd_init();  lcd_str("Touch Sensitive ",0x80);  lcd_str("Security System ",0xc0);  MAX_DELAY();MAX_DELAY();  lcd_clr();  }  void main()  { unsigned int i = 0, j= 0; intro();    while(1)    { lcd_str("Security Syst On",0x80); lcd_str("No Vibra Detectd",0xc0); Buz = 1; if(Vibra_Sense == 1) { while(Vibra_Sense == 1) delay(1000); } else { while(Vibra_Sense == 0) delay(1000); } Buz = 0; lcd_str("Vibraton Detectd",0xc0);delay(65000); while(1);    }  }

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud

A Time Efficient Approach for Detecting Errors in Big Sensor Data on Cloud Abstract                                                                                                                                                      ...