Project tutorial
Thief Trap security system

Thief Trap security system © CC BY-NC-SA

This system will detect if a thief enters my home, and then a mechanism will lock the doors to prevent him from getting out

  • 3,460 views
  • 0 comments
  • 6 respects

Components and supplies

About this project

when the motion sensor feel that a thief entered the led will be on and after that the servo motor will close the door and the thief will not be able to rescue.after that a sms will be sent to the mobile phone of the owner of the house telling him that there is a thief in the house 


Code

Untitled fileArduino
/*this code will make the led on and will make the servo rotate 180 degree to close the door after 
the theif enter when the motion sensor feel that someone enter and send SMS to the phone number of the 
owner telling him that the theif eneterd the house */

       //include 1sheeld and servo motor libraries
#include <OneSheeld.h>
#include <Servo.h>
         //create servo object to control a servo
Servo myservo;
       //define a boolean flag
boolean isMessageSent = false;
          //define constants that  will not change 
const int sensorPin=7;
const int ledPin=13;
      //variable for reading the PIR(motion sensor) value
int sensorState=0;

//*************************8SETUP*****************************

void setup(){
	//start comunication
	OneSheeld.begin(); 
//initialize ledpin as output
  pinMode(ledPin,OUTPUT);
     //initialize sensorpin as input
  pinMode(sensorPin,INPUT);
   //attach servo to pin 9
  myservo.attach (9);
  
}

//**************************LOOP*******************************

void loop(){
	  // read the state of the sensor value:
  sensorState=digitalRead(sensorPin);
  //always check that the sensor state is high
  if (sensorState==HIGH){{
    if(!isMessageSent)
    //send the massage
     SMS.send("0123456789","there is a thief in the house");
     //turn the led on
     digitalWrite(ledPin, HIGH);
     //rotate the servo 180 degree
       myservo.write(180);
  delay(10000);
  //after 10 seconds rotate the servo 0 degrees 
           myservo.write(0);

  }
}
  else{
  	//set the flag 
     isMessageSent = false;
     //turn the led off
     digitalWrite(ledPin, LOW);

  }

}
thief trap security system

Schematics

thief trap security system
theif%20trap%20project.fzz

Comments

Similar projects you might like

Security System With 1Sheeld

Project showcase by nada abdelnaby mady

  • 1,385 views
  • 0 comments
  • 2 respects

Bluetooth Security System

Project tutorial by Victor Carreño

  • 10,996 views
  • 2 comments
  • 35 respects

Control your light system with your voice

Project tutorial by Maha Raafat

  • 33,205 views
  • 22 comments
  • 147 respects

Smart Home Automation And Security System Using 1Sheeld

Project tutorial by Team SADEE

  • 5,514 views
  • 3 comments
  • 25 respects

Home surveillance system using skype calls

Project tutorial by Manuel Miguel

  • 1,621 views
  • 0 comments
  • 3 respects

Security System Using Arduino Bluetooth Camera

Project tutorial by amrmostaafaa

  • 10,318 views
  • 10 comments
  • 27 respects
Add projectSign up / Login