Suresh Krishna
Published © GPL3+

Firealarm using Bolt device and sends you sms and voice call

Whenever the temperature exceeds, the buzzer starts and sends you the message. And if the temperature decreases, the it automatically stops.

IntermediateFull instructions provided1 hour391
Firealarm using Bolt device and sends you sms and voice call

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Temperature Sensor
Temperature Sensor
×1
Buzzer
Buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Snappy Ubuntu Core
Snappy Ubuntu Core
SMS Messaging API
Twilio SMS Messaging API
Programmable Voice API
Twilio Programmable Voice API

Story

Read more

Schematics

20200612_1127501_iIc7XMXw5Z.jpg

Code

python code

Python
write the code in linux
from boltiot import Sms,Bolt
from twilio.rest import Client
import json,time
maximum_temp=300
#Twilio api
SID='AC5xxxxx'
AUTH_Token='a4xxx'
To_num='+91xx(reciever number)'
From_num='+195xx(twilio number)'
#Bolt api
api_key="your bolt_api"
device_id="BOLT29xxx"

mybolt=Bolt(api_key,device_id)
sms=Sms(SID,AUTH_Token,To_num,From_num)

while True:
  print("Reading the temperature value")
  responce=mybolt.analogRead('A0')
  print(responce)
  data=json.loads(responce)
  print("sensor value is:"+str(data['value']))
  client=Client(SID,AUTH_Token)
  call = client.calls.create(
                        twiml='<Response><Say voice="Polly.Joanna-Neural"                             >Alert!,Temperature is raising!,call to fire s>                               to='+91cxxx(reciever nmber)',
                        from_='+19xx1(twilio number)'
                    )

  try:
    sensor_value=int(data['value'])
    if sensor_value > maximum_temp :
      print("alert!The temperature exceeds the critical point")
      responce=mybolt.analogWrite('0','150')
      print(responce)
      print("making request from tiwilio to send message")
      responce=sms.send_sms("alert! the temperature is"+str(sensor_value))
      print("responce recived from tiwilio is:"+str(responce))
      print("status of sms at twilio is:"+str(responce.status))
      print(call.sid)
      print("Making outgoing call ")
    else:
      print("everything is OK")
      responce=mybolt.analogeWrite('0','0')
      print(responce)
  except Exception as e:
     print("error occured:below are the details")
      print(e)
  time.sleep(10)

Credits

Suresh Krishna

Suresh Krishna

3 projects • 2 followers

Comments