Home
About Us
Achievement
Home
Raspberry-Pi Projects
_Raspberry Pi 4 Complete Guide
Arduino Project
_All Projects
Esp8266 Project
_All Projects
Esp32 Project
_Automation-with-feedback
How To Make GSM Based Fire Alert System
Just Do Electronics
November 20, 2021
Circuit Diagram :-
Code :-
//Prateek //wwww.prateeks.in //https://www.youtube.com/c/JustDoElectronics/videos #include
#include
SoftwareSerial GSM(2, 3); char phone_no[]="+918830584864"; #define sensorPin 6 #define led_sms 3 #define led_call 4 int read_value; int sms_Status, call_Status; int flag=0; int var_1=0, var_2=0; char input_string[15]; void setup(){ Serial.begin(9600); GSM.begin(9600); pinMode(sensorPin, INPUT); pinMode(led_sms,OUTPUT); pinMode(led_call,OUTPUT); Serial.println("Initializing...."); initModule("AT","OK",1000); initModule("ATE1","OK",1000); initModule("AT+CPIN?","READY",1000); initModule("AT+CMGF=1","OK",1000); initModule("AT+CNMI=2,2,0,0,0","OK",1000); Serial.println("Initialized Successfully"); //Prateek //wwww.prateeks.in //https://www.youtube.com/c/JustDoElectronics/videos sendSMS(phone_no,"Start GSM Fire Alert System"); sms_Status = EEPROM.read(1); call_Status = EEPROM.read(2); } void loop(){ readSMS(); read_value = digitalRead(sensorPin); if(read_value==1){ flag=0; } else{ if(flag==0){flag=1; if(sms_Status==1){sendSMS(phone_no,"Fire Alert....");} delay(1000); if(call_Status==1){callUp(phone_no);} } delay(1000); } if (var_1 == 1){ if (!(strncmp(input_string, "Sms On", 6))){sms_Status=1; EEPROM.write(1, sms_Status); sendSMS(phone_no,"Message is Active"); } else if (!(strncmp(input_string, "Sms Off", 7))){sms_Status=0; EEPROM.write(1, sms_Status); sendSMS(phone_no,"Message is Deactivate"); } else if (!(strncmp(input_string, "Call On", 7))){call_Status=1; EEPROM.write(2, call_Status); sendSMS(phone_no,"Call is Active"); } else if (!(strncmp(input_string, "Call Off", 8))){call_Status=0; EEPROM.write(2, call_Status); sendSMS(phone_no,"Call is Deactivate"); } var_1 = 0; var_2 = 0; } digitalWrite(led_sms, sms_Status); digitalWrite(led_call, call_Status); } void sendSMS(char *number, char *msg){ GSM.print("AT+CMGS=\"");GSM.print(number);GSM.println("\"\r\n"); delay(500); GSM.println(msg); delay(500); GSM.write(byte(26)); delay(5000); } void callUp(char *number){ GSM.print("ATD + "); GSM.print(number); GSM.println(";"); delay(1000); } void readSMS(){ while(GSM.available()>0){ if (GSM.find("/123")) { delay(1000); while (GSM.available()) { char input_char = GSM.read(); input_string[var_2++] = input_char; if (input_char == '/') { var_1 = 1; return; } } } } } void initModule(String cmd, char *res, int t){ while(1){ Serial.println(cmd); GSM.println(cmd); delay(100); while(GSM.available()>0){ if(GSM.find(res)){ Serial.println(res); delay(t); return; }else{Serial.println("Error");}} delay(t); } }
GitHub Link :-
Code And Library
Video :-
1 Comments
Anonymous
17 May 2022 at 20:31
what kind of wire did u use
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer
Older
ESP32 Interfacing With LDR Sensor
Smart Street Light Using Arduino
ESP32 Led Blink With Push Button
EM-18 Interface With Arduino Nano
Ultrasonic Sensor as a Counter with Arduino
ESP32 And Fingerprint Sensor Based Biometric Door Lock Security System
Measure CO2 Level in Air Using Arduino
IoT Based Patient Health Monitoring System Using Blynk App
Em-18 Interfacing With Esp32
Nodemcu Interfacing With Em-18
YouTube
Like on Facebook
Follow on Twitter
Follow on Google+
Follow on Instagram
Subscribe on Youtube
Hi WelCome To My Website If you have a creative mind and want to learn Electronics even without studying it then FRIENDS this Website And Youtube Channel is for you, I am crazy creators who love making Electronics things. I have a bunch of more than 130 Tutorial Videos on My YouTube Channel and I upload a new Tutorial every Sunday.
Tags
Arduino Project
Esp32 Project
Esp8266 Project
1 Comments
what kind of wire did u use
ReplyDelete