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 hours119
Unwanted Guest Alert System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Buzzer
Buzzer
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1
IR Proximity Sensor
Digilent IR Proximity Sensor
×1

Software apps and online services

Bolt Cloud
Bolt IoT Bolt Cloud
SMS Messaging API
Twilio SMS Messaging API

Story

Read more

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

Add projectSign up / Login