Joshua Rebello
Published © GPL3+

Unwanted Guest Alert System

Guest alert system that keeps those nosy, unwanted guests/people away from your room, so that you can work without worrying.

BeginnerFull instructions provided4 hours325
Unwanted Guest Alert System

Things used in this project

Story

Read more

Schematics

Intruder Alert Schematics

Code

Intruder Alert Code

Python
import time, json
from boltiot import Sms, Bolt
api_key = "XXXX"
device_id  = "XXXX"
SSID = "XXXX"
AUTH_TOKEN = "XXXX"
FROM_NUMBER = "XXXX"
TO_NUMBER = "XXXX"
mybolt = Bolt(api_key, device_id)
sms = Sms(SSID, AUTH_TOKEN, TO_NUMBER, FROM_NUMBER)

while True:
    buzzer = mybolt.digitalWrite(0, 'LOW')
    ir_sensor = mybolt.digitalRead(2)
    response1 = json.loads(ir_sensor)
    print("Response1 is")
    print(response1)
    detection = int(response1["value"])
    if (detection == 1):
       print("No One Detected")
    else:
       print("Someone Detected")
       response = sms.send_sms("Someone has Entered your Room.")
       print("Status of SMS at Twilio is:" + str(response.status))
       t_end = time.time() + 60*2
       while time.time() < t_end:
         buzzer = mybolt.digitalWrite(0, 'HIGH')

    time.sleep(0.5)

Credits

Joshua Rebello

Joshua Rebello

1 project • 0 followers

Comments