Project tutorial
Intrusion Alert System using Arduino and Bolt IoT

Intrusion Alert System using Arduino and Bolt IoT

Get an Email and Sms on your mobile and sound alert whenever someone enters in your room.

  • 998 views
  • 0 comments
  • 8 respects

Components and supplies

Apps and online services

About this project

Make an account on twillio for SMS.

SID=" "

AUTH_TOKEN=" "

FROM_NUMBER=" "

TO_NUMBER="Your number "

These things you will get from twillio.

Code

Python Code for SMS and Email.Python
import  json, time, requests
from boltiot import Sms, Bolt
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

email = ''
password = ''
send_to_email = ' '
subject = 'intrusion'
message = 'Someone Entered !!'

msg = MIMEMultipart()
msg['From'] = email
msg['To'] = send_to_email
msg['Subject'] = subject

msg.attach(MIMEText(message, 'plain'))

SID=" "
AUTH_TOKEN=" "
FROM_NUMBER=" "
TO_NUMBER=" "

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

while True:
    response = requests.get('http://cloud.boltiot.com/remote/e0f2449f-c1b0-483c-8bd8-f4ba5fc32a89/digitalRead?pin=0&deviceName=BOLT6094123')
    data=json.loads(response.text)
    print(data)
    sensor_value = int(data['value'])
    if sensor_value == 1:
        print("MOTION DETECTED")
        print("sending SMS")
        server = smtplib.SMTP('smtp.gmail.com', 587)
        server.starttls()
        server.login(email, password)
        text = msg.as_string()
        server.sendmail(email, send_to_email, text)
        sms.send_sms("SOMEONE ENTERED")
        server.quit()
    elif sensor_value ==0:
        print("SENSOR IS READY")
    time.sleep(5)
Arduino CodeC/C++
void setup() {

  pinMode(2, INPUT); //Pin 2 as INPUT

  pinMode(3, OUTPUT); //PIN 3 as OUTPUT

}


void loop() {

  if (digitalRead(2) == HIGH) // check if PIR is triggered.

  {

  digitalWrite(3, HIGH);   // turn the LED/Buzz ON

  delay(100);                       // wait for 100 msecond

  digitalWrite(3, LOW);   // turn the LED/Buzz OFF

  delay(100);                       // wait for 100 msecond

  }

}

Schematics

Final Circuit Diagram
Intrusion cqtdgq1in5

Comments

Similar projects you might like

Anomaly Detection & Temperature Monitoring Using Bolt IoT

Project tutorial by ashish anand

  • 2,094 views
  • 1 comment
  • 15 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 37,510 views
  • 20 comments
  • 111 respects

Ultrasonic Security System

Project tutorial by Ivan

  • 28,118 views
  • 21 comments
  • 67 respects
Add projectSign up / Login