Description:
In this project we build a Fire Alarm System using Arduino. Here we are using LM35 Temperature sensor to detect fire, once fire is detected, output can be displayed on 16×2 LCD Display and an SMS is sent to a phone number using GSM Module. Everything is controlled by Arduino UNO.
Circuit Diagram:
Components:
SR. NO. | COMPONENT | PINOUT DIAGRAM | BUY |
---|---|---|---|
1 | Arduino UNO (Other Arduinos can be used too) | Arduino UNO Pinout Diagram⇗ | |
2 | LM35 Temperature Sensor | ||
3 | SIM900A GSM Module | ||
4 | 16×2 LCD Display | ||
5 | SIM Card | ||
6 | A Phone |
Arduino UNO
The Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins, 6 analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header, and a reset button. It is designed to be easily programmed using the Arduino IDE, a simple and open-source software. In this project, the Arduino UNO is used as the brain of the system. It is connected to the LM35 temperature sensor which detects temperature changes in the surrounding environment, if the temperature goes beyond a certain level, the Arduino UNO triggers the SIM900A GSM module to send an SMS to a pre-defined number. This feature allows the user to be alerted of a potential fire hazard, even if they are not in the vicinity of the system. The Arduino UNO can also be programmed to turn on a sound alarm in case of a fire. The combination of Arduino UNO, sim900a GSM module and LM35 Temperature Sensor make this system an efficient and cost-effective solution for fire detection and alert.
LM35 Temperature Sensor
The LM35 temperature sensor is an analog device that can be used to measure temperature with high accuracy. It is a low-cost and easy-to-use sensor that outputs a voltage proportional to the temperature in Celsius. The LM35 sensor does not require any external calibration or trimming to provide typical accuracies of ±1⁰C at room temperature and ±3⁰C for a full temperature range of -55 to 150⁰C. In this project, the LM35 sensor is used to detect temperature changes in the surrounding environment. The sensor is connected to the Arduino UNO and continuously sends temperature data to the microcontroller. The microcontroller is programmed to compare the temperature data with a preset threshold value, if the temperature goes beyond a certain level, the Arduino UNO triggers the SIM900A GSM module to send an SMS to a pre-defined number and also can turn on a sound alarm in case of a fire. The LM35 temperature sensor is a reliable and accurate device for sensing temperature changes and its use in the fire alarm system makes it a cost-effective solution for monitoring temperature and detecting potential fire hazards.
SIM900A GSM Module
The SIM900A GSM module is a compact and powerful GSM/GPRS module that can be used for a wide range of applications, including wireless communication and data transfer. It is based on the SIM900A chipset from SIMCOM and has a built-in TCP/IP protocol stack that allows easy integration with various microcontrollers such as the Arduino UNO. It supports Quad-band 850/900/1800/1900 MHz, and is able to send and receive SMS, make and receive calls, and connect to the internet via GPRS.
In this project, the SIM900A GSM module is used to send SMS notifications to a pre-defined number in case of a fire. The Arduino UNO is connected to the SIM900A GSM module, and when the temperature goes beyond a certain level, the Arduino UNO triggers the GSM module to send an SMS to a pre-defined number. This feature allows the user to be alerted of a potential fire hazard, even if they are not in the vicinity of the system. The SIM900A GSM module can also be programmed to call a pre-defined number in case of a fire. The SIM900A GSM module is a powerful device that makes it easy to send and receive SMS and make and receive calls, and its use in the fire alarm system makes it a cost-effective solution for remote monitoring and alerting in case of fire hazard.
Steps and Info:
1. Get correct components as given. You can buy online or offline. I buy electronics components mostly from Amazon.
2. Start connecting the components. If you are new to connecting components in an electronic circuit, then use a Breadboard or you can straight up make connections using Jumper wires but it will create problem when there will be two or more connections needed at one pin (for example two or more different sensors 5V connection to Arduino’s 5V pin). But before soldering components on a PCB or printing a PCB for your circuit, better try using breadboard so that any errors and mistakes can be observed on breadboard and not after soldering. Or do connections in your way.
3. Now after building the circuit, download the Arduino IDE from https://www.arduino.cc/ website.
4. If you are new to Arduino IDE software, then watch this video we made specially for beginners about Arduino IDE.
5. If you know Arduino IDE then straight up copy the code we given and paste it into the Arduino IDE sketch.
6. Connect the Arduino to your Computer/device. Select a proper port, proper Arduino type and whatever other settings are. Here it is Arduino UNO. (If you don’t know what this all is then watch our video: ).
7. Compile the code and Upload it.
8. If any error occurs then try to troubleshoot it by finding/copy-pasting it into our Solve Errors page https://electronicsprojects.in/solve-errors/, or you can straight up paste the error on Internet and you know the rest. Also check if there are no spelling/syntax errors in the code. Compile the code again once to check if errors are fixed. I have given proper connections and code but still nothing is perfect.
9. Once code compiles and uploads smoothly, you can start testing the working of your circuit/project.
10. Keep an active SMS pack on the SIM card you inserted in the GSM module.
11. Now take a lit a match stick and take it near to the LM35 Temperature sensor, as the sensor will detect the increase in temperature due to the fire from the match stick. The 16×2 LCD will give warning and also send and SMS to the phone number which added in the code.
12. If you are not getting output or getting some Alien language on LCD then try different connections, I have mentioned about this in the code.
13. If the GSM module is not turning ON then connect a 12v battery to it.
14. If it doesn’t work then check connections and code. Also you can talk with me and the community through discord. All the links to social is given at the right side of this page.
Program Code:
/* https://www.electronicsprojects.in Fire Alarm System using Arduino, GSM and LM35 Temperature Sensor */
#include <SoftwareSerial.h>
#include<LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7); /* If output not came then try this (7,6,5,4,3,2) */
SoftwareSerial mySerial(9, 10);
int sensor=A0;
float temp_read,Temp_alert_val,Temp_shut_val;
int sms_count=0,Fire_Set;
void setup()
{
pinMode(sensor,INPUT);
mySerial.begin(9600);
Serial.begin(9600);
lcd.begin(16,2);
delay(500);
}
void loop()
{
CheckFire();
CheckShutDown();
}
void CheckFire()
{
lcd.setCursor(0,0);
lcd.print("Fire Scan - ON");
Temp_alert_val=CheckTemp();
if(Temp_alert_val>45)
{
SetAlert();
}
}
float CheckTemp()
{
temp_read=analogRead(sensor);
temp_read=temp_read*5;
temp_read=temp_read/10;
return temp_read;
}
void SetAlert()
{
while(sms_count<3)
{
SendTextMessage();
}
Fire_Set=1;
lcd.setCursor(0,1);
lcd.print("Fire Detected");
}
void CheckShutDown()
{
if(Fire_Set==1)
{
Temp_shut_val=CheckTemp();
if(Temp_shut_val<28)
{
lcd.setCursor(0,1);
lcd.print("No Fire");
sms_count=0;
Fire_Set=0;
}}}
void SendTextMessage()
{
mySerial.println("AT+CMGF=1");
delay(2000);
mySerial.println("AT+CMGS=\"+919999999999\"\r"); /*Add your Smart Phone Number here*/
delay(2000);
mySerial.println("Fire Detected");
delay(200);
mySerial.println((char)26);
delay(5000);
mySerial.println("AT+CMGS=\"+919999999999\"\r"); /*Add your Smart Phone Number here*/
delay(2000);
mySerial.println("Fire Detected");
delay(200);
mySerial.println((char)26);
delay(5000);
sms_count++;
}