Amanjeet Kumar Mishra
Published © GPL3+

Fire Detecting Alarm ➡ Alert!

Follow the below steps to make a fire detecting alarm.

IntermediateProtip1.5 hours618
Fire Detecting Alarm ➡ Alert!

Things used in this project

Story

Read more

Schematics

Circuit Connection img1

Circuit Connection img2

Circuit Connection img3

Circuit Connection img4

Let's see how the project works

Let's see how the project works.

Code

conf.py

Python
SID = 'AC0815XXXXXXXfa0887XXXXXXXXXXXX997f' 
AUTH_TOKEN = '4060afXXXXXXX403cf76XXXXXXXXXX' 
FROM_NUMBER = '+XXXXXXXXX'
TO_NUMBER = '+91XXXXXXXXXX'
API_KEY = '9c96XXXX-641d-XXXX-96d6-XXXXXXXXX'
DEVICE_ID = 'BOLTXXXXXXX'

fire_detecting_alarm.py

Python
import conf
from boltiot import Sms, Bolt
import json, time

minimum_limit = 300

mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)


while True: 
    print ("Reading sensor value")
    response = mybolt.analogRead('A0') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
    try: 
        sensor_value = int(data['value']) 
        if sensor_value > minimum_limit:
        	print(mybolt.digitalWrite('1', 'HIGH'))
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("Alert!!!!!!!! Fire... Fire... Fire... . The Current temperature is " +str(sensor_value))
            print("Response received from Twilio is: " + str(response))
            print("Status of SMS at Twilio is :" + str(response.status))
        else:
        	print(mybolt.digitalWrite('1', 'LOW'))
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10) 

Credits

Amanjeet Kumar Mishra

Amanjeet Kumar Mishra

2 projects • 0 followers

Comments