Shreya Jagtap Student
Published © GPL3+

Wake Up Alert System

A Smart Alarm is a wireless version of traditional burglar alarm that uses your home wifi network to connect the different components.

BeginnerFull instructions provided6 hours267
Wake Up Alert System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×2
Jumper wires (generic)
Jumper wires (generic)
×5
Breadboard (generic)
Breadboard (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×1

Software apps and online services

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

Story

Read more

Schematics

Connections

Code

CODE

Python
First create a file name confy.py and then create another file name as wake_up.py then write the code .
We store all the credentials in a separate file since it is sensitive data which should not be shared with anyone.
In the main code we have import our conf file ,python json and time libraries are also imported.
Now to fetch the data from Bolt Cloud, we will create an object called 'mybolt' using which you can access the data on your Bolt.For the Bolt cloud to identify our device we will produce the API _KEY and DEVICE_ID.
To send SMS we will create an object .We have used the while loop to continue fetch the value and run the code. We have enclosed code in a try and except block.

Below is the code for the program.
import confy,json,time
from boltiot import Bolt,Sms


limit = 300

my bolt = Bolt(confy.API_KEY,confy.DEVICE_ID)
sms = Sms(confy.SID,confy.AUTH_TOKEN,confy.TO_NUMBER,confy.FROM_NUMBER)
while True:
           print("Reading Sensor Value")
           response = mybolt.analaogRead('A0')
           data = json.loads(response)
           print("Sensor Value is: " +str(data['value']))
           try:
               sensor_value = int(data['value'])
               if sensor_value > limit :
                  print("Making a request to Twilio to send SMS")
                  response = sms.send_sms("Its Time To Wake Up.GOOD MORNING.Enjoy A Brand New Day")
                  print("Lets Switch On The Lights")
                  print("Switching On The Alarm")
                  mybolt.digitalWrite('1','HIGH')
                  print("Response received from Twilio is: "+str(response))
                  print("Status of the Sms at Twilio is: "+str(response.status))
               else:
                  print("Its Night")
                  print("Do Not Send The Message Through Twilio")
                  print("Do Not Turn On The Lights")
                  print("Do Not Turn On The Alarm")
                  mybolt.digitalWrite('1','LOW')
            except EXCEPTION as e:
                  print("Error occured.Below are the details")
                  print(e)
            time.sleep(10)

Credits

Shreya Jagtap Student
1 project • 0 followers

Comments