Você está na página 1de 24

"ANTI THEFT HOME"

Report submitted in partial fulfilment of the requirement for the degree of

BACHELOR OF TECHNOLOGY
in

Computer Science Engineering


by

SANGYA 04720902713

ANUMEHA PATHAK 04520902713


AKASH SINGH TOMAR 03720902713
AMAN GARG 02520902713
Under the Supervision of

SUNITA TIWARI JYOTI

(ASST. PROF. G.B.P.E.C, DELHI) (ASST. PROF. G.B.P.E.C, DELHI)

to the

FACULTY OF COMPUTER SCIENCE

G B PANT GOVT ENGINEERING COLLEGE

OKHLA PHASE -3, NEW DELHI

APRIL 2017

[i]
CERTIFICATE

This is to certify that Report entitled ANTI THEFT HOME which is submitted by us in

partial fulfilment of the requirement for the award of degree B.Tech. In Computer Science

Engineering to GBPEC, GGSIP University, Delhi comprises only our original work and due

acknowledgement has been made in the text to all other material used.

Date: Name of Students

SANGYA

ANUMEHA

AKASH SINGH TOMAR

AMAN GARG

APPROVED BY...................

[ii]
ACKNOWLEDGEMENT

The project has been a success only because of the supportive environment and therefore we
would take the opportunity to thank our teacher coordinators Ms. Sunita Tiwari and Ms.
Jyoti, CSE Dept. (G. B. Pant Govt. Engineering College). It would not have been possible
without their guidance and motivation throughout the project and research.

It gives us great pleasure to place on record our sincere thanks to our teachers for
having generously providing necessary guidance, encouragement, and moral support during
the course of the project preparation.

Finally we extend our gratefulness to one and all who are directly and indirectly
involved in the successful completion of this project work.

[iii]
ABSTRACT

This project, Anti Home Theft is a real life application and implementation of Internet of
Things. IoT is simply the network of interconnected things/devices which are embedded with
sensors, software, network connectivity and necessary electronics that enables them to collect
and exchange data making them responsive. The basic functionality of the project includes a
camera and a sensor which will detect the movement and capture the photographs, a central
processing unit and a platform where the response will be shown. Here we are using
Raspberry Pi as the central processing unit. As for the camera, we are using a Raspbian
camera and PIR sensor.

The PIR sensor keeps checking for any movement and when the motion is detected by
the sensor, it sends a signal to the camera which then captures a photograph and sends it to the
server along with the PI ID. The server then matches the PI ID for the facebook ID of the user
and the captured photograph is sent to the facebook messenger.

[iv]
TABLE OF CONTENTS

CERTIFICATE ii
ACKNOWLEDGEMENT iii
ABSTRACT iv
TABLE OF CONTENTS v
LIST OF TABLES vii
LIST OF FIGURES viii
1. INTRODUCTION 1
2. SYSTEM SPECIFICATION 3
2.1 SOFTWARE SPECIFICATION 3
2.1.1 CHATBOT 3
2.2 HARDWARE SPECIFICATION 8
2.2.1 RASPBERRY PI: 9
2.2.2 PIR Sensor 10
2.2.3 PICAMERA 11

[v]
[vi]
LIST OF TABLES

[vii]
LIST OF FIGURES

[viii]
[ix]
CHAPTER 1
INTRODUCTION

Anti-Theft System:
The basic idea of an anti-theft system revolves around recognition and prevention of any kind
of anti - social activity such as theft and robbery. Our project is based on such a belief. The
project focuses on detection of any kind of physical movement in the range of our device and
then sending data such as pictures to a remote device.

The detection of the movement is done with the help of a PIR Sensor that is a Passive Infrared
Sensor. It measures infrared (IR) light radiating from objects in its field of view. The camera
used for taking pictures is compatible with Raspberry Pi which is a single board
microcomputer.

Our Anti-Theft System makes use of Internet of Things technology which is basically
collaboration between the real life entities such a s cameras and sensors with internet based
facilities such as a Facebook Chat bot. It empowers the users to keep a check of their valuable
belongings even if they are not in the close vicinity of them.

Target Audience:
Being based on IoT, our system is both versatile and flexible. Anyone who thinks he/she has
something valuable, be it material or non-material, they are our target audience. This project
can have a number of applications and its domain can vary from any theft system to normal
monitoring and surveillance systems. With an addition of a few functionalities, we can use it
for managing things like access modifiers and that too with just a click of a button.

A few existing usage of this technology:

A Remote Motion Detector for Lighting


Banks use this technology to keep a check on their safes
Museums use it to prevent theft of their valuables
It can be installed in households for security purposes
It can be used for monitoring and surveillance
Parents use it to keep a check on the activities of their kids

[1]
Motivation:

Motivation for an anti-theft system:

Items may require an anti-theft system for a variety of reasons, which may occur in
combination depending on the type of item and its purpose:

