Achiket Kumar
Published © GPL3+

Intrusion Detection Alert System

Intrusion detection by the help of the PIR sensor. Whenever someone tries to come in signal will found in the form of a text message.

IntermediateFull instructions provided759
Intrusion Detection Alert System

Things used in this project

Hardware components

PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
Male/Female Jumper Wires
Male/Female Jumper Wires
×1
Micro-USB to USB Cable (Generic)
Micro-USB to USB Cable (Generic)
×1
60W PCIe 12V 5A Power Supply
Digilent 60W PCIe 12V 5A Power Supply
×1

Software apps and online services

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

Story

Read more

Code

Complete Python Code

Python
import conf, json, time, requests #importing libraries 
from boltiot import Sms, Bolt 

SID = 'You can find SID in your Twilio Dashboard' 
AUTH_TOKEN = 'You can find  on your Twilio Dashboard' 
FROM_NUMBER = 'This is the no. generated by Twilio. You can find this on your Twilio Dashboard'
TO_NUMBER = 'This is your number. Make sure you are adding +91 in beginning'
API_KEY = 'This is your Bolt Cloud accout API key'
DEVICE_ID = 'This is the ID of your Bolt device' 

sms = Sms(conf.SID, conf.AUTH_TOKEN, conf.TO_NUMBER, conf.FROM_NUMBER)

while True: 
    response = requests.get('http://cloud.boltiot.com/remote/XXXXXXXXXXXXXXXXXXXX/digitalRead?pin=0&deviceName=BOLTXXXXXX')
    data=json.loads(response.text) #loding and storing the value
    print(data) 
    sensor_value = int(data['value'])
    if sensor_value == 1: #value is high
        print("MOTION DETECTED")
        print("sending SMS")
        sms.send_sms("SOMEONE ENTERED")
    elif sensor_value ==0: #Value is low
        print("SENSOR IS READY")
    time.sleep(5) #Time interval in seconds to check the intrusion

Credits

Achiket Kumar

Achiket Kumar

12 projects • 2 followers
I am a Computer Science student from Indian Institute of Information Technology, Kalyani

Comments

Add projectSign up / Login