Shravani Maliye
Published

Fire Detection and Alert System

Saving apartments from fire destruction by sending timely alerts to the owner as well as the security personnel for quick action.

BeginnerFull instructions provided3 hours945
Fire Detection and Alert System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Flame Sensor
A flame sensor detects the infrared rays emitted from a fire and gives the output accordingly. It is available on Amazon as well as at any electronics store.
×1
LED (generic)
LED (generic)
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Bolt IoT Android App
Bolt IoT Android App
Mailgun
Windows 10
Microsoft Windows 10

Story

Read more

Schematics

Circuit connections

Code

fire.py

Python
import email_config
import time, json
from boltiot import Bolt,Email
api_key="api key from bolt"
device_id="BOLT*******"
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
while True:
    fire = mybolt.digitalRead(0)
    parsed_response = json.loads(fire)
    print ("Parsed response is")
    print (parsed_response)
    sensor = int(parsed_response["value"])
    if sensor==0:
        print ("Fire detected")
        print ("Sending mail")
        mybolt.digitalWrite('1','HIGH')
        mybolt.digitalWrite('3','HIGH')
        response = mailer.send_email("Alert","Fire has been detected in your apartment! The security has also been alerted.")
    else:
        print ("No fire detected.")
        mybolt.digitalWrite('1','LOW')
        mybolt.digitalWrite('3','LOW')
    time.sleep(10)

email_config.py

Python
API_KEY = "API key from BOLT cloud"
DEVICE_ID = "BOLT*******"
MAILGUN_API_KEY = "api key from mailgun account"
SANDBOX_URL = "url obtained from sandbox"
SENDER_EMAIL = "email id from sandbox"
RECIPIENT_EMAIL = "your_email"
FRAME_SIZE = "10"
MUL_FACTOR = "6"

control.html

HTML
<!DOCTYPE html>
<html>
<head>
<title>Alert Control</title>
<script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
<script>
setKey('{{ApiKey}}','{{Name}}');
</script>
</head>
<body bgcolor="grey">
<h1 align="center"> Fire Detection and Alert System</h1>
<br>
<center><h2 font size=50px>Buzzer Controller</h2>
<button onclick="digitalWrite(1, 'HIGH');">ON</button> &nbsp; &nbsp;
<button onclick="digitalWrite(1, 'LOW');">OFF</button>
</center>
<br>
<br>
<center><h2 font size=50px>Security Alert(LED)</h2>
<button onclick="digitalWrite(3, 'HIGH');">ON</button> &nbsp; &nbsp;
<button onclick="digitalWrite(3, 'LOW');">OFF</button>
</center>
</body>
</html>

Credits

Shravani Maliye

Shravani Maliye

1 project • 4 followers

Comments