top of page

SMS Alert for Fire using Raspberry Pi - IoT

Updated: Apr 5

A fire outbreak is a major tragedy that has led to various casualties returning into both financial loss as well as human life. Detecting fire at an early stage can help in saving lives. That is why Fire detectors play a very important role in many organizations, industries, hospitals, institutions, etc. A Fire detector not only detects fire/flame but also alerts the user whenever a fire is detected so that necessary measures can be taken.


In this article, we will learn how to interface Fire Sensor with the Raspberry Pi board to get SMS alerts when a flame/fire is detected.


Hardware Requirements :


The following components are required for the interfacing -

Components Required
Components Required

Raspberry Pi 3B+:


Raspberry Pi 3B+
Raspberry Pi 3B+

Raspberry Pi ( Rpi ), is a low-cost, credit card-sized computer that runs on the Linux Operating System. It provides a set of #GPIO ( General Purpose Input / Output Pins ) which allows the interfacing of hardware components. It has inbuilt WiFi and Bluetooth capabilities making it a better candidate for #IoT projects and Developments.


Buy RaspberryPi 3B+ board from here.


Fire Sensor :


Fire Sensor
Fire Sensor

Fire #Sensors, also known as Flame Sensors are designed to detect the presence of fire/flames. They consist of four pins - Ao ( Analog Output ), Do ( Digital Output ), GND ( Ground ), and Vcc ( Power Supply ). For Analog Pin ( Ao ), an ADC ( Analog-to-Digital Converter ) needs to be used for getting the desired output while the Digital Output Pin ( Do ) directly gives the output in terms of 0 and 1.


Buy Fire Sensor from here.


Jumper Wires :


Jumper Wires
Jumper Wires

Jumper Wires are connecting wires having connector pins at each end, allowing them to connect two points without soldering. They typically come in three versions - male-to-male, male-to-female, and female-to-female. Here, we will be using female-to-female #Jumper Wires for interfacing the sensor with a Raspberry Pi board.


Buy Jumper Wires from here.


USB Cable :

USB Cable
USB Cable

#USB ( Universal Serial Bus ) Cable is used to connect Raspberry Pi to the system ( For eg: Laptops ).


Buy USB Cable from here.


Micro SD card:

16 GB Micro SD card
16 GB Micro SD card

Micro #SD card acts as a hard drive for Raspberry Pi and stores information. SD is an abbreviation for Secure Digital. The faster you read data from the micro SD card, the faster will be the booting and loading of programs to Raspberry Pi. That is why it is always recommended to use Class 10 micro SD cards.


Buy 16 GB Micro SD cards from here.


Software Requirements :


Raspberry Pi Imager:

Raspberry Pi Imager
Raspberry Pi Imager

Raspberry Pi imager is a quick and easy to install RPi Operating System which allows the interfacing of hardware devices with Softwares. It needs to be installed into the system for making the #Raspberry Pi board recognizable. It can be installed with the help of an SD Card Reader.


Python IDLE:

Python IDLE IDE
Python IDLE IDE

Python #IDLE ( Integrated Development Learning Environment ) is an integrated development environment for #Python, used to execute Python scripts.


Sending and Receiving SMS with Nexmo:


Nexmo uses API's allowing the user to send and receive SMS worldwide. The following steps are needed for setting up nexmo to get SMS alerts -

  1. Open the nexmo website and then click on sign up.

  2. Submit the required information for sign-up, a code will be sent to the mobile number you entered.

  3. After signing up, You will see the #API key and API secret, note them as you need to enter the API information into the code.

Click here to visit the website: Nexmo


Installations:


1. For installing RPi imager, type the given-below command in your terminal window.

sudo apt install rpi-imager 

2. For installing Python IDLE, type the given command in your terminal window.

sudo apt-get install idle3 

3. For installing #Nexmo Python Library, type the below command in the terminal.

pip install nexmo 

Circuit Connections:



The circuit connections for interfacing Flame Sensor with Raspberry Pi are as follows -

  1. GND pin of flame sensor is connected to GND pin of Raspberry Pi.

  2. The Vcc pin of the flame sensor is connected to +5V of Raspberry Pi.

  3. The D0 pin ( Digital Output ) of the flame sensor is connected to #GPIO 4 of the Raspberry Pi.


Download the complete code here.



Working :


Once the hardware connections are completed and the code is written in the #IDE, connect the hardware device to the system ( Laptop ) and upload the code to the hardware.


SSH Terminal
SSH Terminal

After saving the code file under the above-mentioned extension ( i.e .py ), open the SSH (Secure Socket Shell ) terminal.


Running code file on SSH terminal
Running code file on SSH terminal

Now, RUN the code file by writing python .py on the SSH terminal window as shown in the above image.


Fire detector using Raspberry Pi
Fire detector using Raspberry Pi
Getting SMS Alerts
Getting SMS Alerts

Whenever a #fire/flame is detected, the Do ( Digital Output ) pin of the #flame sensor lights up, and an SMS is sent to the registered mobile number.


Check the Project working video here - SMS Alert for Fire using Raspberry Pi - IoT

Video By - Sai Parimal


Conclusion :


This article gives a brief overview of #interfacing flame sensor on Raspberry Pi and getting #SMS alerts whenever a flame/fire is detected so that necessary measures can be taken. While sensors do the task of detecting fire/flame, the combination of the Internet here makes the tasks a lot more beneficial. This is just a #prototype with huge applications in the home

the automation system, smoke detection systems, industries, etc.

 

See Also :


bottom of page