Fire Alarm & Motion Alarm Using Arduino With GSM
Fire Alarm & Motion Alarm Using Arduino With sim800l GSM Module
Introduction
In This Article, I design a fire and Motion Alarm System Using an Arduino Nano Board. I connected the two sensors like LM35 Sensor And the Ultrasonic Sensor With Arduino Nano Board.
If the LM35 sensor temperature increases more than 40 degrees Celsius then GSM Send the text message“Fire Alert Plz Check Your Room” and if the ultrasonic Sensor detects motion under 10CM then GSM Send the Text Message“Motion Alert Plz Check Your Room”.
Bill Of Material
S.N | Component's | Quantity | Link To Buy |
1 | Arduino Nano | 1 | |
2 | 16x2 LCD Display | 1 | |
3 | Sim800l GSM Module | 1 | |
4 | LM2596 Step Down Converter | 1 | |
5 | LM35 Sensor | 1 | |
6 | Ultersonic Sensor(Hc-SR04) | 1 | |
7 | 10K Pot | 1 |
Component Overview
Here I Used The Arduino Nano board because is easy to mount in a Zero PCB And is compact Size. These are the all features of the Arduino nano microcontroller.
- Operating Voltage 5 V
- Input Voltage (recommended) 7-12 V
- Digital I/O Pins 14 (of which 6 provide PWM output)
- PWM Pins 6
- Analog Input Pins 8
- DC Current per I/O Pin 40 mA
- Flash Memory 32 KB
- SRAM 2 KB
- EEPROM 1 KB
- Clock Speed 16 MHz
- The LCD displays 16 characters by 2 lines Alphanumeric display. Black text on Green background.the 16×2 LCD display I used to display the alert message like if the temperature increases the LCD displays the “Temperature alert”.
- Sim800l GSM Module I used because is compact in size and is available in all local electronics markets.is support Quad-band 850/900/1800/1900MHz,4-bit or 8-bit MPU Interface.
- sim800l GSM Module works in 3.7v to 4.3v only does not work in 5v that’s why plz don’t connect it to Arduino 5v.
- LM2596 Step-down converter converts the 12v to 3.8v because the sim800l gsm module works only 3.7v to 4.3v.
- LM35 Sensor measures the temperature and is an analog sensor The operating temperature range is from -55°C to 150°C and Linear Scale Factor is + 10 mV/°C Scale Factor.
- ultrasonic sensor module can be used for measuring distance, object sensors, and motion sensors. in this project, I used Ultrasonic sensors like a motion sensor.
- Output: Digital Sensor
- Voltage: 5VDC
- Detection distance: 2cm-400cm
- Static current: < 2mA
- Level output: 5V
Circuit Diagram
I designed a simple circuit diagram to be easy to understand. just connected the proper wire and then uploaded the code.
- 16×2 LCD Display I connected to pin number D12,D11,D10,D9,D8,D7 Pin to Arduino nano board.
- The ultersonic sensor is connected to the Pin Numbers D3 and D4, the Trigger pin is connected to the D3 Pin Number Echo PIn is connected to the D4 Pin Number VCC is connected to the 5V, and GND will be connected to the GND.
- LM35 Sensor is connected to the A4 Pin Number, VCC Is connected to the 5v and GND will connected to the GND.
- Sim800l GSM Module is connected to the Tx Pin is the D6 Pin Number and the Rx Pin is connected to the D5 Pin Number.
- But the GSM required the 3.7v that’s why you used the lithium-ion battery or LM2596 Step Down Conveter.
PCB Design
Here We Design The PCB Board With the help Of EasyEDA Software.
Back Side View Of the Zero PCB Image.
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
//Prateek //www.justdoelectronics.com //https://www.youtube.com/@JustDoElectronics/videos #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 10, 9, 8, 7); #include <SoftwareSerial.h> #define rxPin 5 #define txPin 6 SoftwareSerial sim800(rxPin, txPin); const int trigPin = 3; const int echoPin = 4; long duration; int distance; void setup() { Serial.begin(9600); sim800.begin(9600); Serial.println("SIM800L initialize"); sim800.println("AT"); lcd.begin(16, 2); pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); int ADCvalue = 0; } void lm35() { int ADCvalue = analogRead(A4); ADCvalue = ADCvalue / 2; lcd.setCursor(0, 0); lcd.print("Temperature="); lcd.print(ADCvalue); if (ADCvalue <= 40) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Temp Alert!"); SendMessage1(); } } void ultersonics() { digitalWrite(trigPin, LOW); delayMicroseconds(2); digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); distance = duration * 0.034 / 2; Serial.print("Distance from the object = "); Serial.print(distance); Serial.println(" cm"); lcd.setCursor(0, 1); lcd.print("Distance="); lcd.print(distance); if (distance <= 10) { lcd.clear(); lcd.setCursor(0, 1); lcd.print("Motion Alert!"); SendMessage2(); } } void loop() { void lm35(); void ultersonics(); delay(500); } void SendMessage1() { sim800.println("AT+CMGF=1"); delay(1000); sim800.println("AT+CMGS=\"+91xx30584864\"\r"); delay(1000); sim800.println("Temp Alert Plz Check Your Room"); delay(100); sim800.println((char)26); delay(1000); } void SendMessage2() { sim800.println("AT+CMGF=1"); delay(1000); sim800.println("AT+CMGS=\"+91xx30584864\"\r"); delay(1000); sim800.println("Motion Alert Plz Check Your Room"); delay(100); sim800.println((char)26); delay(1000); } |
Tempature Alert Message
1 2 3 4 5 6 7 8 9 10 |
void SendMessage1() { sim800.println("AT+CMGF=1"); delay(1000); sim800.println("AT+CMGS=\"+91xx30584864\"\r"); delay(1000); sim800.println("Temp Alert Plz Check Your Room"); delay(100); sim800.println((char)26); delay(1000); } |
Motion Alert Message
1 2 3 4 5 6 7 8 9 10 |
void SendMessage2() { sim800.println("AT+CMGF=1"); delay(1000); sim800.println("AT+CMGS=\"+91xx30584864\"\r"); delay(1000); sim800.println("Motion Alert Plz Check Your Room"); delay(100); sim800.println((char)26); delay(1000); } |
Project Demo
See the LCD display if motion will detected the LCD will display “Motion detected!”
Then GSM sends the Text message to the mobile Number.
if the LM35 Sensor value is higher than 40 degrees Celsius the LCD will display the “Temp Alert!” Message.
Then After a few seconds, the GSM Send the Text Message.
Video
Conclusion
In this Project, I used the Ultrasonic sensor as a motion sensor but if you try to use the PIR Sensor just change the code or IR Sensor.