rishi chinnu
Published © GPL3+

IOT based Fire Alarm

Get notified when fire is detected in the room so that we can save many lives.

BeginnerFull instructions provided2 hours495
IOT based Fire Alarm

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1
Buzzer
Buzzer
×1
Flame Sensor
×1

Software apps and online services

SMS Messaging API
Twilio SMS Messaging API
Bolt Cloud
Bolt IoT Bolt Cloud

Hand tools and fabrication machines

Tape, Electrical
Tape, Electrical

Story

Read more

Schematics

CIRCUIT DIAGRAM

Code

code for bolt-iot module

Python
This code is used for reading sensor value,to control LED and buzzer,to get notification to our mobile from Twilio whenever flame is detected.
from boltiot import Sms, Bolt
import json, time

SSID = 'YOUR SSID' 
AUTH_TOKEN = 'YOUR TWILIO AUTH TOKEN' 
FROM_NUMBER = 'YOUR TWILIO NUMBER'
TO_NUMBER = 'YOUR PHONE NUMBER'
API_KEY = 'YOUR BOLT IOT API KEY'
DEVICE_ID = 'YOUR BOLT DEVICE ID'


mybolt = Bolt(API_KEY,DEVICE_ID)
sms = Sms(SSID,AUTH_TOKEN,TO_NUMBER,FROM_NUMBER)

while True: 
    print ("Reading sensor value")
    response = mybolt.digitalRead('1') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
    try: 
        sensor_value =  int(data['value'])
        if sensor_value==0:
            mybolt.digitalWrite("3","HIGH")
            mybolt.digitalWrite("4","HIGH")
            time.sleep(5)
            mybolt.digitalWrite("3","LOW")
            mybolt.digitalWrite("4","LOW")
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("Emergency! Flame detected in the room")
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10)

Credits

rishi chinnu

rishi chinnu

1 project • 0 followers

Comments