Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Chandana Pappula
Published © GPL3+

Temperature Monitoring System

A project to detect rise in temperature by LM35 sensor(temperature sensor) using BOLT WIFI MODULE through message alert.

BeginnerShowcase (no instructions)2 hours158
Temperature Monitoring System

Things used in this project

Hardware components

LM35 sensor
×1
female to male wires
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1

Story

Read more

Code

Python code for Temperature Monitoring System

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

minimum_limit = 200
maximum_limit = 700 


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 > maximum_limit:
            print("Making request to Twilio to send a SMS")
            response1 = sms.send_sms("FIRE ALERT!"+"\nRISE IN TEMPERATURE!"+"\nThe Current temperature sensor value is " +str(sensor_value))
            print("Response received from Twilio is: " + str(response1))
            print("Status of SMS at Twilio is :" + str(response1.status))
            print("Making request to Mailgun to send an email")
            response = mailer.send_email("Alert", "The Current temperature sensor value is " +str(sensor_value))
            response_text = json.loads(response.text)
            print("Response received from Mailgun is: " + str(response_text['message']))
    except Exception as e: 
        print ("Error occured: Below are the details")
        print (e)
    time.sleep(10)

Credits

Chandana Pappula
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.