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

Android Tutorial

Android  is a complete set of software for mobile devices such as tablet computers, notebooks, smartphones, electronic book readers, set-top boxes etc. It contains a  linux-based Operating System ,  middleware  and  key mobile applications . It can be thought of as a mobile operating system. But it is not limited to mobile only. It is currently used in various devices such as mobiles, tablets, televisions etc. This tutorial is developed for beginners and experienced persons. Let's see the topics of android that we are going to learn. Basics of Android In this fundamental chapter, you will learn about android, its components, how to create first android application, internal of first android application etc. What is Android History and Version Software Stack Core Building Blocks Android Emulator Installing softwares Setup Eclipse Hello Android example Internal Details Dalvik VM AndroidManifest.xml R.java Hide Title Bar Activity and I...

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM

CLOUD WORKFLOW SCHEDULING WITH DEADLINE AND TIME SLOT ALGORITHM Abstract Allocating service capacities in cloud computing is based on the assumption that they are unlimited and can be used at any time. However, available service capacities change with workload and cannot satisfy users’ requests at any time from the cloud provider’s perspective because cloud services can be shared by multiple tasks. Cloud service providers provide available time slots for new user’s requests based on available capacities. In this paper, we consider workflow scheduling with deadline and time slot availability in cloud computing. An iterated heuristic framework is presented for the problem under study which mainly consists of initial solution construction, improvement, and perturbation. Three initial solution construction strategies, two greedy- and fair-based improvement strategies and a perturbation strategy are proposed. Different strategies in the three phases result in several heuristics. ...

ABSTRACT

MULTI USER GSM BASED DIGITAL SCROLLING LED DISPLAY WITH PASSWORD AND VOICE ABSTRACT The project mainly focuses on transmission of textual data through air interface by the use of GSM through asynchronous serial communication. The data will be processed by the microcontroller it programmed by embedded c language by using KEIL C compiler. The data will be displayed on led display on LED only after entering unique pass key. Existing System: How a reliable and an authentic wireless communication could be easily developed between a mobile phone and microcontroller using GSM (Global System for Mobile Communication) MODEM (Modulator-Demodulator). This technical paper explains GSM based e-notice board which can be widely used for multitude of applications including educational sector, traffic control, banks, and public advertisements, stoke exchanges etc. Proposed System: In this project we not only send the data, but send the data with pass code also. Which enables us to preve...