560 Geetha Priya
Published © GPL3+

Temperature Alert through SMS and Buzzer

This project Temperature Alert through SMS and Buzzer is done using BOLT WiFi Module.

BeginnerFull instructions provided1 hour335
Temperature Alert through SMS and Buzzer

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
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Male/Male Jumper Wires
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
VMware workstation-Ubuntu
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Schematics

Code

conf.py

Python
In this file we have the required credentials from twilio to send sms and bolt cloud credentials
SSID = 'XXXXXXXXX'                  #obtained from twilio dashboard
AUTH_TOKEN = 'XXXXXXXXX'            #obtained from twilio dashboard
FROM_NUMBER = 'XXXXXXXXX'           #This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = '+91XXXXXXXXXX'         #This is your number
API_KEY = 'XXXXXXXXXX'              #This is your Bolt Cloud accout API key
DEVICE_ID='BOLTXXXXXXXX'            #This is the ID of your Bolt device

temp_alert.py

Python
Here we have the total implementation code for the project.
we set the maximum value or threshold value. When the temperature crosses the threshold value it we make the buzzer to beep and send sms to our mobile through twilio
import conf
import json, time
from boltiot import Sms, Bolt

max_limit = 320

def alert_buzzer():
  response=mybolt.digitalWrite(0,'HIGH')
  data_alert=json.loads(response)
  if data_alert['success']!=1:
                print("Error in sending alert through Buzzer",data_alert[value])
  time.sleep(10)
  response=mybolt.digitalWrite(0,'LOW')
                
mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SSID, 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 > max_limit:
            alert_buzzer()
            print("Making request to Twilio to send SMS")
            response = sms.send_sms("Alert! The temperature exceeded the threshold that is " +str(sensor_value))
            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",e)
    time.sleep(10)

Credits

560 Geetha Priya
1 project • 0 followers

Comments