Steve Varghese Blessen
Published

Burglar ALERT

An Device that send's an SMS alert to your phone the moment a burglar has entered your house.

IntermediateFull instructions provided446
Burglar ALERT

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×4
LDR, 5 Mohm
LDR, 5 Mohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×3
3 mm LED: Yellow
3 mm LED: Yellow
×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

CIRCUIT DIAGRAM

Circuit connections for LED and LDR are as follows

Code

Code

Python
Codes for reading LDR values and sending SMS via twilio
from boltiot import Sms, Bolt
import details, json, time

lower_limit = 30
upper_limit = 150

mybolt = Bolt(details.API_KEY, details.DEVICE_ID)
sms = Sms(details.SID, details.AUTH_TOKEN, details.TO_NUMBER, details.FROM_NUMBER)

def light_intensity(pin):
        try:
                input =  mybolt.analogRead(pin)
                data = json.loads(input)
                if data["success"] != 1:
                        print("Request not successful")
                        print("Response is ", data)
                        return -999
                value_of_intensity = int(data["value"])
                return value_of_intensity
        except Exception as e:
                print("Something went wrong when returning the sensor value")
                print(e)
                return -999
while True:
        value_of_intensity = light_intensity("A0")
        print("The current light intensity is:", value_of_intensity)
        try:
                if value_of_intensity > lower_limit and value_of_intensity < upper_limit:
                        print("Sending an SMS via twilio")
                        input = sms.send_sms("ALERT: There’s an intruder in the house")
                        print("Response received from twilio is:" +str(input.status))
        except Exception as e:
                print("An error has occurred: Details are given below")
                print(e)
        time.sleep(20)

Configuration code

HTML
Code for turning ON and OFF the LED
<!DOCTYPE html>
<html>
    <head>
        <title>Bolt IoT Platform</title>
        <script type="text/javascript" src="https://cloud.boltiot.com/static/js/boltCommands.js"></script>
        <script>
        setKey('{{ApiKey}}','{{Name}}');
        </script>
    </head>
    <body>
        <div>
        <center>
        <button onclick="digitalWrite(0, 'HIGH');" style="width: 300px; height: 250px; background-color:#FFFF00;"><font size="+7">ON</font></button>
        </center>
        </div>
        <div>
        <center>
        <button onclick="digitalWrite(0, 'LOW');" style="width: 300px; height: 250px; background-color:orange;"><font size="+7">OFF</font></button>
        </center>
        </div>
    </body>
</html>

Credits

Steve Varghese Blessen
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.