The item is expensive and/or has sentimental value (prestigious car, family heirloom,
birthday gift, war medals, coin collection).
The item is difficult/impossible to replace if lost (produced in low numbers, antiques,
and unique works of art).
The item is easy to steal (retail/supermarket products, office stationery).
The item may be left unattended in an unsafe environment for a certain amount of time
(laptop in a library, car in a car park).
Improper use of the item may cause considerable damage or encourage further
unauthorized actions (theft of car keys, stolen building access keys, identity theft).

Motivation for using Internet Of Things:

Ubiquitous networks personal Wi-Fi on your mobile phone and on every other
device. Everyone (and everything) wants and needs to be connected.
Connected computing we want all of our devices, phones, televisions, music players,
vehicles, etc. to keep track of what we are doing, viewing, reading, and listening to as
we move through our day, from place to place the handoffs from device to device are
already happening.
Ubiquitous sensors on everything. It is already here the Internet of Everything and
the wearable revolution.

[2]
CHAPTER 2
SYSTEM SPECIFICATION

2.1 SOFTWARE SPECIFICATION:

2.1.1 CHATBOT:
Before chatbots there were just bots: a piece of software that is designed to automate
a specific task. A chatbot is built on the same premise; however it delivers this task
around a single function, namely chat, or simulated conversation.

A chatbot uses machine learning to pick up on conversational cadences, allowing it


to effectively mimic human conversation and react to spoken or written prompts to
deliver a service.

The chatbot is essentially a user interface which can be plugged into a number of
data sources via APIs so it can deliver information or services on demand, such as
weather forecasts or breaking news.

How we will use a chatbot?


The PIR sensor installed keeps checking for any movement and whenever the motion
is detected by the sensor, it sends a signal to the camera which then captures a
photograph and sends it to the server along with the PI ID. The server then matches the
PI ID for the facebook ID of the user and the captured photograph is sent to the
facebook messenger.

How To Build Chatbot:


Step 1: Create a Working Webhook Endpoint.

We used django framework to create our chatbot. This code is deployed on the
Heroku which will act as the Webhook that will be used in creating facebook app.

Step 2: Create a Facebook Page.

[3]
You need to create a Facebook Page. The Facebook Page is the identity of your
bot, including the name and image that appears when someone chats with it inside
Facebook Messenger.

Step 3: Create a Facebook App.

You need to create a Facebook Page. The Facebook Page is the identity of your
bot, including the name and image that appears when someone chats with it inside
Facebook Messenger.

Fig 1.

Youll see your new App ID at the top left on the next page. Scroll down and click
Get Started next to Messenger.

[4]
Fig 2

Step 4: Setup Messaging App.

Now were in the Messenger settings of our Facebook App. There are a few things
well need to fill out in order to get our chatbot wired up to the Heroku endpoint
we setup earlier.

Generate a Page Access Token

[5]
Fig 3

Click on the Page Access Token to copy it to your clipboard. Youll need to set it
as an environment variable for your Heroku application. This token will be used to
authenticate your requests whenever you try to send a message or reply to
someone.

Setup Webhook

When you go to setup your Webhook, youll need a few bits of information:

Fig 4

Callback URL - The Heroku (or other) URL that we setup earlier.
Verification Token - A secret value that will be sent to your bot, in order to
verify the request is coming from Facebook. Whatever value you set here,
make sure you add it to your Heroku environment
Subscription Fields - This tells Facebook what messaging events you care
about and want it to notify your Webhook about. If you're not sure, just start
with "messages," as you can change this later.

After youve configured your Webhook, youll need to subscribe to the specific
page you want to receive message notifications for.

[6]
Fig 5

Once weve gotten your Page Access Token and set up our Webhook, and make
sure we set both the PAGE_ACCESS_TOKEN and VERIFY_TOKEN config
values in your Heroku application.

Step 5: Start Chatting With Your Bot.

Fig

[7]
Fig

Start sending your Page messages and the bot should reply. To see whats happening, check
the logs of your application Heroku logs t.

2.2 HARDWARE SPECIFICATION:

RASPBERRY PI
RASPBERRY PI CAM
PIR SENSOR
JUMPER WIRES
HDMI TO HDMI CABLE
HDMI DISPLAY
USB KEYBOARD
USB MOUSE
5V,3A POWER ADAPTER
MICRO SD CARD 16GB

[8]
2.2.1 RASPBERRY PI:

How to set up Raspberry Pi :

SD card Minimum size 4Gb; class 4

HDMI to HDMI / DVI lead HDMI to HDMI lead (for HD TVs and monitors with HDMI input)

Keyboard and mouse Any standard USB keyboard and mouse should work.

Ethernet (network) cable Networking is optional, although it makes updating and getting new
[optional] software for your Raspberry Pi much easier.

Power adapter A good quality, micro USB power supply that can provide at least
700mA at 5V is essential.
Table 1

Preparing SD Card for Raspberry Pi


The SD card contains the Raspberry Pis operating system.

1. Download the Raspberry Pi operating system(Raspbian).


