Software apps and online services
Due to recent technological advances, our homes as well as other organizations have been modernized to a great extent. Although many precautions and other safety measures are taken to prevent as well as control the occurrence of fires, there are still some things which are out of our hand. We often hear about instances where buildings are on fire, but by the time the firemen arrive, the entire property has been destroyed. Moreover, in their state of panic, the owners are not able to think quickly and hence the damage done extends to a higher level. This project "Fire Detection and Alert System" aims to solve this problem.
This project makes use of the upcoming concept of IoT- Internet of Things. Various sensors are interface with a variety of devices so that they can be connected to the internet and then can be controlled remotely.
This project makes use of a flame sensor to detect the occurrence of fires in the particular apartment. If a fire is detected by the sensor, then three things happen:
- The buzzer starts ringing in the apartment and if someone is present there, then they are alerted about it.
- An email alert is also sent to the owner of the apartment so that he can take an appropriate course of action.
- Also, the LED at the security desk of the society begins to glow, so that the security personnel are notified and then they can reach the apartment with fire extinguishers. In case of extensive fires, they can also immediately contact the fire men.
The image below shows all the components that have been used to create the circuit of this project. The name of the components as well as their links have been provided above.
The details of the connection done are provided below:
- Flame Sensor: The output pin of the flame sensor is connected to the digital pin 0 of the Bolt wi-fi Module. The VCC pin is Connected to 5V pin of the wi-fi module. The ground pin is connected to the breadboard.
- LED: The positive end is connected to digital pin 3. The negative end is connected to ground.
- Buzzer: The positive end is connected to the digital pin 1. The negatuve end is connected to ground.
All the connections are connected to the ground appropriately. Also for better understanding, use a breadboard for all the connections.
The schematic diagram at the end provides a simplified diagram of the connections.
- When no fire is detected by the system, then the sensor returns output=HIGH and the output screen shows that everything is normal and no fire has been detected.
- When the system detects a fire, then the sensor sends output=LOW and the buzzer in the apartment starts ringing and the LED at security desk starts glowing. Also, an alert email is sent to the owner to notify him about the situation.
- Manual control over the LED as well as buzzer is also provided using a web page.
- Connect the circuit as per guidelines given in step 3.
- Connect your Bolt Device to the Bolt Cloud as per instructions given at https://trainings.boltiot.com/. and check if the status of your device is online. (if device show's offline try troubleshooting the problems as given by https://trainings.boltiot.com/.)
- Create a new product on the bolt cloud and give a name for the product and select done.
- Click on configure and go to the code section. Select the html extension and paste the code given below to create a web page for manual control over the LED and buzzer.
<h1 align="center"> Fire Detection and Alert System</h1>
<center><h2 font size=50px>Buzzer Controller</h2>
<button onclick="digitalWrite(1, 'HIGH');">ON</button>
<button onclick="digitalWrite(1, 'LOW');">OFF</button>
<center><h2 font size=50px>Security Alert(LED)</h2>
<button onclick="digitalWrite(3, 'HIGH');">ON</button>
<button onclick="digitalWrite(3, 'LOW');">OFF</button>
- Create an account on mailgun so as to send email alerts to the user. You can follow steps given on https://trainings.boltiot.com/. Note: Use (test@your sandbox url) for senders email.
- Create a configuration file in python to provide necessary credentials for sending emails.
API_KEY = "72265fbf-2205-434d-b0ed-b56766ae0351"
DEVICE_ID = "BOLT1115373"
MAILGUN_API_KEY = "3a4395b61282c58bee3def37d3b3d7c1-c50f4a19-3c803f08"
SANDBOX_URL = "sandboxd99262166e5c4bfaa9fe0aa656c743c1.mailgun.org"
SENDER_EMAIL = "email@example.com"
RECIPIENT_EMAIL = "firstname.lastname@example.org"
FRAME_SIZE = "10"
MUL_FACTOR = "6"
- Create another file in python which sends alerts depending on the sensor output. The code is given below.
import time, json
from boltiot import Bolt,Email
mybolt= Bolt(api_key, device_id)
mailer = Email(email_config.MAILGUN_API_KEY, email_config.SANDBOX_URL, email_config.SENDER_EMAIL, email_config.RECIPIENT_EMAIL)
HIGH = 1
LOW = 0
fire = mybolt.digitalRead(0)
parsed_response = json.loads(fire)
print ("Parsed response is")
sensor = int(parsed_response["value"])
print ("Fire detected")
print ("Sending mail")
response = mailer.send_email("Alert","Fire has been detected in your apartment! The security has also been alerted.")
print ("No fire detected.")
- Compile the code and then rectify the errors (if any). If everything seems appropriate. Connect the Bolt wi-fi module to the power supply and run the code.
- EMAIL ALERTS