EMERGENCY ALERT SYSTEM USING GSM

 


In this tutorial, we are going to develop an emergency alert for police or relatives or to a rescue team.

COMPONENTS USED:

  • ARDUINO UNO
  • GSM SIM 800L
  • PUSH BUTTON
  •  LCD 16 X 2

CODE EXPLANATION:

  • In this method, whenever the push button is pressed, external Interrupt is triggered and calls the alert function.
  •  In alert function “EMERGENCY “string is printed in LCD and the sms_flag as true. 
  •  In void loop function, if condition checks whether the flag is true or false.
  • Once the flag is true it sends the SMS from GSM module.

 







CODE:

#include<LiquidCrystal.h>

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

bool sms_flag = false;

void setup() {

  lcd.begin(16, 2);

  Serial.begin(9600);

  pinMode(2, INPUT);

  lcd.clear();

  lcd.setCursor(2, 0);

  lcd.print("WOMEN SAFETY");

  lcd.setCursor(0, 1);

  lcd.print("ALERT SYSTEM");

  delay(500);

  attachInterrupt(0, alert, RISING);

}

 

void loop() {

  if (sms_flag == true)

  { 

    sms();

  }

  if (sms_flag == false)

  {

    lcd.clear();

    lcd.setCursor(2, 0);

    lcd.print("detecting..");

  }

  delay(200);

}

 

void alert()

{

  lcd.clear();

  lcd.setCursor(2, 0);

  lcd.print("EMERGENCY..");

  sms_flag = true;

}

void sms()

{

  lcd.setCursor(2, 1);

  lcd.print("sending sms..");

  Serial.println("AT+CMGF=1");     

       delay(1000);  

       Serial.println("AT+CMGS=\+91XXXXXXXXXX\"\r");                              

  delay(1000);

  Serial.println("EMERGENCY);

  delay(1000);

  Serial.println((char)26);

  delay(1000);

  lcd.setCursor(2, 1);

  lcd.print("sms sent       ..");

  sms_flag = false;

  }


 

 

Comments