Jagruti Patil
Published © GPL3+

Digital ALARM with compact accurate TEMPERATURE Sensor

SUCCESS comes to those who have the WILLPOWER to win over their SNOOZE BUTTONS.

IntermediateProtip1 hour166
Digital ALARM with compact accurate TEMPERATURE Sensor

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
USB Cable, Male - Female
USB Cable, Male - Female
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
LM35 Temperature Sensor
×1
Resistor 1k ohm
Resistor 1k ohm
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
Snappy Ubuntu Core
Snappy Ubuntu Core
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

Schematics

Temperature Sensor Configuration

Code

Acquiring Sensor Value(Temperature) and then sending information in the form of message to the user.

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

minimum_limit = 300
maximum_limit = 600  


mybolt = Bolt(conf.API_KEY, conf.DEVICE_ID)
sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)
sms=Sms(conf.SID,conf.AUTH_TOKEN,conf.TO_NUMBER,conf.FROM_NUMBER)
d=datetime.now()
t=d.strftime('%x')

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 or sensor_value < minimum_limit:
            print("Making request to Twilio to send a SMS")
            response = sms.send_sms("Good Morning dear User! The current room temperature 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: Below are the details")
        print (e)
    time.sleep(10)

Credits

Jagruti Patil
1 project • 0 followers
Biomedical Engineering (4th year)

Comments