Hackster is hosting Hackster Holidays, Ep. 4: Livestream & Giveaway Drawing. Start streaming on Wednesday!Stream Hackster Holidays, Ep. 4 on Wednesday!
Deepak Negi
Published © GPL3+

Intrusion Alert System

Intrution alert system through IR Device is Simple system to know whether someone has entered the house or not.

IntermediateFull instructions provided1 hour724
Intrusion Alert System

Things used in this project

Hardware components

Bolt WiFi Module
Bolt IoT Bolt WiFi Module
×1
ir sensor module
×1
Breadboard (generic)
Breadboard (generic)
×1
Buzzer
Buzzer
×1
Male/Male Jumper Wires
×1
USB-A to Mini-USB Cable
USB-A to Mini-USB Cable
×1

Software apps and online services

Bolt IoT Android App
Bolt IoT Android App
bolt iot bolt python liabrary
mailgun email api

Hand tools and fabrication machines

Multitool, Screwdriver
Multitool, Screwdriver

Story

Read more

Schematics

Circuit Diagram

Code

Intrusion_alert Code

Python
import json, time
from boltiot import Bolt
MAILGUN_API_KEY = 'This is the private API key which you can find on your Mailgun Dashboard' 
SANDBOX_URL= 'You can find this on your Mailgun Dashboard' 
SENDER_EMAIL = 'This would be test@your SANDBOX_URL'
RECIPIENT_EMAIL = 'Enter your Email ID Here'
API_KEY = 'This is your Bolt Cloud account API key'
DEVICE_ID = 'This is the ID of your Bolt device'
mybolt = Bolt(API_KEY,DEVICE_ID)
mailer = Email(MAILGUN_API_KEY, SANDBOX_URL, SENDER_EMAIL, RECIPIENT_EMAIL)
maximum_limit = 900
while True: 
    print ("Reading sensor value")
    response = mybolt.analogRead('A0') 
    data = json.loads(response) 
    print("Sensor value is: " + str(data['value']))
     try:
        sensor_value = int(data['value'])
        time.sleep(10)
        if sensor_value > maximum_limit:
          print("Intrusion Alert")
          response = mybolt.digitalWrite('0','HIGH')
          print(response)
          print (" Sending an EMAIL to the Authority.")
          response = mailer.send_email("Alert","Someone has Entered in the room")
          print("This is the response ",response)
        elif sensor_value < maximum_limit:
          response = mybolt.digitalWrite('0','HIGH')
          print(response)
      
     except Exception as e:
         print ("Error occured: Below are the details")
         print (e)
     time.sleep(0)
   
          

Credits

Deepak Negi

Deepak Negi

1 project • 2 followers

Comments