2. Unzip the downloaded file.
3. Right click on the file and choose Extract all.
4. Follow the instructionsyou will end up with a file ending in .img
5. Download win32diskimager-binary.zip
6. Unzip it.
7. Plug SD card into your PC
8. Run the file named Win32DiskImager.exe
9. Click Write.

Booting your Raspberry Pi for the first time


On first boot you will come to the Raspi-config window
Change settings such as timezone and locale if you want
Finally, select the second choice : expand_rootfs and say yes to a reboot
The Raspberry Pi will reboot and you will see raspberrypi login
Type : pi

[9]
You will be asked for your Password
Type : raspberry
You will then see the prompt : pi@raspberry ~ $
Start the desktop by typing : startx
Raspberry Pi is now running.

2.2.2 PIR Sensor


What is a PIR Sensor?
PIR sensor detects a human being moving around within approximately 10m from the
sensor. This is an average value, as the actual detection range is between 5m and
12m.PIR are fundamentally made of a pyro electric sensor, which can detect levels of
infrared radiation. For numerous essential projects or items that need to discover when
an individual has left or entered the area. PIR sensors are incredible, they are flat
control and minimal effort, have a wide lens range, and are simple to interface with.

Most PIR sensors have a 3-pin connection at the side or bottom. One pin will be
ground, another will be signal and the last pin will be power. Power is usually up to
5V. Sometimes bigger modules dont have direct output and instead just operate a
relay which case there is ground, power and the two switch associations. Interfacing
PIR with micro controller is very easy and simple. The PIR acts as a digital output so
all you need to do is listening for the pin to flip high or low. The motion can be
detected by checking for a high signal on a single I/O pin. Once the sensor warms up
the output will remain low until there is motion, at which time the output will swing
high for a couple of seconds, then return low. If motion continues the output will cycle
in this manner until the sensors line of sight of still again. The PIR sensor needs a
warm-up time with a specific end goal to capacity fittingly. This is because of the
settling time included in studying natures domain. This could be anyplace from 10-60
seconds.

Connecting the PIR motion sensor:


Before booting your Raspberry Pi, connect the PIR module to the Raspberry Pi. Using
three female-to-female jumper cables, you'll need to connect each of the PIR sensor's
connectors to the appropriate pins on the Raspberry Pi. Don't rely on the diagram to
identify which pin is which, though: check the labels on the PIR.

[10]
Connect the one labeled VCC on the PIR sensor to the 5V pin on the Raspberry Pi.
This provides power to the PIR sensor.
Connect the one labeled GND to a ground pin on the Raspberry Pi. This completes the
circuit.
Connect the one labeled OUT to GPIO pin 4. This pin will output a voltage when
motion is detected, that can then be received by the Raspberry Pi.

Testing the PIR motion sensor


We're going to use the Python programming language to write some code that will
detect movement and print out some text; we can extend the program to involve the
camera board later on.
The program is pretty simple. We will first set up the Raspberry Pi GPIO pins to allow
us to use pin 4 as an input; it can then detect when the PIR module detects motion. We
need to check the pin continually for any changes, so we use a while True loop for
this. This is an infinite loop so the program will run continuously unless we stop it
manually with Ctrl + F6.
Open IDLE (Menu>Programming>Python3 (IDLE)), create a new file (by using the
File>New File menu options within IDLE) and copy in the code below.

from gpiozero import MotionSensor

pir = MotionSensor(4)
while True:
if pir.motion_detected:
print("Motion detected!)

Save your file and press F5 to run it.

Every time the PIR detects motion, you should see the words Motion detected! appear
in the IDLE shell. Press Ctrl + F6 when you want to exit.

2.2.3 PICAMERA
The Camera Module is a great accessory for the Raspberry Pi, allowing users to take
still pictures and record video in full HD.
Connect the Camera Module
Locate the camera port and connect the camera:
Connect the camera

[11]
Start up the Pi.
Open the Raspberry Pi Configuration Tool from the main menu:
Raspberry Pi Configuration Tool
Ensure the camera software is enabled:
Camera software enabled
If it's not enabled, enable it and reboot your Pi to begin.

Camera Preview
Now your camera is connected and the software is enabled, you can get started by
trying out the camera preview.

1. Open Python 3 from the main menu


2. Open a new file and save it as camera.py. It's important that you do not save it as
picamera.py.
3. Enter the following code:

from picamera import PiCamera


from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(10)
camera.stop_preview()

4. Save with Ctrl + S and run with F5. The camera preview should be shown for 10
seconds, and then close. Move the camera around to preview what the camera sees.
5. If your preview was upside-down, you can rotate it with the following code:

camera.rotation = 180
camera.start_preview()
sleep(10)
camera.stop_preview()
You can rotate the image by 90, 180, or 270 degrees, or you can set it to 0 to reset.
6. You can alter the transparency of the camera preview by setting an alpha level:

from picamera import PiCamera


from time import sleep

camera = PiCamera()

[12]
camera.start_preview(alpha=200)
sleep(10)
camera.stop_preview()
alpha can be any value between 0 and 255.

Fig

Fig

[13]
Fig

Fig

[14]
[15]

Você também pode gostar