Fire Alert using Push Mobile Notification - IoT
Updated: Oct 29, 2020
In this article, we are going to discuss how to interface the #raspberry pi board with a fire alert system and send mobile notifications to it by using push bullet service. A fire sensor is a device that is used to detect fire or flame. It is very important to use this type of sensors where there is a chance of a fire occurring. We can use even for our household purposes also where there might be any chances of occurring fire accidents. So let's get headed towards the project and understand the working in detail along with the circuit diagram and codes.
List of components
The Raspberry Pi is a low-cost, chip machine that enables a regular mouse and keyboard attached to a device monitor or TV. It is a lightweight, functional computer that allows individuals of all ages to explore programming and study how to program in languages such as python.
Click to buy:- https://amzn.to/34ockkL
Fire Sensor is used for sensing smoke and/or heat by an automatic fire detection arrangement. These systems react to the existence of fire-related smoke or incredibly high temperatures. The unit will transmit a signal to the warning system after the unit has been triggered to execute the programmed response for that region.
Click to buy:- https://amzn.to/34a6tk8
USB cables are directly connected to external equipment, such as cell phones, cameras, video recorders, and machines/printers, to computing devices. The primary function of these cables is to capture or transfer data from one computer to the next efficiently, easily, and efficiently.
Click to buy:- https://amzn.to/31mu9Qt
Jumper wires are used to establish a connection between different elements in the circuit and #Raspberrypi board. There are two types of wire, male and female. The male wires have ends that can be connected to other ends and the female wires are the ones that have the receiving end.
Click to buy:- https://amzn.to/3jGvoBm
The fire #sensor has four pins which are A0(analog pin), ground, VCC(can be 3.3v/5v depending on the module), and D0( digital output pin). In addition to these pins, the module has LEDs for power and D0 output. The D0 led glows when the sensor detects fire. Also, we have a #potentiometer in the fire sensor which allows voltage to flow as per the required amount while functioning.
We connect these pins with a raspberry pi board with different pins on it. The D0 pin of the fire sensor is connected to the Raspberry Pi GPIO. The ground and VCC pin of the fire sensor is connected to the respective terminals of the Raspberry Pi board.
In the fire sensor, the fourth pin is the analog pin(A0) which can not be connected to the Raspberry Pi directly. So if one wants to use the analog pin an external analog to digital converter is required for the Raspberry Pi GPIO.
from pushbullet import Pushbullet
First, we need to import a push bullet library.
import RPi.GPIO as GPIO import time
Next import GPIO Rpi and declare the pins as output or input and next, we need to import the time module.
channel = 4 GPIO.setmode(GPIO.BCM) GPIO.setup(channel, GPIO.IN)
Next, we use channel number 4 and we use #GPIO modes which are connected to the pins of the raspberry pi board. And we set up the channel as input.
pb = Pushbullet("Your_API_Token") #print(pb.devices)
And next, we initialized the push bullet function its argument is your #API token then we print the statement.
def send_pntf(channel): print("Sending alert") dev = pb.get_device('Your_Device_Name') push = dev.push_note("Alert!!", "Fire at your place") print("Sent")
Based on the channel the functions be placed here and we get an alert through notification.
Through the above code, we will get a notification on our mobile.
GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=120) # let us know when the pin goes HIGH or LOW GPIO.add_event_callback(channel, send_pntf) # assign function to GPIO PIN, Run function on change
The first one is for detection and the second layer is for calling off the function. In GPIO we have rising value and lowering value.
# infinite loop while True: time.sleep(60)
To run the loop forever we infinite loop of while true. For every minute we would be detecting the pins.
Complete code of Fire Alert using Push Mobile Notification - IoT
from pushbullet import Pushbullet import RPi.GPIO as GPIO import time channel = 4 GPIO.setmode(GPIO.BCM) GPIO.setup(channel, GPIO.IN) pb = Pushbullet("Your_API_Token") #print(pb.devices) def send_pntf(channel): print("Sending alert") dev = pb.get_device('Your_Device_Name') push = dev.push_note("Alert!!", "Fire at your place") print("Sent") GPIO.add_event_detect(channel, GPIO.BOTH, bouncetime=120) # let us know when the pin goes HIGH or LOW GPIO.add_event_callback(channel, send_pntf) # assign function to GPIO PIN, Run function on change # infinite loop while True: time.sleep(60)
Download code from here
First of all, you need to create an account in the #push bullet services by simply logging in by your account. Completing the few necessary steps and you are done. Next, connect all parts and powerup the circuit.
After entering the code on the module an insert code and add push bullet app to the module.
Then next we need to test our module with flame. when we place the sensor near the flame we will get a notification through the push bullet app on our mobile.
The below image is after getting closer to the flame
Watch the below video for detailed information on making a Fire alert system using a flame sensor.
Video By - Sai Parimal
In this article, you learn how to #interface the raspberry pi board with a fire alert system and send mobile #notifications by using push bullet service. This type of application is very useful to control any fire accident by remote access through the push bullet application.
Author - VNS Akhil
Editor - Usha Saha