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 hours175
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="72265fbf-2205-434d-b0ed-b56766ae0351"
device_id="BOLT1115373"
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 = "72265fbf-2205-434d-b0ed-b56766ae0351"
DEVICE_ID = "BOLT1115373"
MAILGUN_API_KEY = "3a4395b61282c58bee3def37d3b3d7c1-c50f4a19-3c803f08"
SANDBOX_URL = "sandboxd99262166e5c4bfaa9fe0aa656c743c1.mailgun.org"
SENDER_EMAIL = "test@sandboxd99262166e5c4bfaa9fe0aa656c743c1.mailgun.org"
RECIPIENT_EMAIL = "shravanimaliye@gmail.com"
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 • 0 followers

Comments